Re: [PATCH 0/4] HID: Improve handling of multimode Logitech handling wheels

From: Simon Wood
Date: Fri Feb 13 2015 - 11:27:58 EST


Hi all,
I tested this with a DFP, G27 and WiiWheell was looking good, but then
I found a small bug.

It seems that the requested mode is case sensitive. 'G25' works, but
'g25' is seen as a request for a 'DF-GT' and causes and error.

Sorry I didn't see this earlier. I'd be happy to apply and fix later,
but I suspect Jiri will say fix it first.
Simon

PS. Resent via Gmail as my hosting is having issues.

On Fri, 6 Feb 2015 10:27:21 -0700, simon@xxxxxxxxxxxxx wrote:
> > This patch series improves handling of various Logitech gaming wheels and
> > allows switching between various compatibility modes which might be useful
> > to improve compatibility with very old games and testing purposes.
>
> Hi all,
> We should note that part 1 performs a very important function of identify
> the wheels as per Logitech's schema.
>
> At present our (old detection) uses USB Revision to identify 'fancy'
> wheels which can be placed into native mode. This means when Logitech
> updates the hardware we are playing catch-up (this has happened 3 times
> with the DF-GT wheel so far).
>
> This newer code should automatically cope with new wheels in the future.
>
>
> Thanks to Michal for undertaking this work. I have been testing the code
> over the past weeks and believe it to be working, I will confirm mid-next
> week when I can gain access to my wheels.
>
> Simon

Got this while testing....
--
Feb 12 19:52:00 bigbox kernel: [ 966.044022] usb 8-2: new full-speed USB device number 16 using uhci_hcd
Feb 12 19:52:00 bigbox kernel: [ 966.215031] usb 8-2: New USB device found, idVendor=046d, idProduct=c298
Feb 12 19:52:00 bigbox kernel: [ 966.215035] usb 8-2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
Feb 12 19:52:00 bigbox kernel: [ 966.215038] usb 8-2: Product: G27 Racing Wheel
Feb 12 19:52:00 bigbox kernel: [ 966.218081] drivers/hid/usbhid/hid-core.c: HID probe called for ifnum 0
Feb 12 19:52:00 bigbox kernel: [ 966.225084] logitech 0003:046D:C298.0012: fixing up Logitech Driving Force Pro report descri
ptor
Feb 12 19:52:00 bigbox kernel: [ 966.225545] input: G27 Racing Wheel as /devices/pci0000:00/0000:00:1d.3/usb8/8-2/8-2:1.0/000
3:046D:C298.0012/input/input24
Feb 12 19:52:00 bigbox mtp-probe: checking bus 8, device 16: "/sys/devices/pci0000:00/0000:00:1d.3/usb8/8-2"
Feb 12 19:52:00 bigbox mtp-probe: bus: 8, device: 16 was not an MTP device
Feb 12 19:52:00 bigbox kernel: [ 966.280150] logitech 0003:046D:C298.0012: input,hidraw2: USB HID v1.00 Joystick [G27 Racing
Wheel] on usb-0000:00:1d.3-2/input0
Feb 12 19:52:00 bigbox kernel: [ 966.280155] drivers/hid/hid-lg4ff.c: Found wheel with real PID C29B whose reported PID is C2
98
Feb 12 19:52:00 bigbox kernel: [ 966.280158] drivers/hid/hid-lg4ff.c: Found compatible device, product ID C298
Feb 12 19:52:00 bigbox kernel: [ 966.280166] drivers/hid/usbhid/hid-core.c: submitting out urb
Feb 12 19:52:00 bigbox kernel: [ 966.280174] drivers/hid/hid-lg4ff.c: sysfs interface created
Feb 12 19:52:00 bigbox kernel: [ 966.280176] drivers/hid/hid-lg4ff.c: Driving Force Pro: setting range to 900
Feb 12 19:52:00 bigbox kernel: [ 966.280179] logitech 0003:046D:C298.0012: Force feedback support for Logitech Gaming Wheels
Feb 12 19:52:00 bigbox kernel: [ 966.286030] drivers/hid/usbhid/hid-core.c: submitting out urb
Feb 12 19:52:00 bigbox kernel: [ 966.294030] drivers/hid/usbhid/hid-core.c: submitting out urb
Feb 12 19:52:26 bigbox kernel: [ 992.162555] drivers/hid/hid-lg4ff.c: Alternate mode "DFGT" not supported by the device
--

