Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
This gem is designed to make it easy to interface with some LCD displays.
I wanted to add a front panel LCD to a server I was building, so I started this project to address interacting with the LCD panel I picked up.
Currently it works with the PicoLCD from www.mini-box.com.
This gem depends on HID API.
Installation of the dependency is specific to the environment.
For OS X (using homebrew):
$ brew install hidapi
For Ubuntu/Debian:
$ sudo apt-get install libhidapi-libusb0
$ cd /usr/lib/x86_64-linux-gnu
$ sudo ln -s libhidapi-libusb.so.0.0.0 libhidapi.so
Add this line to your application's Gemfile:
gem 'barkest_lcd'
And then execute:
$ bundle
Or install it yourself as:
$ gem install barkest_lcd
Let's assume you have one picoLCD 256x64 device attached to your computer. Usage is fairly simple.
This example will draw a 32x32 rectangle with an X in it.
my_device = BarkestLcd::PicoLcdGraphic.first
my_device.open
my_device.draw_rect(40, 4, 32, 32).draw_line(40, 4, 72, 36).draw_line(40, 36, 72, 4)
my_device.paint
As you can see, most of the methods are chainable. Unless the method has an explicit return value (like open?
) then
the method should be returning the device model. The open
, close
, and paint
methods are all chainable as well.
There are currently some very basic drawing methods included by the SimpleGraphic
module. These include set_bit
,
draw_vline
, draw_hline
, draw_line
, and draw_rect
. The clear
method will clear the screen.
Continuing, we will wait for the user to press the OK button.
OK_BUTTON = 6
ok_pressed = false
# set the callback to process keys when they are released.
my_device.on_key_up do |key|
if key == OK_BUTTON
ok_pressed = true
end
end
# use the "loop" function to process events with the device and update the screen.
until ok_pressed
my_device.loop
end
In this case we set the on_key_up
callback to set a flag when the OK button is pressed. If we wanted to do repeating
keys when a user holds down a button, we may want to set the on_key_down
or use the key_state
method within the loop.
Finally, I recommend closing the device when you are finished. Ruby will close the device when it exits, but if you
are handling errors and such, closing the device explicitly in an ensure
block will help to protect you against being
unable to open the device again.
my_device.clear.paint
my_device.close
It is not necessary to clear the screen before closing, but doing so ensures that you do not leave weird information or screen artifacts up when your application is done.
Copyright (c) 2016 Beau Barker
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that barkest_lcd demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.