On Fri, Dec 13, 2019 at 10:34:59PM +0100, Patrick Wildt wrote:
> 
> Hi,
> 
> I have a ThingM blink(1) USB RGB device that shows up as uhid(4).
> The tooling is "interesting", especially with all those libusb and
> HID libraries doing the abstraction.  This introduces ublink(4), a
> dedicated kernel driver for that device.  There are two LEDs on the
> device, which can be modified seperately.  The firmware is impress-
> ive and provides features like playing sequences and adjusting how
> long it should take to fade from one colour to another.  Obviously
> this also increases the complexity of the tools involved to toggle
> those RGB LEDs.  Thus, the driver is kept simple (for now).
> 
> In addition to providing a way to set RGB LEDs, we can also use it
> as a watchdog.  If we don't "tickle" it in a specific timeframe it
> will play a (unless otherwise programmed) random sequence, which for
> instance can be used to see that the machine has paniced.  This has
> been quite useful while debugging the USB stack, because once the
> magic sequence started you know that you're in deep trouble.  All
> other features are unimplemented.  Gamma correction would be nice
> to have.
> 
> Since there is no abstraction layer for LEDs yet, this also intro-
> duces led(4), which attaches to ublink(4), and provides /dev/ledX.
> 
> uhidev1 at uhub0 port 3 configuration 1 interface 0 "ThingM blink(1) mk2" rev 
> 2.00/0.02 addr 2
> uhidev1: iclass 3/0, 1 report id
> ublink0 at uhidev1 reportid 1
> led0 at ublink0: 2 LEDs
> 
> led(4) can be improved even further.  We can attach the ThinkPad
> LEDs to it to control it.  There are also plenty of mouses that
> have controllable RGBs. We could add "human readable descrip-
> tions", for instance "upper side LED" or "docking station LED",
> so that users can find out more easily which LED they have to
> toggle.  A fading or blinking mechanism, including hardware off-
> loading, can probably be added as well.
> 
> To be able to control those devices, there's ledctl(1), a simple
> program that can turn on/off /dev/ledX devices and also set RGB
> colours.
> 
> I only did the MAKEDEV stuff for amd64, and also there are no
> manpages yet.  Also I haven't run it through make build yet,
> sorry.  And I don't often do userland tools, so feel free to
> let me know how to improve it.

I tested with my ThingM blink(1) mk2:

uhidev2 at uhub3 port 4 configuration 1 interface 0 "ThingM blink(1) mk2" rev 
2.00/0.02 addr 4
uhidev2: iclass 3/0, 1 report id
ublink0 at uhidev2 reportid 1
led0 at ublink0: 2 LEDs

Turning the LED on or off, and set it to blue (ledctl ff), all work for me.

> Thanks,
> Patrick

        Kevin

Reply via email to