Note I don't have a DFGT, and didn't ask for a fake one....


Unplug and replug
--
Feb 12 20:05:15 bigbox kernel: [ 1761.104019] usb 8-2: new full-speed USB device number 23 using uhci_hcd
Feb 12 20:05:15 bigbox kernel: [ 1761.275032] usb 8-2: New USB device found, idVendor=046d, idProduct=c294
Feb 12 20:05:15 bigbox kernel: [ 1761.275037] usb 8-2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
Feb 12 20:05:15 bigbox kernel: [ 1761.275040] usb 8-2: Product: G27 Racing Wheel
Feb 12 20:05:15 bigbox kernel: [ 1761.278091] drivers/hid/usbhid/hid-core.c: HID probe called for ifnum 0
Feb 12 20:05:15 bigbox kernel: [ 1761.286543] input: G27 Racing Wheel as /devices/pci0000:00/0000:00:1d.3/usb8/8-2/8-2:1.0/0003:046D:C294.0019/input/input31
Feb 12 20:05:15 bigbox mtp-probe: checking bus 8, device 23: "/sys/devices/pci0000:00/0000:00:1d.3/usb8/8-2"
Feb 12 20:05:15 bigbox mtp-probe: bus: 8, device: 23 was not an MTP device
Feb 12 20:05:15 bigbox kernel: [ 1761.340180] logitech 0003:046D:C294.0019: input,hidraw2: USB HID v1.00 Joystick [G27 Racing Wheel] on usb-0000:00:1d.3-2/input0
Feb 12 20:05:15 bigbox kernel: [ 1761.340186] drivers/hid/hid-lg4ff.c: Found wheel with real PID C29B whose reported PID is C294
Feb 12 20:05:15 bigbox kernel: [ 1761.340188] drivers/hid/hid-lg4ff.c: Found compatible device, product ID C294
Feb 12 20:05:15 bigbox kernel: [ 1761.340197] drivers/hid/usbhid/hid-core.c: submitting out urb
Feb 12 20:05:15 bigbox kernel: [ 1761.340205] drivers/hid/hid-lg4ff.c: sysfs interface created
Feb 12 20:05:15 bigbox kernel: [ 1761.340207] logitech 0003:046D:C294.0019: Force feedback support for Logitech Gaming Wheels
--

