uleds.rst 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. ==============
  2. Userspace LEDs
  3. ==============
  4. The uleds driver supports userspace LEDs. This can be useful for testing
  5. triggers and can also be used to implement virtual LEDs.
  6. Usage
  7. =====
  8. When the driver is loaded, a character device is created at /dev/uleds. To
  9. create a new LED class device, open /dev/uleds and write a uleds_user_dev
  10. structure to it (found in kernel public header file linux/uleds.h)::
  11. #define LED_MAX_NAME_SIZE 64
  12. struct uleds_user_dev {
  13. char name[LED_MAX_NAME_SIZE];
  14. };
  15. A new LED class device will be created with the name given. The name can be
  16. any valid sysfs device node name, but consider using the LED class naming
  17. convention of "devicename:color:function".
  18. The current brightness is found by reading a single byte from the character
  19. device. Values are unsigned: 0 to 255. Reading will block until the brightness
  20. changes. The device node can also be polled to notify when the brightness value
  21. changes.
  22. The LED class device will be removed when the open file handle to /dev/uleds
  23. is closed.
  24. Multiple LED class devices are created by opening additional file handles to
  25. /dev/uleds.
  26. See tools/leds/uledmon.c for an example userspace program.