sysfs-class-led-trigger-pattern 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. What: /sys/class/leds/<led>/pattern
  2. Date: September 2018
  3. KernelVersion: 4.20
  4. Description:
  5. Specify a software pattern for the LED, that supports altering
  6. the brightness for the specified duration with one software
  7. timer. It can do gradual dimming and step change of brightness.
  8. The pattern is given by a series of tuples, of brightness and
  9. duration (ms). The LED is expected to traverse the series and
  10. each brightness value for the specified duration. Duration of
  11. 0 means brightness should immediately change to new value, and
  12. writing malformed pattern deactivates any active one.
  13. 1. For gradual dimming, the dimming interval now is set as 50
  14. milliseconds. So the tuple with duration less than dimming
  15. interval (50ms) is treated as a step change of brightness,
  16. i.e. the subsequent brightness will be applied without adding
  17. intervening dimming intervals.
  18. The gradual dimming format of the software pattern values should be:
  19. "brightness_1 duration_1 brightness_2 duration_2 brightness_3
  20. duration_3 ...". For example:
  21. echo 0 1000 255 2000 > pattern
  22. It will make the LED go gradually from zero-intensity to max (255)
  23. intensity in 1000 milliseconds, then back to zero intensity in 2000
  24. milliseconds:
  25. LED brightness
  26. ^
  27. 255-| / \ / \ /
  28. | / \ / \ /
  29. | / \ / \ /
  30. | / \ / \ /
  31. 0-| / \/ \/
  32. +---0----1----2----3----4----5----6------------> time (s)
  33. 2. To make the LED go instantly from one brightness value to another,
  34. we should use zero-time lengths (the brightness must be same as
  35. the previous tuple's). So the format should be:
  36. "brightness_1 duration_1 brightness_1 0 brightness_2 duration_2
  37. brightness_2 0 ...". For example:
  38. echo 0 1000 0 0 255 2000 255 0 > pattern
  39. It will make the LED stay off for one second, then stay at max brightness
  40. for two seconds:
  41. LED brightness
  42. ^
  43. 255-| +---------+ +---------+
  44. | | | | |
  45. | | | | |
  46. | | | | |
  47. 0-| -----+ +----+ +----
  48. +---0----1----2----3----4----5----6------------> time (s)
  49. What: /sys/class/leds/<led>/hw_pattern
  50. Date: September 2018
  51. KernelVersion: 4.20
  52. Description:
  53. Specify a hardware pattern for the LED, for LED hardware that
  54. supports autonomously controlling brightness over time, according
  55. to some preprogrammed hardware patterns. It deactivates any active
  56. software pattern.
  57. Since different LED hardware can have different semantics of
  58. hardware patterns, each driver is expected to provide its own
  59. description for the hardware patterns in their ABI documentation
  60. file.
  61. What: /sys/class/leds/<led>/repeat
  62. Date: September 2018
  63. KernelVersion: 4.20
  64. Description:
  65. Specify a pattern repeat number. -1 means repeat indefinitely,
  66. other negative numbers and number 0 are invalid.
  67. This file will always return the originally written repeat
  68. number.