Hi Andreas, On Sat, Oct 22, 2022 at 2:48 PM Andreas Bergmeier <abergmeier@xxxxxxx> wrote: > > > Date: Mon, 17 Oct 2022 18:45:30 +0200 > > From: Andreas Bergmeier <abergmeier@xxxxxxx> > > To: linux-usb@xxxxxxxxxxxxxxx > > Subject: Litra Glow on Linux > > > > On my Ubuntu machine i am running 5.15.0. Now when I plugin in my > > Logitech Litra Glow, it gets detected and the following shows up in my > > dmesg: > > > > ``` > > input: Logi Litra Glow Consumer Control as > > /devices/pci0000:00/0000:00:14.0/usb3/3-4/3-4.2/3-4.2:1.0/0003:046D:C900.000B/input/input75 > > hid-generic 0003:046D:C900.000B: input,hiddev0,hidraw2: USB HID v1.11 > > Device [Logi Litra Glow] on usb-0000:00:14.0-4.2/input0 > > ``` > > > > Via (hardware) buttons you can switch the device on, regulate the > > color temperature as well as the brightness. > So I looked into the sources of `hid-input` and `hig-lg` and I hope > that I have a halfway decent > understanding why the linux modules/dev nodes handle the way they do. > What I do not yet understand is how to map the device to input "primitives". Depending on how the device presents itself, we might have to use hid-logitech-hidpp, not hid-lg FWIW. And to answer the question "how to map the device to input "primitives".", it all depends on how the device exports itself. > To recap there are 5 hardware buttons and 3 states: > - State: "Color temperature in range [u, x]" Button: up > - State: "Color temperature in range [u, x]" Button: down > - State/Button On/Off > - State "Brightness in range [y, z]" Button: up > - State "Brightness in range [y, z]" Button: down FWIW, you should be able to use hid-recorder[0] (as root) to record traces of the events, and to parse them on the fly. Also, if you provide us the output, we can replay the traces locally as if we virtually plugged in the device. > > What would be a best practice to expose these correctly via HID (as > e.g. ABS_WHEEL?)? This doesn't look like a wheel at all, but more like simple buttons from your description. We should let userspace deal with the representation as a slider by its own. Also, are the buttons configuring the hardware directly or do you need some software to actually change the brightness/color? And FWIW, the device looks like we should probably just export it as a led class device, with brightness and color support. > Or at least - what are the canonical options? > > Since the exposed Record interface seems "wrong" I assume I need to > write code to fix the device handling. > Now, is this better suited in `hid-input` or `hid-lg`? Again, it depends. If the device speaks the same high level interface as other consumer Logitech devices (mice, keyboards, etc...) hid-logitech-hidpp is the best way forward, but if not, hid-lg would be the place to start. > The former currently tries to handle the device (wrongly) and the > latter yet ignores the device but seems to be > the one stop to fix Logitech devices. > > > > I know of no way to fully control the device from my computer and > > would like to change that. > By now I am confident that I will soon have the full device control figured out. > Glad to hear that. But again, we need to know the device a little bit more. FWIW, if the first byte you have to send to control the LED is 0x10, 0x11 or 0x12 then this is a HID++ device that needs to go in hid-logitech-hidpp and a lot of groundwork is already done in the kernel for it. Cheers, Benjamin