Keyleds::Device
Inherits Reference < Object
Represents a physical Logitech device that can be interfaced with.
Constants
The full range of valid application IDs that can be used for initialization (i.e. Device.open.)
Constructors
Creates a new Device. Must be explicitly closed with Device#close after usage.
pathmust be a valid path to the device's corresponding HID file (i.e./dev/hidraw1).app_idis a constant identifier for use with all further device communication. SeeAPP_IDSfor valid arguments.
Class methods
Creates a new Device with the given parameters, yields it to a block, and automatically closes the device.
Instance methods
Enables or disable custom G-key behavior. If false, G-keys will default to their corresponding F-keys.
Finds the feature ID of a feature, given its index in the device's internal feature table.
Given a feature's ID, returns its index in the device's internal table.
Adds the given keys, represented by their scancodes, to the game mode block list.
Returns the maximum possible number of keys that can be blocked at a time during game mode.
Remove the given keys, represented by their scancodes, from the game mode block list.
Starting at key_offset within the given block, returns num_keys current LED states.
Defines a callback that should be run whenever a G-key (or M/MR-key) is pressed.
The second parameter is a BitArray, with the first bit representing the first key in the group.
Triggered by Device#flush.
Keyleds::Device.open("/dev/hidraw1", 1) do |dev|
dev.custom_gkeys(true)
dev.on_gkey do |type, keys|
puts "is the first key on? #{keys[0]}"
end
loop { dev.flush } # is the first key on? false
end
Resynchronizes with the device. Use as a recovery mechanism after another call has errored.
Sets the entire LED block to a single uniform color.
Must be committed with Device#commit_leds.
Sets the LED color for the given keys.
Must be committed with Device#commit_leds.