-
Notifications
You must be signed in to change notification settings - Fork 89
LED Controllers
The engine has support for a limited range of built-in LED controllers, those that are provided by the input platform (like numlock/capslock on a keyboard), the display platform (backlight control on laptops) and some special USB- based controllers (like the PacDrive).
They can be controlled via the set_led and set_led_rgb calls respectively, and can be queried or rescanned via the controller_leds command. Dynamic changes to the set of available led controllers are delivered as a normal applname_input_event with the kind field set to status.
There is also the option to add one external LED controller over a simple FIFO protocol, which is the preferred way for adding support for new devices that are not coupled to platform-managed device.
It is enabled by setting the ext_led key for the 'arcan' appl in the database, like this:
arcan_db add_appl_kv arcan ext_led /tmp/led_fifo
it will register with the label (fifo), and led control commands follow this 2-byte protocol:
byte 1 | byte 2 | description |
---|---|---|
A | set active led to ALL | |
a | ind | set active led to ind |
r | val | set subchannel R value |
g | val | set subchannel G value |
b | val | set subchannel B value |
i | val | set subchannel ALL value (intensity) |
c | 0 or 1 | commit, update the set led or if !0, queue |
o | deregistered, FIFO will be terminated. |
More devices can be added by continuing the pattern, like ext_led_2, ext_led_3 and so on.
There is a skeleton client implementation in src/tools/leddec.c for testing that the feature works, and for saving a few seconds when wrapping some LED device. There are also some more loosely covered patches to drivers, and custom jobs for things like arduino at aledctrl.