Switch to DFP
--
root@bigbox:/sys/class/leds# cat /sys/bus/hid/devices/0003\:046D\:C294.0019/alternate_modes
native: G27 Racing Wheel
DF-EX: Driving Force / Formula EX *
DFP: Driving Force Pro
G25: G25 Racing Wheel
G27: G27 Racing Wheel
root@bigbox:/sys/class/leds# echo DFP > !$
echo DFP > /sys/bus/hid/devices/0003\:046D\:C294.0019/alternate_modes
--
Feb 12 20:06:11 bigbox kernel: [ 1816.752052] usb 8-2: USB disconnect, device number 23
Feb 12 20:06:11 bigbox kernel: [ 1816.752166] drivers/hid/hid-lg4ff.c: Device successfully unregistered
Feb 12 20:06:12 bigbox kernel: [ 1817.692021] usb 8-2: new full-speed USB device number 24 using uhci_hcd
Feb 12 20:06:12 bigbox kernel: [ 1818.068039] usb 8-2: New USB device found, idVendor=046d, idProduct=c298
Feb 12 20:06:12 bigbox kernel: [ 1818.068045] usb 8-2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
Feb 12 20:06:12 bigbox kernel: [ 1818.068048] usb 8-2: Product: G27 Racing Wheel
Feb 12 20:06:12 bigbox kernel: [ 1818.071087] drivers/hid/usbhid/hid-core.c: HID probe called for ifnum 0
Feb 12 20:06:12 bigbox kernel: [ 1818.078094] logitech 0003:046D:C298.001A: fixing up Logitech Driving Force Pro report descriptor
Feb 12 20:06:12 bigbox kernel: [ 1818.078550] input: G27 Racing Wheel as /devices/pci0000:00/0000:00:1d.3/usb8/8-2/8-2:1.0/0003:046D:C298.001A/input/input32
Feb 12 20:06:12 bigbox mtp-probe: checking bus 8, device 24: "/sys/devices/pci0000:00/0000:00:1d.3/usb8/8-2"
Feb 12 20:06:12 bigbox mtp-probe: bus: 8, device: 24 was not an MTP device
Feb 12 20:06:12 bigbox kernel: [ 1818.132187] logitech 0003:046D:C298.001A: input,hidraw2: USB HID v1.00 Joystick [G27 Racing Wheel] on usb-0000:00:1d.3-2/input0
Feb 12 20:06:12 bigbox kernel: [ 1818.132193] drivers/hid/hid-lg4ff.c: Found wheel with real PID C29B whose reported PID is C298
Feb 12 20:06:12 bigbox kernel: [ 1818.132195] drivers/hid/hid-lg4ff.c: Found compatible device, product ID C298
Feb 12 20:06:12 bigbox kernel: [ 1818.132205] drivers/hid/usbhid/hid-core.c: submitting out urb
Feb 12 20:06:12 bigbox kernel: [ 1818.132213] drivers/hid/hid-lg4ff.c: sysfs interface created
Feb 12 20:06:12 bigbox kernel: [ 1818.132215] drivers/hid/hid-lg4ff.c: Driving Force Pro: setting range to 900
Feb 12 20:06:12 bigbox kernel: [ 1818.132219] logitech 0003:046D:C298.001A: Force feedback support for Logitech Gaming Wheels
Feb 12 20:06:12 bigbox kernel: [ 1818.134029] drivers/hid/usbhid/hid-core.c: submitting out urb
Feb 12 20:06:12 bigbox kernel: [ 1818.142038] drivers/hid/usbhid/hid-core.c: submitting out urb
--

Now switch to G25 (without unplug)
--
root@bigbox:/sys/class/leds# cat /sys/bus/hid/devices/0003\:046D\:C298.001A/alternate_modes
native: G27 Racing Wheel
DF-EX: Driving Force / Formula EX
DFP: Driving Force Pro *
G25: G25 Racing Wheel
G27: G27 Racing Wheel
root@bigbox:/sys/class/leds# echo G25 > !$
echo G25 > /sys/bus/hid/devices/0003\:046D\:C298.001A/alternate_modes
--
Feb 12 20:07:31 bigbox kernel: [ 1897.352052] usb 8-2: USB disconnect, device number 24
Feb 12 20:07:31 bigbox kernel: [ 1897.352166] drivers/hid/hid-lg4ff.c: Device successfully unregistered
Feb 12 20:07:32 bigbox kernel: [ 1898.292021] usb 8-2: new full-speed USB device number 25 using uhci_hcd
Feb 12 20:07:33 bigbox kernel: [ 1899.075042] usb 8-2: New USB device found, idVendor=046d, idProduct=c299
Feb 12 20:07:33 bigbox kernel: [ 1899.075047] usb 8-2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
Feb 12 20:07:33 bigbox kernel: [ 1899.075050] usb 8-2: Product: G27 Racing Wheel
Feb 12 20:07:33 bigbox kernel: [ 1899.085070] drivers/hid/usbhid/hid-core.c: HID probe called for ifnum 0
Feb 12 20:07:33 bigbox kernel: [ 1899.091397] drivers/hid/usbhid/hid-core.c: submitting ctrl urb: Get_Report wValue=0x0100 wIndex=0x0000 wLength=11
Feb 12 20:07:33 bigbox kernel: [ 1899.093034] drivers/hid/usbhid/hid-core.c: submitting ctrl urb: Get_Report wValue=0x0300 wIndex=0x0000 wLength=144
Feb 12 20:07:33 bigbox kernel: [ 1899.101130] input: G27 Racing Wheel as /devices/pci0000:00/0000:00:1d.3/usb8/8-2/8-2:1.0/0003:046D:C299.001B/input/input33
Feb 12 20:07:33 bigbox mtp-probe: checking bus 8, device 25: "/sys/devices/pci0000:00/0000:00:1d.3/usb8/8-2"
Feb 12 20:07:33 bigbox mtp-probe: bus: 8, device: 25 was not an MTP device
Feb 12 20:07:33 bigbox kernel: [ 1899.156157] logitech 0003:046D:C299.001B: input,hidraw2: USB HID v1.11 Joystick [G27 Racing Wheel] on usb-0000:00:1d.3-2/input0
Feb 12 20:07:33 bigbox kernel: [ 1899.156162] drivers/hid/hid-lg4ff.c: Found wheel with real PID C29B whose reported PID is C299
Feb 12 20:07:33 bigbox kernel: [ 1899.156164] drivers/hid/hid-lg4ff.c: Found compatible device, product ID C299
Feb 12 20:07:33 bigbox kernel: [ 1899.156174] drivers/hid/usbhid/hid-core.c: submitting out urb
Feb 12 20:07:33 bigbox kernel: [ 1899.156182] drivers/hid/hid-lg4ff.c: sysfs interface created
Feb 12 20:07:33 bigbox kernel: [ 1899.156184] drivers/hid/hid-lg4ff.c: G25/G27/DFGT: setting range to 900
Feb 12 20:07:33 bigbox kernel: [ 1899.156187] logitech 0003:046D:C299.001B: Force feedback support for Logitech Gaming Wheels
Feb 12 20:07:33 bigbox kernel: [ 1899.159040] drivers/hid/usbhid/hid-core.c: submitting out urb
--

