todbot / hidapitester

Simple command-line program to test HIDAPI
GNU General Public License v3.0
254 stars 29 forks source link

Multiple device support for Logitech Litra Glow. #32

Open kootstra opened 1 month ago

kootstra commented 1 month ago

On my Windows 10 system I have 2 Logitech Litra Glow devices that are connected through a dock to my notebook. When I use the below scripts I am able to switch 1 on and off.

On hidapitester.exe --quiet --vidpid 046D/C900 --usagePage FF43 --open --length 20 --send-output 0x11,0xff,0x04,0x1c,0x01

Off hidapitester.exe --quiet --vidpid 046D/C900 --usagePage FF43 --open --length 20 --send-output 0x11,0xff,0x04,0x1c,0x00

Now, I am able to get both of them to switch on and off by moving to Microsoft Edge or Microsoft Word - not outlook, teams etc. Run the command. First one switches on. Move to browser to switch the second one on, and then run command to switch the first one off and then move to browser to switch the second one off.

The applications that do this have application specific settings in Logi Options+, but not for my Logitech Litra's but my mouse (MX Master 3).

Help to understand and improve is appreciated.

todbot commented 1 month ago

To distinguish between identical devices, you will need to write your own HID code that queries them for some aspect that is unique to each of them.

If the devices provide a USB standard serial number (which you would see with hidapitester --list-detail), then we could add an extra argument to select by serial number.

fbn3799 commented 1 day ago

I would also like to have the option to control two or more devices. For now, what works for me is calling the function a couple of times in a row. The script seems to get one of the lights at random and if I call it more than once, both of the lights will respond most of the time. In rare cases, it only controls only one device. That's what I did:

function _hid() { /usr/local/bin/hidapitester --vidpid 046D/C901 --open --length 20 --send-output $1; /usr/local/bin/hidapitester --vidpid 046D/C901 --open --length 20 --send-output $1; /usr/local/bin/hidapitester --vidpid 046D/C901 --open --length 20 --send-output $1 }

I guess it's not stupid if it works :)