leds-class.txt 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. LED handling under Linux
  2. ========================
  3. If you're reading this and thinking about keyboard leds, these are
  4. handled by the input subsystem and the led class is *not* needed.
  5. In its simplest form, the LED class just allows control of LEDs from
  6. userspace. LEDs appear in /sys/class/leds/. The brightness file will
  7. set the brightness of the LED (taking a value 0-255). Most LEDs don't
  8. have hardware brightness support so will just be turned on for non-zero
  9. brightness settings.
  10. The class also introduces the optional concept of an LED trigger. A trigger
  11. is a kernel based source of led events. Triggers can either be simple or
  12. complex. A simple trigger isn't configurable and is designed to slot into
  13. existing subsystems with minimal additional code. Examples are the ide-disk,
  14. nand-disk and sharpsl-charge triggers. With led triggers disabled, the code
  15. optimises away.
  16. Complex triggers whilst available to all LEDs have LED specific
  17. parameters and work on a per LED basis. The timer trigger is an example.
  18. You can change triggers in a similar manner to the way an IO scheduler
  19. is chosen (via /sys/class/leds/<device>/trigger). Trigger specific
  20. parameters can appear in /sys/class/leds/<device> once a given trigger is
  21. selected.
  22. Design Philosophy
  23. =================
  24. The underlying design philosophy is simplicity. LEDs are simple devices
  25. and the aim is to keep a small amount of code giving as much functionality
  26. as possible. Please keep this in mind when suggesting enhancements.
  27. LED Device Naming
  28. =================
  29. Is currently of the form:
  30. "devicename:colour"
  31. There have been calls for LED properties such as colour to be exported as
  32. individual led class attributes. As a solution which doesn't incur as much
  33. overhead, I suggest these become part of the device name. The naming scheme
  34. above leaves scope for further attributes should they be needed.
  35. Known Issues
  36. ============
  37. The LED Trigger core cannot be a module as the simple trigger functions
  38. would cause nightmare dependency issues. I see this as a minor issue
  39. compared to the benefits the simple trigger functionality brings. The
  40. rest of the LED subsystem can be modular.
  41. Some leds can be programmed to flash in hardware. As this isn't a generic
  42. LED device property, this should be exported as a device specific sysfs
  43. attribute rather than part of the class if this functionality is required.
  44. Future Development
  45. ==================
  46. At the moment, a trigger can't be created specifically for a single LED.
  47. There are a number of cases where a trigger might only be mappable to a
  48. particular LED (ACPI?). The addition of triggers provided by the LED driver
  49. should cover this option and be possible to add without breaking the
  50. current interface.