ZRtmWrJqXcjbqBLIMBYMCeUw / Logitech-G923-Linux-Kernel-Driver

This project is intended to add support for the Logitech G923 steering wheel to the Linux kernel.
GNU General Public License v3.0
32 stars 0 forks source link

FYI: Support for Thrustmaster wheels is driving to the kernel #3

Open 0x7CFE opened 3 years ago

0x7CFE commented 3 years ago

Just in case, https://www.phoronix.com/scan.php?page=news_item&px=Linux-5.13-Better-Thrustmaster

Looks like Thrustmaster HIDs suffer from similar initialization issues. Could this be of any use for Logitech ones?

ZRtmWrJqXcjbqBLIMBYMCeUw commented 3 years ago

Sorry for the late response. Having skimmed through this commit here: https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git/commit/?h=for-5.13/thrustmaster&id=c49c33637802a2c6957a78119eb8be3b055dd9e9, I would say Logitech initialization is not as bad. I saw a patch that was submitted to the input mailing list for the G923 here: https://patchwork.kernel.org/project/linux-input/patch/20210527134104.217865-2-rickytaylor26@gmail.com/ though it appears geared more towards the Xbox version but I will need to verify with mine, which is a PS4 version. What is interesting is, similar to the G920, a magic packet needs to be sent to the wheel to force it to reconnect as a proper HID++ device. I do recall reading about this in the patches for the G920 but never actually seeing it in code. Now that I think about it, it was probably in some xpad driver somewhere.

One interesting note in the above patch series is that USB initialization can be kick-started through USB-passthrough to a Windows VM, which I did not know about and have not tried yet.

Thank you for your help.

ZRtmWrJqXcjbqBLIMBYMCeUw commented 3 years ago

