smasty/g203-led

Support for multiple devices

kpostrup opened this issue · 7 comments

Hello,

Thank you. I tested this on a "Logitech G Pro Gaming Mouse" and it works just great.
I just had to change the Product ID from c084 to c085 to match output from lsusb -v

An idea could be to incorporate a check to automatically identify the device. However it might be tricky if multiple Logitech G RGB devices are attached.

Thanks for your feedback! Can you verify that all the options work as expected? Namely:

  • Solid color mode
  • Cycle color mode + changing rate and brightness
  • Breathe mode + changing rate and max brightness
  • Startup effect enable/disable

I'm mostly interested to see if the startup effect enable/disable option works as well.

If all the options work, I might add support for multiple devices later...

Hello, thanks for your project!

I tried your package to control my Logitech G102 Prodigy Gaming Mouse.
Just wanted to approve, that all functions, including startup effect, work as expected.
specs: Ubuntu 18.04.1 LTS, python 3.6

@Datamined Thanks! I'll include it in the next update when I finally find some time to update this project. Can you tell me what Product ID does the G102 Mouse use?

Bus 002 Device 004: ID 046d:c084 Logitech, Inc.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x046d Logitech, Inc.
idProduct 0xc084
bcdDevice 7.03
iManufacturer 1 Logitech
iProduct 2 G102 Prodigy Gaming Mouse
iSerial 3 067738533532
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x003b
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 4 U107.03_B0015
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 300mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 2 Mouse
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.11
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 67
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.11
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 151
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0014 1x 20 bytes
bInterval 1

@Datamined Thanks! I'll include it in the next update when I finally find some time to update this project. Can you tell me what Product ID does the G102 Mouse use?

Beware that there are two different G102 versions on the market - Prodigy and Lightsync, both identical in appearance. The G203 and G102 Prodigy work with g203-led, but G102 Lightsync does not.

This "Lightsync" technology provides ability to synchronize the backlight effects across multiple G devices. Logitech probably changed the USB API because of that, which would explain why the current hex codes in g203-led don't work for G102 Lightsync anymore.

The G102 Lightsync product ID is 0xC092.

@smasty, if you have any general hints for your original reverse-engineering with Wireshark, I could try to replicate the effort for G102 Lightsync and submit a patch. (No promises, though.)

FTR, my configuration is below. The device does get found by pyusb and the script throws no exceptions.

  • Ubuntu 20.04
  • Linux 5.4.0
  • libusb 1.0.23
  • pyusb 1.1.1
  • Python 3.8.5

@jursed

if you have any general hints for your original reverse-engineering with Wireshark, I could try to replicate the effort for G102 Lightsync and submit a patch. (No promises, though.)

I don't remember the process exactly anymore, but the gist of it is to use the Windows version of the Logitech G software to set the settings for the mouse, while capturing the packets on the USB bus with USBPCap. You could do it on a separate Windows machine, or probably also with a Windows running in a VM, but I used a separate PC. Afterwards you open the capture file in Wireshark and try to look for some packets containing e.g the timing or color information you set in the software. Then you could send the packets from linux by modifying the g203-led script. A lot of trial and error will definitely be involved.