linux/drivers/platform/chrome
Bill Richardson f3f837e52b platform/chrome: Expose Chrome OS Lightbar to users
This adds some sysfs entries to provide userspace control of the
four-element LED "lightbar" on the Chromebook Pixel. This only instantiates
the lightbar controls if the device actually exists.

To prevent DoS attacks, this interface is limited to 20 accesses/second,
although that rate can be adjusted by a privileged user.

On Chromebooks without a lightbar, this should have no effect. On the
Chromebook Pixel, you should be able to do things like this:

    $ cd /sys/devices/virtual/chromeos/cros_ec/lightbar
    $ echo 0x80 > brightness
    $ echo 255 > brightness
    $
    $ cat sequence
    S0
    $ echo konami > sequence
    $ cat sequence
    KONAMI
    $
    $ cat sequence
    S0

And

    $ cd /sys/devices/virtual/chromeos/cros_ec/lightbar
    $ echo stop > sequence
    $ echo "4 255 255 255" > led_rgb
    $ echo "0 255 0 0  1 0 255 0  2 0 0 255  3 255 255 0" > led_rgb
    $ echo run  > sequence

Test the DoS prevention with this:

    $ cd /sys/devices/virtual/chromeos/cros_ec/lightbar
    $ echo 500 > interval_msec
    $ time (cat version version version version version version version)

Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Olof Johansson <olofj@chromium.org>
Tested-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Tested-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Olof Johansson <olof@lixom.net>
2015-02-26 15:45:16 -08:00
..
chromeos_laptop.c platform: chrome: drop owner assignment from platform_drivers 2014-10-20 16:21:26 +02:00
chromeos_pstore.c platform/chrome: pstore: fix dmi table to match all chrome systems 2014-07-10 10:38:41 -07:00
cros_ec_dev.c platform/chrome: Expose Chrome OS Lightbar to users 2015-02-26 15:45:16 -08:00
cros_ec_dev.h platform/chrome: Expose Chrome OS Lightbar to users 2015-02-26 15:45:16 -08:00
cros_ec_lightbar.c platform/chrome: Expose Chrome OS Lightbar to users 2015-02-26 15:45:16 -08:00
cros_ec_lpc.c platform/chrome: Add cros_ec_lpc driver for x86 devices 2015-02-26 15:45:02 -08:00
cros_ec_sysfs.c platform/chrome: Create sysfs attributes for the ChromeOS EC 2015-02-26 15:45:12 -08:00
Kconfig platform/chrome: Add Chrome OS EC userspace device interface 2015-02-26 15:45:06 -08:00
Makefile platform/chrome: Expose Chrome OS Lightbar to users 2015-02-26 15:45:16 -08:00