The product ID defined in the patch, 0xc26e (probably for the Xbox version, does not match the product ID for the PS4 version, 0xc267, which is what I have. After applying the patch, replacing the product ID with that for my device, and connecting/disconnecting the wheel from my Windows VM, I noticed the wheel was being recognized as a hid-generic Joystick device with product ID 0xc266, whereas the wheel connects initially as a logitech-hidpp Gamepad device with the original product ID 0x267 (with an error of "Device not connected"). The hid-generic "version"'s inputs is recognized properly by Linux. The dmesg output looks like this:

usb 1-14: new full-speed USB device number 6 using xhci_hcd
usb 1-14: New USB device found, idVendor=046d, idProduct=c267, bcdDevice=38.00
usb 1-14: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-14: Product: G923 Racing Wheel for PlayStation 4 and PC
usb 1-14: Manufacturer: Logitech
usb 1-14: SerialNumber: <serial-number>
logitech-hidpp-device 0003:046D:C267.0019: ignoring exceeding usage max
input: Logitech G923 Racing Wheel for PlayStation 4 and PC as /devices/pci0000:00/0000:00:01.3/0000:01:00.0/usb1/1-14/1-14:1.0/0003:046D:C267.0019/input/input30
logitech-hidpp-device 0003:046D:C267.0019: input,hiddev97,hidraw3: USB HID v1.10 Gamepad [Logitech G923 Racing Wheel for PlayStation 4 and PC] on usb-0000:01:00.0-14/input0
logitech-hidpp-device 0003:046D:C267.001A: Device not connected
logitech-hidpp-device 0003:046D:C267.001B: hiddev98,hidraw4: USB HID v1.11 Device [Logitech G923 Racing Wheel for PlayStation 4 and PC] on usb-0000:01:00.0-14/input2
usb 1-14: reset full-speed USB device number 6 using xhci_hcd
usb 1-14: reset full-speed USB device number 6 using xhci_hcd
usb 1-14: USB disconnect, device number 6
usb 1-14: new full-speed USB device number 7 using xhci_hcd
usb 1-14: New USB device found, idVendor=046d, idProduct=c266, bcdDevice=38.00
usb 1-14: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-14: Product: G923 Racing Wheel for PlayStation 4 and PC
usb 1-14: Manufacturer: Logitech
usb 1-14: SerialNumber: <serial-number>
input: Logitech G923 Racing Wheel for PlayStation 4 and PC as /devices/pci0000:00/0000:00:01.3/0000:01:00.0/usb1/1-14/1-14:1.0/0003:046D:C266.001C/input/input31
hid-generic 0003:046D:C266.001C: input,hidraw3: USB HID v1.11 Joystick [Logitech G923 Racing Wheel for PlayStation 4 and PC] on usb-0000:01:00.0-14/input0
hid-generic 0003:046D:C266.001D: hiddev97,hidraw4: USB HID v1.11 Device [Logitech G923 Racing Wheel for PlayStation 4 and PC] on usb-0000:01:00.0-14/input1
hid-generic 0003:046D:C266.001E: hiddev98,hidraw5: USB HID v1.11 Device [Logitech G923 Racing Wheel for PlayStation 4 and PC] on usb-0000:01:00.0-14/input2
usb 1-14: reset full-speed USB device number 7 using xhci_hcd
usb 1-14: reset full-speed USB device number 7 using xhci_hc

The wheel's auto-centering is very stiff and force feedback does not work but every button, axis, and the shifter all work without a problem.

My next questions are:

  1. How can we get the G923 PS4 version to reconnect as a hid-generic Joystick device?
  2. Is there a better driver that can handle the 0xc266 "version" of the device?

I will keep playing around with this since we finally have some progress.

John-Pi commented 3 years ago

Hi, Found this in drivers/hid/hid-logitech-hidpp.c :

/* reset all forces */
    ret = hidpp_send_fap_command_sync(hidpp, data->feature_index,
                      HIDPP_FF_RESET_ALL,
                      NULL, 0,
                      &response);
    if (ret)
        hid_warn(hidpp->hid_dev, "Failed to reset all forces!\n");

This reset is done is the parts for the G920 quirks parts when the driver get the wheel configuration before launching an autocenter sequence, maybe this can solve your autocentering stiffness, the wheel could be stiff because of the force feedback and not the autocentering. Thanks for your work :+1:

JacKeTUs commented 3 years ago

Hello! I have some information for you Logitech have description for Force Feedback protocol v1.6: https://opensource.logitech.com/wiki/force_feedback/Logitech_Force_Feedback_Protocol_V1.6.pdf There are some new features for G923 (HID_RPM LEDs protocol), and information about changing the mods of the wheel from XBOX mode to PC and from PS mode to PC.

ProductIds are: 0xC26D - "XBOX FFB mode" 0xC26E - "HID++ mode" 0xC267 - PS mode of the wheel. 0xC266 - "Classic" mode of the wheel. Additional information about different modes

In the documentation there is a page about commands for changing modes, but unfortunately i could not get it working with this command

Real command for change the mode from PS to PC that worked for me: 0x30, 0xf8, 0x09, 0x07, 0x01, 0x01, 0x00, 0x00, with endpoint 0x03

You could try this with usb_modeswitch like so: /usr/sbin/usb_modeswitch -v 046d -p c267 -M 30f8090701010000 -m 03 -r 03

And even create udev rule for it:

ATTR{idVendor}=="046d", ATTR{idProduct}=="c267", RUN+="/usr/sbin/usb_modeswitch -v 046d -p c267 -M 30f8090701010000 -m 03 -r 03"

After that wheel reconnects with new idProduct: c266. HID generic driver even sees all the axes: steering, pedals, H gear shifts, but unfortunately, hid_logitech_hidpp driver could not probe device after all of that.

I tried get the 8123 (FF) feature working with PID:c266 - without success... With 8127 no luck either.

Hope this information will be useful for you

berarma commented 3 years ago

So the G923 works basically the same as the G29/G920. The G923 Playstation model is equivalent to a G29 and the G923 XBox model is equivalent to the G920.

There's two models that have to work with different drivers that are already in the kernel. To add support for these wheels we need to add the PID to the hid-logitech (Playstation model) and hid-logitech-hidpp (XBox model) modules.

Anyone that owns the Playstation model can talk to me to try to add support to new-lg4ff.

0x7CFE commented 3 years ago

Anyone that owns the Playstation model can talk to me to try to add support to new-lg4ff.

I own the PS model.

ZRtmWrJqXcjbqBLIMBYMCeUw commented 3 years ago

Hope this information will be useful for you

It seems they updated their specs back in December (I previously had v1.5 of that same document). This should be the breakthrough we needed. Thank you very much for your help.

JacKeTUs commented 3 years ago

@ZRtmWrJqXcjbqBLIMBYMCeUw, added g923 to new-lg4ff, and wheel finally works. I created PR to driver: https://github.com/berarma/new-lg4ff/pull/50 Hope you will also test this!

ZRtmWrJqXcjbqBLIMBYMCeUw commented 3 years ago

Awesome, it works. In addition to all of the inputs working, the force feedback works as well. In my brief testing, I did not get the LED display to work but that may be because of the game I am using to test. I will take a better look tomorrow.

Thanks @JacKeTUs!

JacKeTUs commented 3 years ago

I did not get the LED display to work

LED is an indication of force feedback by default

I got LED working after setup in Oversteer. There are option about force feedback indication: choice between LED and overlay. If you enable LED and try to test FF (fftest for example, or some game with ff), you will see LED working :)