Hmmmm, why the earlier error?


History
--
581 ffcfstress -d /dev/input/event4
582 cd /sys/class/leds/
583 ls
584 cat /sys/bus/hid/devices/0003\:046D\:C294.0011/alternate_modes
585 echo DFP > /sys/bus/hid/devices/0003\:046D\:C294.0011/alternate_modes
586 ls
587 cat /sys/bus/hid/devices/0003\:046D\:C298.0012/alternate_modes
588 echo g25 > /sys/bus/hid/devices/0003\:046D\:C298.0012/alternate_modes
589 tail -f /var/log/syslog
590 ls
591 cat /sys/bus/hid/devices/0003\:046D\:C294.0013/alternate_modes
592 echo native > /sys/bus/hid/devices/0003\:046D\:C294.0013/alternate_modes
593 cat /sys/bus/hid/devices/0003\:046D\:C294.0015/alternate_modes
594 echo DFP > /sys/bus/hid/devices/0003\:046D\:C294.0015/alternate_modes
595 history
596 cat /sys/bus/hid/devices/0003\:046D\:C294.0017/alternate_modes
597 echo G25 > /sys/bus/hid/devices/0003\:046D\:C294.0017/alternate_modes
598 cat /sys/bus/hid/devices/0003\:046D\:C294.0019/alternate_modes
599 echo DFP > /sys/bus/hid/devices/0003\:046D\:C294.0019/alternate_modes
600 cat /sys/bus/hid/devices/0003\:046D\:C298.001A/alternate_modes
601 echo G25 > /sys/bus/hid/devices/0003\:046D\:C298.001A/alternate_modes
602 history
--

BUG!!!! I see you.... 'g25' rather than 'G25'
--
root@bigbox:/sys/class/leds# cat !$
cat /sys/bus/hid/devices/0003\:046D\:C298.001D/alternate_modes
native: G27 Racing Wheel
DF-EX: Driving Force / Formula EX
DFP: Driving Force Pro *
G25: G25 Racing Wheel
G27: G27 Racing Wheel
root@bigbox:/sys/class/leds# echo g25 > /sys/bus/hid/devices/0003\:046D\:C298.001D/alternate_modes
bash: echo: write error: Invalid argument
root@bigbox:/sys/class/leds# echo G25 > /sys/bus/hid/devices/0003\:046D\:C298.001D/alternate_modes
root@bigbox:/sys/class/leds#
--