5

I have one of these:

Basically, it's a USB device with three LEDs (red, green, and blue).

The Linux kernel has supported this device through the usbled module for quite some time now. However, I am not sure how to actually control the device from a Bash script. The /sys directory contains the following files:

root@desktop:/sys/devices/pci0000:00/0000:00:13.0/usb5/5-3/5-3:1.0# ls
bAlternateSetting   bInterfaceSubClass  ep_81     red
bInterfaceClass     blue                green     subsystem
bInterfaceNumber    bNumEndpoints       modalias  supports_autosuspend
bInterfaceProtocol  driver              power     uevent

1 Answer 1

5

The files red, green, and blue are char devices that allow ASCII decimal values to be written to them.

For example, to change the device to bright red, one would do the following*:

#!/bin/bash

echo 9 >red
echo 0 >green
echo 0 >blue

* note that this must be run as root

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.