leillo1975 commented 3 years ago

Leds on Wine/Proton games don't work. You only could try it on native games like F1 2017 and DIRT 4, I think. At least on G29 wheels work. @berarma in Oversteer use it to monitorize FFB if you want. Is good to see that G923 works in Linux. We have another alternative to play our games

isopix commented 3 years ago

On 6/21/21, Bernat @.***> wrote:

So the G923 works basically the same as the G29/G920. The G923 Playstation model is equivalent to a G29 and the G923 XBox model is equivalent to the G920.

So there's two models that have to work with different drivers that are already in the kernel. To add support for these wheels we need to add the PID to the hid-logitech (Playstation model) and hid-logitech-hidpp (XBox model) modules.

Sound strange, because somebody in the past (probably even you, bernat, but not sure about that) stated that G29 and older(g27, g25, DFGT) uses older protocol and lacks some hardware effects(that needs to be software emulated), so lg4ff(and later new-lg4ff) forks were spun

And that you drivers doesn't support G920, because it's compatible with new hid++ protocol, so is 100% covered by in-kernel driver.

I guess that both new G923 in PC mode would just use new hid++ protocol, like G920, so both of them should be supported by in-kernel driver(not your new-lg4ff) fork.

It also seems strange that Logitech planning support for NEW consoles (without backward compatibility) would plan to use different protocols for XBOX and PS5, and not simply some additional mismash with security chips.

I know you know better than me, but I'm now confused by totally opposite info, than in the past.

cheers, Krzysztof Krakowiak

JacKeTUs commented 3 years ago

According to this patch we have more complicated structure for g923 wheel I could only confirm PS model productIds, but with XBOX model it seems that: 0xC26D - "XBOX FFB mode" 0xC26E - "HID++ mode" And sequence 0x0f, 0x00, 0x01, 0x01, 0x42 reconnects wheel from XBOX to HID++, and it works just fine with hidpp driver (w/o TrueForce)

But for PS wheel model we have different pids and different commands for switching modes: 0xC267 - seems to be "PS mode" 0xC266 - "Classic mode", probes and works successfully with new-lg4ff after switching

berarma commented 3 years ago

On 6/21/21, Bernat @.***> wrote:

So the G923 works basically the same as the G29/G920. The G923 Playstation model is equivalent to a G29 and the G923 XBox model is equivalent to the G920.

