
Security News
NVD Concedes Inability to Keep Pace with Surging CVE Disclosures in 2025
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
A Ruby library for controlling the LEDs on buzz controllers in Linux.
Warning: ruby_buzz has to change some rights down in the /sys and /dev folders of Linux in order to access the kernel. You will be asked for your password in order to use ruby_buzz.
The scripts folder contains examples of the input and output functionality for the buzz controllers.
Turn on buzzer 1
ruby scripts/light.rb 1 on
Turn off buzzer 1
ruby scripts/light.rb 1 off
Watch the inputs
ruby scripts/read.rb
(press ctrl+c to stop)
Pushing the buzzer lights that buzzer
ruby scripts/events.rb
(press ctrl+c to stop)
Include the ruby_buzz library
require 'ruby_buzz'
The Buzz controller has 4 pads, each of which has four lights. They can be accessed like so:
# Via the pads
RubyBuzz::Pad[0]
RubyBuzz::Pad[0].light
RubyBuzz::Pad.all
# A control for light 1, divorced from the pad.
RubyBuzz::Light.new(0)
Control one light:
pad = RubyBuzz::Pad[0]
pad.light.on
sleep 1
pad.light.off
A quick light show
RubyBuzz::Pad.all.each do |pad|
pad.light.on
sleep 0.1
end
RubyBuzz::Pad.all.each do |pad|
pad.light.off
sleep 0.1
end
If you abandon your script before all the lights are turned off they
will say on indefinitely. You may want to rescue SystemExit and Interrupt
errors with RubyBuzz::Light.all_off
E.g.
begin
loop do
RubyBuzz::Pad[rand(4)].light.on
RubyBuzz::Pad[rand(4)].light.off
sleep 0.1
end
rescue SystemExit, Interrupt
RubyBuzz::Light.all_off
end
Include the ruby_buzz library
require 'ruby_buzz'
The Buzz controller has 4 pads, each of which has four buttons named:
They can be found like this:
RubyBuzz::Pad[0]
RubyBuzz::Pad[0].buttons
RubyBuzz::Pad[0].buttons[:buzz]
RubyBuzz::Pad.all
You can define a block of code to be run by a given button like this:
RubyBuzz::Pad[0].add_event(
:buzz,
lambda {
puts "Player 1 buzzed!"
}
)
You can debug the actions you've added to a button with trigger_events
RubyBuzz::Pad[0].trigger_events
How about getting it to run when you press the button?
The RubyBuzz::Device class is responsible for reading the raw input from the Buzz controllers via the linux terminal. Because it's reading a data stream, it needs to start a background process to allow it to work while other ruby code is operating.
You can start background process, which executes the events you added to the buttons, with start_watching.
device = RubyBuzz::Device.new
RubyBuzz::Pad.all.each do |pad|
pad.add_event(:buzz, lambda { puts "Buzz!" }
)
device.start_watching
Note: This process will end when your ruby process ends, but if you
want to stop it before that stage, you can call device.stop_watching
If you want to do nothing other than watch the buttons, you may want to follow start_watching with an empty loop.
device = RubyBuzz::Device.new
RubyBuzz::Pad.all.each do |pad|
pad.add_event(:buzz, lambda { puts "Buzz!" }
)
device.start_watching
loop do
end
This repo includes a modified version of the devinput class from https://github.com/kamaradclimber/libdevinput Which was forked from https://github.com/prullmann/libdevinput
FAQs
Unknown package
We found that ruby_buzz 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
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.
Security News
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.