So there's two models that have to work with different drivers that are already in the kernel. To add support for these wheels we need to add the PID to the hid-logitech (Playstation model) and hid-logitech-hidpp (XBox model) modules.

Sound strange, because somebody in the past (probably even you, bernat, but not sure about that) stated that G29 and older(g27, g25, DFGT) uses older protocol and lacks some hardware effects(that needs to be software emulated), so lg4ff(and later new-lg4ff) forks were spun

And that you drivers doesn't support G920, because it's compatible with new hid++ protocol, so is 100% covered by in-kernel driver.

I guess that both new G923 in PC mode would just use new hid++ protocol, like G920, so both of them should be supported by in-kernel driver(not your new-lg4ff) fork.

It also seems strange that Logitech planning support for NEW consoles (without backward compatibility) would plan to use different protocols for XBOX and PS5, and not simply some additional mismash with security chips.

I know you know better than me, but I'm now confused by totally opposite info, than in the past.

cheers, Krzysztof Krakowiak

The G923 PS is a modified G29 and the G923 XBox is a modified G920.

The G920 has a HID++ mode that is used by hid-logitech-hidpp, same with G923 XBox.

The G29 has a Classic mode used by hid-logitech and my fork that uses HID reports with a custom protocol. Same with G923 PS.

Both wheels have their own XBox and PS modes that aren't compatible with PC as far as I know.

Where's the confussion?

isopix commented 3 years ago

Hi,

Thanks for reply. I was thinking you've made some mistake, but it seems that not.

Sounds strange that new G923 wheel (which has layout based on G29) don't have new common firmware G920-based for both variants(with few changes for artificial segmentation), but two different firmware lines sounds strange and not smart (especially with different PC interfaces[Why?]), it will be burden for them to release new drivers and firmware. Maybe it's for PS4 compatibility, but I can only guess.

Anyway it's not as spectacular as your suggestion of rumble motors in wheel rim. It's strange no one has ever tried to disassemble it and post on youtube ;-) On the other hand G923 and G29 electronic and connectors looks very similar. But I guess that for rumble motors they would need at least three new thicker cables going to wheel rim.

cheers, Krzysztof Krakowiak

On 6/22/21, Bernat @.***> wrote:

On 6/21/21, Bernat @.***> wrote:

So the G923 works basically the same as the G29/G920. The G923 Playstation model is equivalent to a G29 and the G923 XBox model is equivalent to the G920.

So there's two models that have to work with different drivers that are already in the kernel. To add support for these wheels we need to add the PID to the hid-logitech (Playstation model) and hid-logitech-hidpp (XBox model) modules.

Sound strange, because somebody in the past (probably even you, bernat, but not sure about that) stated that G29 and older(g27, g25, DFGT) uses older protocol and lacks some hardware effects(that needs to be software emulated), so lg4ff(and later new-lg4ff) forks were spun

And that you drivers doesn't support G920, because it's compatible with new hid++ protocol, so is 100% covered by in-kernel driver.

I guess that both new G923 in PC mode would just use new hid++ protocol, like G920, so both of them should be supported by in-kernel driver(not your new-lg4ff) fork.

It also seems strange that Logitech planning support for NEW consoles (without backward compatibility) would plan to use different protocols for XBOX and PS5, and not simply some additional mismash with security chips.

I know you know better than me, but I'm now confused by totally opposite info, than in the past.

cheers, Krzysztof Krakowiak

The G923 PS is a modified G29 and the G923 XBox is a modified G920.

The G920 has a HID++ mode that is used by hid-logitech-hidpp, same with G923 XBox.

The G29 has a Classic mode used by hid-logitech and my fork that uses HID reports with a custom protocol. Same with G923 PS.

Both wheels have their own XBox and PS modes that aren't compatible with PC as far as I know.

Where's the confussion?

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/ZRtmWrJqXcjbqBLIMBYMCeUw/Logitech-G923-Linux-Kernel-Driver/issues/3#issuecomment-866174319