berarma / new-lg4ff

Experimental Logitech force feedback module for Linux
GNU General Public License v2.0
298 stars 18 forks source link

Support for G923 (PS4/PC version only) #50

Closed JacKeTUs closed 1 year ago

JacKeTUs commented 3 years ago

Added support for Logitech G923 Racing Wheel for Playstation 4 and PC (0x046d:0xc267, 0x046d:0xc266)

What works:

  1. Force Feedback (setting range (40-900), spring feedbacks, etc..)
  2. Steering
  3. H gear shifting
  4. Pedals
  5. FF autocentering
  6. LEDs (similar to G29)
  7. All buttons on the wheel
  8. Configuration with Oversteer with patch (dirty build with added support for g923)

What not works (or not fully tested):

  1. Switching between wheel modes in driver (G29/G923)
  2. Not all games support g923 out of the box. In DIRT 4/Rally, for example, you need to add your wheel model to ./share/inputdevices.json relative to game folder
  3. TrueForce. In FF v1.6 specifications there are no word about it, no examples etc. Idk if it is just a fancy word for FF, or really a software feature that needed to be implemented in driver as well.

To switch from PS to PC mode you will need tool usb_modeswitch and udev rule:

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

To reload udev rules: udevadm control --reload-rules After connecting, wheel will reconnect with 0x046d:0xc266, and will be probed by new-lg4ff. UPD (2021-11-18): Now switching from PS mode to Classic implemented in driver, so no more need to manually call usb_modeswitch or create udev rules.

Similar to G29, wheel only could work with 1st interface. Attempts to initialize all interfaces all ends up in kernel panics.

In PR: Added copies of lines with G29, because they are similar wheels. Added command for switch to the G923 mode if anyone in the future will try to implement switching modes.

Should close #44

berarma commented 3 years ago

Great! I'll merge it as soon as possible after testing.

I guess mode switching should work very similar to a G29. Could you test it?

Some games don't even recognize the G29. That's what the compatilibity modes are good for.

AFAIK, TruForce consists of two rumble motors in the wheel rim. It might be treated like another effect type, (maybe FORCE_TYPE 0x0f?) with two possible arguments: strong force and weak force.

isopix commented 3 years ago

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

AFAIK, TruForce consists of two rumble motors in the wheel rim. It might be treated like another effect type, (maybe FORCE_TYPE 0x0f?) with two possible arguments: strong force and weak force. Could you give links to some source of this information? Logitech explained in the past that this new rumble effects, related to engine revving(game sends engine soundwave to logitech drivers) are possible to new electronics and 1000Hz.

I've tried now to google about your news, and cannot find anything about additional rumble motors in wheel rim. Maybe you've disassembled wheel yourself, (or knows someone that did that) and can confirm it's the case?

berarma commented 3 years ago

@jacketus Have you tried without the usb_modeswitch?

According to the document it should be required on the G29 too, but it works without it. I've tried doing the mode switch on my G29 and the wheel is unusable after that.

berarma commented 3 years ago

On 6/22/21, Bernat @.***> wrote: AFAIK, TruForce consists of two rumble motors in the wheel rim. It might be treated like another effect type, (maybe FORCE_TYPE 0x0f?) with two possible arguments: strong force and weak force. Could you give links to some source of this information? Logitech explained in the past that this new rumble effects, related to engine revving(game sends engine soundwave to logitech drivers) are possible to new electronics and 1000Hz. I've tried now to google about your news, and cannot find anything about additional rumble motors in wheel rim. Maybe you've disassembled wheel yourself, (or knows someone that did that) and can confirm it's the case?

My sources are the reviewers' descriptions. I haven't found anyone who's disassembled the rim but almost everyone describes it in the same way, a rumbling under their palms. I could be wrong though. Maybe it's just a gimmick using the main motors. I don't really know.

JacKeTUs commented 3 years ago

@JacKeTUs Have you tried without the usb_modeswitch?

According to the document it should be required on the G29 too, but it works without it. I've tried doing the mode switch on my G29 and the wheel is unusable after that.

Hello! Without usb_modeswitch wheel probes, but steering and most of the buttons does not work.

I guess mode switching should work very similar to a G29. Could you test it?

I tried to send various switch commands, but wheel doesn't reconnect with target PIDs. May be I just don't understand how compatibility modes supposed to work. In Oversteer compatibility modes are grayed out. In usb fs file "alternate_mode" does not exists.

AFAIK, TruForce consists of two rumble motors in the wheel rim. It might be treated like another effect type, (maybe FORCE_TYPE 0x0f?) with two possible arguments: strong force and weak force.

Tried 0x0f, wheel does not respond. According to the docs FORCE_TYPE 0x0a, 'square wave', or 'vibration' exists. Tried that, but I also got no reaction. Reviewers says that "trueforce connects to the audio engine" and "trueforce vibration sounds like sounds from the game". May be wheel got another interface like sound card and 'hums' their input? Sounds funny, but who knows. I will try to sniff usb with windows games with trueforce enabled later.

berarma commented 3 years ago

I guess mode switching should work very similar to a G29. Could you test it?

I tried to send various switch commands, but wheel doesn't reconnect with target PIDs. May be I just don't understand how compatibility modes supposed to work. In Oversteer compatibility modes are grayed out. In usb fs file "available_modes" does not exists.

The file is "alternate_modes". I've added some comments to your changes, I think there's an error and some omissions. Please, try those changes, it might work.

AFAIK, TruForce consists of two rumble motors in the wheel rim. It might be treated like another effect type, (maybe FORCE_TYPE 0x0f?) with two possible arguments: strong force and weak force.

Tried 0x0f, wheel does not respond. According to the docs FORCE_TYPE 0x0a, 'square wave', or 'vibration' exists. Tried that, but I also got no reaction. Reviewers says that "trueforce connects to the audio engine" and "trueforce vibration sounds like sounds from the game". May be wheel got another interface like sound card and 'hums' their input? Sounds funny, but who knows. I will try to sniff usb with windows games with trueforce enabled later.

I've found some more information. No, it doesn't use any additional motors. It seems to be just another effect on top of the normal ones. They've just used a different controller and circuitry so that the rumbling is modulated by the electronics. Still I don't think your wheel has an audio processor implemented inside, that will be done in software.

Links:

The square wave type should have worked. How are you sending the commands? Personally, I don't find that feature interesting, we could just ignore it, but in case you'd like to try to include it we can keep trying.

JacKeTUs commented 3 years ago

Hello!

bcdDevice does not change between PC and PS modes... It stays 0x3800. Wheel disconnects and reconnects after switching commands, but appears again as the 'PC' PID - 0xc266. After changes file alternate_modes appears with modes from the driver, as it should be.

TrueForce settings from G Hub (Windows machine) does not send any commands to the wheel, so we need to sniff USB traffic with a real game... May be driver/GHub connects to the games that supports TF, and sends some additional commands related to what it sees from the game?

berarma commented 3 years ago

Hello!

bcdDevice does not change between PC and PS modes... It stays 0x3800. Wheel disconnects and reconnects after switching commands, but appears again as the 'PC' PID - 0xc266. After changes file alternate_modes apperas with modes from the driver, as it should be.

It's the change between compatible mode and native mode that needs to be observed. The wheel starts in compatibility mode as a DFGT and the driver changes it to native mode on initialization. All this happens after the usb_modeswitch command. So you need the bcdDevice value after the modeswitch but before the module loads, and also the value after the module loads.

Have you tested the compatibility modes?

TrueForce settings from G Hub (Windows machine) does not send any commands to the wheel, so we need to sniff USB traffic with a real game... May be driver/GHub connects to the games that supports TF, and sends some additional commands related to what it sees from the game?

I have no idea, but the games that support it might be using it through the Logitech SDK. The G Hub settings will be stored in the driver since that's where almost everything happens. The driver won't send commands to the wheel until the game sends TruForce data.

JacKeTUs commented 3 years ago

It looks like starting and initializing sequence for the g923 is different from g29.

G29 connects with DFGT productID first. Driver probes it, sees that and checks bcdDevice mask (appendix a.2 in Logitech docs). After that driver sends "switch to g29 mode" command, and wheel reconnects with real g29 productID, and finally probes with driver.

G923 connects with 0xc267 productID, not DFGT's, and "switching to native mode" command is different. bcdDevice stays the same (0x3800) before modeswitch, after modeswitch and before and after module (new-lg4ff) loads. After modeswitch it reconnects to 0xc266. bcdDevice is the same.

Have you tested the compatibility modes?

About compatibility modes: in "Classic" mode after sending any command with any other mode (g29, g25 etc) wheel reconnects with the same productID as it was before (0xc266), and nothing changed. May be compatibility commands are not the same with g923...

I will try to implement different initializing sequence, like with DFGT -> Native, but "PSFFB -> Classic". Then usb_modeswitch will become obsolete.

berarma commented 2 years ago

Any news on this?

berarma commented 2 years ago

@JacKeTUs, @ZRtmWrJqXcjbqBLIMBYMCeUw, can someone help with this?

I think we would need to do something similar to what it's done here: https://patchwork.kernel.org/project/linux-input/patch/20210527134104.217865-3-rickytaylor26@gmail.com/

JacKeTUs commented 2 years ago

Hello! Sorry for the long delay, it was a hard time in my life.

I implemented switch from G923 PS to Classic mode. Now usb_modeswitch and udev rules does not needed. G923 PS probes with c267 PID, driver goes to hid-lg4ff.c:2195, sends command 30f8090701010000 (where first byte is report ID), and then wheel resets and probes again with c266 PID and works as usual.

Sadly, it did not help with other compatibility modes (G29, G27/G25, etc). May be G923 is not a multimode wheel and can not change modes at all?

ZRtmWrJqXcjbqBLIMBYMCeUw commented 2 years ago

@berarma This patch here: https://patchwork.kernel.org/project/linux-input/patch/1447345535-2912-2-git-send-email-simon@mungewell.org/ discusses adding HID-mode switching for the G920, where the final conclusion is that it will not be added to the kernel. This may or may not be a problem, since the method used for the G920 and the G923 (PS4 version) are very different, but I thought I would bring it up anyway. Note that the method mentioned is identical to that implemented in the patch you linked.

I will try testing the latest code later to make sure it works as expected, though I have no doubt it will. Thanks @JacKeTUs!

berarma commented 2 years ago

@JacKeTUs, don't worry, life's always first, this could wait. Thanks for your work!

@ZRtmWrJqXcjbqBLIMBYMCeUw, it would be nice having someone else test it before merging since I can't test it myself. I've looked at that thread and the reasons to reject the G920 patch don't apply here at all. The issue isn't in the method itself but in the way it was implemented. Thanks for linking the thread though, it's interesting info.

0x7CFE commented 2 years ago

it would be nice having someone else test it before merging since I can't test it myself

@JacKeTUs, I have G923 PS version and would like to help you guys with testing. However, I've never built these drivers before, so would appreciate any instructions on how to do so.

JacKeTUs commented 2 years ago

However, I've never built these drivers before, so would appreciate any instructions on how to do so.

Hello! Thanks for your help! You need to follow these instructions: https://github.com/JacKeTUs/new-lg4ff#manual-method

  1. Clone my repo with branch g923: git clone https://github.com/JacKeTUs/new-lg4ff --branch g923
  2. cd to directory with repo, then type make. You may be need to install linux-headers-$(uname -r) and build-essential
  3. After building you need to insert module. There is some catch: it depends from ff-memless, so you need to modprobe it first: sudo modprobe ff-memless After that type sudo insmod hid-logitech-new.ko

In the end you could plug wheel to PC and see if it works :) You could use lsusb and dmesg to see if the wheel reconnects correctly.

Also you could check out https://github.com/berarma/oversteer project, it supports G923 since couple weeks ago.

For tests in games you could use ETS2 (native) as it support g923 out of the box (with disabled Steam Input), or something like Assetto Corsa (remapping needed), or Assetto Corsa Competizione (supports g923 out of the box with disabled Steam Input)

0x7CFE commented 2 years ago

So yeah, I've built and inserted the module.

When I plugged the USB in, the wheel jerked ~45° to the right from neutral position, LEDs blinked and turned off, and then it froze for like a minute. After that it started the wheel calibration thing.

During the froze period lsusb was hanging dead. Afterward it quickly showed the listing.

Bus 003 Device 042: ID 046d:c266 Logitech, Inc. G923 Racing Wheel for PlayStation 4 and PC
[570316.675658] hid-generic 0003:0424:274C.0012: hiddev0,hidraw0: USB HID v1.10 Device [Microchip Tech Hub Controller] on usb-0000:00:14.0-4.3.5/input0
[570327.574120] usb 3-4.3.4: reset high-speed USB device number 36 using xhci_hcd
[574159.050988] usb 3-7: new full-speed USB device number 38 using xhci_hcd
[574159.200112] usb 3-7: New USB device found, idVendor=046d, idProduct=c267, bcdDevice=38.00
[574159.200120] usb 3-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[574159.200125] usb 3-7: Product: G923 Racing Wheel for PlayStation 4 and PC
[574159.200128] usb 3-7: Manufacturer: Logitech
[574159.200131] usb 3-7: SerialNumber: CIDUHAKICYRANOZOHUFOZIVALY
[574159.202556] logitech 0003:046D:C267.0013: ignoring exceeding usage max
[574159.203033] input: Logitech G923 Racing Wheel for PlayStation 4 and PC as /devices/pci0000:00/0000:00:14.0/usb3/3-7/3-7:1.0/0003:046D:C267.0013/input/input48
[574159.203377] logitech 0003:046D:C267.0013: input,hiddev1,hidraw1: USB HID v1.10 Gamepad [Logitech G923 Racing Wheel for PlayStation 4 and PC] on usb-0000:00:14.0-7/input0
[574189.935705] usbhid 3-7:1.2: can't add hid device: -110
[574189.935746] usbhid: probe of 3-7:1.2 failed with error -110
[574189.935972] usb 3-7: USB disconnect, device number 38
[574190.255672] usb 3-7: new full-speed USB device number 39 using xhci_hcd
[574190.405145] usb 3-7: New USB device found, idVendor=046d, idProduct=c266, bcdDevice=38.00
[574190.405154] usb 3-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[574190.405158] usb 3-7: Product: G923 Racing Wheel for PlayStation 4 and PC
[574190.405162] usb 3-7: Manufacturer: Logitech
[574190.405165] usb 3-7: SerialNumber: CIDUHAKICYRANOZOHUFOZIVALY
[574190.407296] input: Logitech G923 Racing Wheel for PlayStation 4 and PC as /devices/pci0000:00/0000:00:14.0/usb3/3-7/3-7:1.0/0003:046D:C266.0015/input/input49
[574190.407520] logitech 0003:046D:C266.0015: input,hidraw1: USB HID v1.11 Joystick [Logitech G923 Racing Wheel for PlayStation 4 and PC] on usb-0000:00:14.0-7/input0
[574190.407700] logitech 0003:046D:C266.0015: Force feedback support for Logitech Gaming Wheels (0.3.1)
[574190.407703] logitech 0003:046D:C266.0015: Hires timer: period = 2 ms
[574610.467028] usb 3-7: USB disconnect, device number 39
[574633.040527] usb 3-7: new full-speed USB device number 40 using xhci_hcd
[574633.189590] usb 3-7: New USB device found, idVendor=046d, idProduct=c267, bcdDevice=38.00
[574633.189599] usb 3-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[574633.189603] usb 3-7: Product: G923 Racing Wheel for PlayStation 4 and PC
[574633.189606] usb 3-7: Manufacturer: Logitech
[574633.189609] usb 3-7: SerialNumber: CIDUHAKICYRANOZOHUFOZIVALY
[574633.191882] logitech 0003:046D:C267.0018: ignoring exceeding usage max
[574633.192391] input: Logitech G923 Racing Wheel for PlayStation 4 and PC as /devices/pci0000:00/0000:00:14.0/usb3/3-7/3-7:1.0/0003:046D:C267.0018/input/input50
[574633.192785] logitech 0003:046D:C267.0018: input,hiddev1,hidraw1: USB HID v1.10 Gamepad [Logitech G923 Racing Wheel for PlayStation 4 and PC] on usb-0000:00:14.0-7/input0
[574668.921298] usbhid 3-7:1.2: can't add hid device: -110
[574668.921333] usbhid: probe of 3-7:1.2 failed with error -110
[574668.921510] usb 3-7: USB disconnect, device number 40
[574674.833381] usb 3-7: new full-speed USB device number 41 using xhci_hcd
[574674.982577] usb 3-7: New USB device found, idVendor=046d, idProduct=c267, bcdDevice=38.00
[574674.982586] usb 3-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[574674.982590] usb 3-7: Product: G923 Racing Wheel for PlayStation 4 and PC
[574674.982593] usb 3-7: Manufacturer: Logitech
[574674.982596] usb 3-7: SerialNumber: CIDUHAKICYRANOZOHUFOZIVALY
[574674.984972] logitech 0003:046D:C267.001A: ignoring exceeding usage max
[574674.985506] input: Logitech G923 Racing Wheel for PlayStation 4 and PC as /devices/pci0000:00/0000:00:14.0/usb3/3-7/3-7:1.0/0003:046D:C267.001A/input/input51
[574674.985756] logitech 0003:046D:C267.001A: input,hiddev1,hidraw1: USB HID v1.10 Gamepad [Logitech G923 Racing Wheel for PlayStation 4 and PC] on usb-0000:00:14.0-7/input0
[574705.786040] usbhid 3-7:1.2: can't add hid device: -110
[574705.786070] usbhid: probe of 3-7:1.2 failed with error -110
[574705.786241] usb 3-7: USB disconnect, device number 41
[574706.114013] usb 3-7: new full-speed USB device number 42 using xhci_hcd
[574706.267407] usb 3-7: New USB device found, idVendor=046d, idProduct=c266, bcdDevice=38.00
[574706.267418] usb 3-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[574706.267422] usb 3-7: Product: G923 Racing Wheel for PlayStation 4 and PC
[574706.267425] usb 3-7: Manufacturer: Logitech
[574706.267428] usb 3-7: SerialNumber: CIDUHAKICYRANOZOHUFOZIVALY
[574706.269579] input: Logitech G923 Racing Wheel for PlayStation 4 and PC as /devices/pci0000:00/0000:00:14.0/usb3/3-7/3-7:1.0/0003:046D:C266.001C/input/input52
[574706.269783] logitech 0003:046D:C266.001C: input,hidraw1: USB HID v1.11 Joystick [Logitech G923 Racing Wheel for PlayStation 4 and PC] on usb-0000:00:14.0-7/input0
[574706.269983] logitech 0003:046D:C266.001C: Force feedback support for Logitech Gaming Wheels (0.3.1)
[574706.269992] logitech 0003:046D:C266.001C: Hires timer: period = 2 ms
0x7CFE commented 2 years ago

Aside of that all buttons, levers, pedals and controls are now detected by the system :tada: (KDE's Input Devices widget in settings). Wheel axis is also detected correctly. Haven't tried in game yet.

berarma commented 2 years ago

So yeah, I've built and inserted the module.

When I plugged the USB in, the wheel jerked ~45° to the right from neutral position, LEDs blinked and turned off, and then it froze for like a minute. After that it started the wheel calibration thing.

During the froze period lsusb was hanging dead. Afterward it quickly showed the listing.

One minute is a bit long but it might be normal for the switching to PC mode process.

What froze? Only the lsusb command, the desktop, the whole computer?

JacKeTUs commented 2 years ago

@berarma i think other modes (G29,G25, etc) needs to be removed from G923, what do you think? None of the compatibility rules applicable to wheel (bcdDevice is the same), and no reaction to switch commands whatsoever :(

berarma commented 2 years ago

@berarma i think other modes (G29,G25, etc) needs to be removed from G923, what do you think? None of the compatibility rules applicable to wheel (bcdDevice is the same), and no reaction to switch commands whatsoever :(

The Logitech document doesn't mention the G923 regarding compatibility modes but it could have been left outdated. The G920 doesn't have compatibility modes, maybe they've definitely removed them in the firmware. I think it's safe to assume they're gone and remove it.

ydallilar commented 2 years ago

I tried couple of things: 1) Boot with wheel plugged in 2) Plug in the wheel after boot 3) Unplugged and plugged back in after 1).

With 1, the wheel starts initializing immediately. With 2 and 3, the wheel does a small motion. Stops for a minute or so. Then, starts to initialize. lsusb also hangs during this period as claimed.

I was using an udev rule before this to switch modes before this:

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

This worked without any delays. Also, no delay with 1). So, I don't understand.

On the functionality, it seems to be working fine so far. Well, same as before.

Let me know if you need any logs.

JacKeTUs commented 2 years ago

Let me know if you need any logs.

Hello, @ydallilar! Thanks for testing! @ydallilar, @0x7CFE, unfortunately, i can not reproduce this bug. My wheel reconnects instantly after probing with driver. My kernel: Linux oleg-pc 5.10.0-9-amd64 #1 SMP Debian 5.10.70-1 (2021-09-30) x86_64 GNU/Linux My HW: i7-7700k+z270

Now i changed logging level for switching PS mode command. Could you, please, checkout new version and repeat tests with profile=1: sudo insmod hid-logitech-new.ko profile=1 And then send kernel logs (/var/log/kern.log)?

By logs from @0x7CFE i see huge delay before USB disconnecting. May be usbhid locks device?... Here is my logs:

[  +0,000660] input: Logitech G923 Racing Wheel for PlayStation 4 and PC as /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.1/1-3.1:1.0/0003:046D:C267.007E/input/input106
[  +0,000959] logitech 0003:046D:C267.007E: input,hiddev1,hidraw2: USB HID v1.10 Gamepad [Logitech G923 Racing Wheel for PlayStation 4 and PC] on usb-0000:00:14.0-3.1/input0
// At this moment we sending command for switch
[  +0,000023] logitech 0003:046D:C267.007E: send_cmd: 30 F8 09 07 01 01 00 00
[  +0,013301] usbhid 1-3.1:1.1: can't add hid device: -32
[  +0,000027] usbhid: probe of 1-3.1:1.1 failed with error -32
[  +0,032961] usbhid 1-3.1:1.2: can't add hid device: -32
[  +0,000033] usbhid: probe of 1-3.1:1.2 failed with error -32
// At this moment wheel disconnects
[  +0,122069] usb 1-3.1: USB disconnect, device number 62
[  +0,293240] usb 1-3.1: new full-speed USB device number 63 using xhci_hcd
[  +0,102943] usb 1-3.1: New USB device found, idVendor=046d, idProduct=c266, bcdDevice=38.00
[  +0,000011] usb 1-3.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  +0,000006] usb 1-3.1: Product: G923 Racing Wheel for PlayStation 4 and PC
[  +0,000004] usb 1-3.1: Manufacturer: Logitech
[  +0,000004] usb 1-3.1: SerialNumber: YFAJACOFISYJYDEFAJASOFUHI
// Wheel reconnects with new PID
[  +0,014540] input: Logitech G923 Racing Wheel for PlayStation 4 and PC as /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.1/1-3.1:1.0/0003:046D:C266.007F/input/input107
[  +0,000733] logitech 0003:046D:C266.007F: input,hidraw2: USB HID v1.11 Joystick [Logitech G923 Racing Wheel for PlayStation 4 and PC] on usb-0000:00:14.0-3.1/input0
ydallilar commented 2 years ago

Maybe I got something after playing around. If the module is not loaded (or I rmmod hid_logitech_new) when I plug the wheel, it works fine. But, if the module is already loaded when I plug the wheel, usbhid keeps hanging before disconnect.

This is what I got when the wheel triggers the module.

ov 18 21:28:36 amd-arch kernel: usb 1-3: new full-speed USB device number 10 using xhci_hcd
Nov 18 21:28:36 amd-arch kernel: usb 1-3: New USB device found, idVendor=046d, idProduct=c267, bcdDevice=38.00
Nov 18 21:28:36 amd-arch kernel: usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Nov 18 21:28:36 amd-arch kernel: usb 1-3: Product: G923 Racing Wheel for PlayStation 4 and PC
Nov 18 21:28:36 amd-arch kernel: usb 1-3: Manufacturer: Logitech
Nov 18 21:28:36 amd-arch kernel: usb 1-3: SerialNumber: EQOHELAXEZEFOWUZELEQUPAPE
Nov 18 21:28:36 amd-arch kernel: hid-generic 0003:046D:C267.0014: ignoring exceeding usage max
Nov 18 21:28:36 amd-arch kernel: input: Logitech G923 Racing Wheel for PlayStation 4 and PC as /devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb1/1-3/1-3:1.0/0003:046D:C267.0014/input/input40
Nov 18 21:28:36 amd-arch kernel: hid-generic 0003:046D:C267.0014: input,hiddev97,hidraw3: USB HID v1.10 Gamepad [Logitech G923 Racing Wheel for PlayStation 4 and PC] on usb-0000:02:00.0-3/input0
Nov 18 21:28:36 amd-arch kernel: hid-generic 0003:046D:C267.0015: hiddev98,hidraw4: USB HID v1.11 Device [Logitech G923 Racing Wheel for PlayStation 4 and PC] on usb-0000:02:00.0-3/input1
Nov 18 21:28:36 amd-arch kernel: hid-generic 0003:046D:C267.0016: hiddev99,hidraw5: USB HID v1.11 Device [Logitech G923 Racing Wheel for PlayStation 4 and PC] on usb-0000:02:00.0-3/input2
Nov 18 21:28:36 amd-arch kernel: logitech 0003:046D:C267.0014: ignoring exceeding usage max
Nov 18 21:28:36 amd-arch kernel: input: Logitech G923 Racing Wheel for PlayStation 4 and PC as /devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb1/1-3/1-3:1.0/0003:046D:C267.0014/input/input42
Nov 18 21:28:36 amd-arch kernel: logitech 0003:046D:C267.0014: input,hiddev97,hidraw3: USB HID v1.10 Gamepad [Logitech G923 Racing Wheel for PlayStation 4 and PC] on usb-0000:02:00.0-3/input0
Nov 18 21:28:36 amd-arch kernel: logitech 0003:046D:C267.0014: send_cmd: 30 F8 09 07 01 01 00 00
Nov 18 21:28:36 amd-arch kernel: usb 1-3: USB disconnect, device number 10
Nov 18 21:28:37 amd-arch kernel: usb 1-3: new full-speed USB device number 11 using xhci_hcd
Nov 18 21:28:37 amd-arch kernel: usb 1-3: New USB device found, idVendor=046d, idProduct=c266, bcdDevice=38.00
Nov 18 21:28:37 amd-arch kernel: usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Nov 18 21:28:37 amd-arch kernel: usb 1-3: Product: G923 Racing Wheel for PlayStation 4 and PC
Nov 18 21:28:37 amd-arch kernel: usb 1-3: Manufacturer: Logitech
Nov 18 21:28:37 amd-arch kernel: usb 1-3: SerialNumber: EQOHELAXEZEFOWUZELEQUPAPE
Nov 18 21:28:37 amd-arch kernel: input: Logitech G923 Racing Wheel for PlayStation 4 and PC as /devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb1/1-3/1-3:1.0/0003:046D:C266.0017/input/input43
Nov 18 21:28:37 amd-arch kernel: logitech 0003:046D:C266.0017: input,hidraw3: USB HID v1.11 Joystick [Logitech G923 Racing Wheel for PlayStation 4 and PC] on usb-0000:02:00.0-3/input0
Nov 18 21:28:37 amd-arch kernel: logitech 0003:046D:C266.0017: Force feedback support for Logitech Gaming Wheels (0.3.1)
Nov 18 21:28:37 amd-arch kernel: logitech 0003:046D:C266.0017: Hires timer: period = 2 ms

When the module is already loaded.

Nov 18 21:32:21 amd-arch kernel: usb 1-3: new full-speed USB device number 13 using xhci_hcd
Nov 18 21:32:21 amd-arch kernel: usb 1-3: New USB device found, idVendor=046d, idProduct=c267, bcdDevice=38.00
Nov 18 21:32:21 amd-arch kernel: usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Nov 18 21:32:21 amd-arch kernel: usb 1-3: Product: G923 Racing Wheel for PlayStation 4 and PC
Nov 18 21:32:21 amd-arch kernel: usb 1-3: Manufacturer: Logitech
Nov 18 21:32:21 amd-arch kernel: usb 1-3: SerialNumber: EQOHELAXEZEFOWUZELEQUPAPE
Nov 18 21:32:21 amd-arch kernel: logitech 0003:046D:C267.001B: ignoring exceeding usage max
Nov 18 21:32:21 amd-arch kernel: input: Logitech G923 Racing Wheel for PlayStation 4 and PC as /devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb1/1-3/1-3:1.0/0003:046D:C267.001B/input/input45
Nov 18 21:32:21 amd-arch kernel: logitech 0003:046D:C267.001B: input,hiddev97,hidraw3: USB HID v1.10 Gamepad [Logitech G923 Racing Wheel for PlayStation 4 and PC] on usb-0000:02:00.0-3/input0
Nov 18 21:32:21 amd-arch kernel: logitech 0003:046D:C267.001B: send_cmd: 30 F8 09 07 01 01 00 00
Nov 18 21:32:57 amd-arch kernel: usbhid 1-3:1.1: can't add hid device: -110
Nov 18 21:32:57 amd-arch kernel: usbhid: probe of 1-3:1.1 failed with error -110
Nov 18 21:33:33 amd-arch kernel: usbhid 1-3:1.2: can't add hid device: -110
Nov 18 21:33:33 amd-arch kernel: usbhid: probe of 1-3:1.2 failed with error -110
Nov 18 21:33:33 amd-arch kernel: usb 1-3: USB disconnect, device number 13
Nov 18 21:33:33 amd-arch kernel: usb 1-3: new full-speed USB device number 14 using xhci_hcd
Nov 18 21:33:34 amd-arch kernel: usb 1-3: New USB device found, idVendor=046d, idProduct=c266, bcdDevice=38.00
Nov 18 21:33:34 amd-arch kernel: usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Nov 18 21:33:34 amd-arch kernel: usb 1-3: Product: G923 Racing Wheel for PlayStation 4 and PC
Nov 18 21:33:34 amd-arch kernel: usb 1-3: Manufacturer: Logitech
Nov 18 21:33:34 amd-arch kernel: usb 1-3: SerialNumber: EQOHELAXEZEFOWUZELEQUPAPE
Nov 18 21:33:34 amd-arch kernel: input: Logitech G923 Racing Wheel for PlayStation 4 and PC as /devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb1/1-3/1-3:1.0/0003:046D:C266.001C/input/input46
Nov 18 21:33:34 amd-arch kernel: logitech 0003:046D:C266.001C: input,hidraw3: USB HID v1.11 Joystick [Logitech G923 Racing Wheel for PlayStation 4 and PC] on usb-0000:02:00.0-3/input0
Nov 18 21:33:34 amd-arch kernel: logitech 0003:046D:C266.001C: Force feedback support for Logitech Gaming Wheels (0.3.1)
Nov 18 21:33:34 amd-arch kernel: logitech 0003:046D:C266.001C: Hires timer: period = 2 ms
ydallilar commented 2 years ago

Just to be crazy, I tried other USB3 ports back on my mobo. No issues.

Reverted to your old patch + udev. The same port still works ok though.

I overheard USB issues with Ryzen mobos at some point. Maybe related.

berarma commented 2 years ago

Those usbhid messages look like another module is trying to access the device and failing. This doesn't happen with the G29. I could take a look and see why this can happen although my knowledge about USB/HID is pretty limited.

Which kernel versions are you both using?

In case we can't find the cause for the delay I would merge and fix later if needed.

JacKeTUs commented 2 years ago

I have an idea how to do this somehow user-friendly

I can restore "no_autoswitch" for PS mode -> Classic. My initial thought was: "driver can't work with PS mode, unlike with DFGT mode, and we need to switch to Classic no matter what". But now we meet a problems with faulty(?) USB or USB hubs/mobo, or HID driver binding to other two interfaces which we ignoring. If users will experience that problem they could change lg4ff_no_autoswitch option and stay with udev rules.

JacKeTUs commented 2 years ago

From faeb74f if user inserts module with no_autoswitch turned on, it will prompt him and return from probing function with an -EINVAL. User should use udev rules or usb_modeswitch to switch modes manually.

If user have no issues with delays prior wheel disconnection, no_autoswitch could stay default (off).

I have not experienced any delays, so i could not reproduce that bug :(

ydallilar commented 2 years ago

Arch linux / linux-zen 5.15.2.

@JacKeTUs I would be happier if you leave a workaround as suggested for the moment.

Do you guys know what -110 error code stands for in usbhid?

berarma commented 2 years ago

Ok, after researching a bit I think I have a deeper understanding. It turns out that the G29 uses the same command for switching from PS4 mode to Classic/PC mode and it works. PS3 mode seems to be the same as DFEX compatibility mode and it's already handled by the driver. This means we can share the mode switching code and I can help test it.

I can switch from PS4 to classic mode without delays and without usbhid errors. I think it's because the G29 is in the HID quirks list that informs the HID driver that the device has its own driver.

It's in this file: https://github.com/torvalds/linux/blob/fe91c4725aeed35023ba4f7a1e1adfebb6878c23/drivers/hid/hid-quirks.c#L461

I think adding the G923 to the quirks list would take away the error messages and probably the wait because without it both drivers might be trying to use the device at the same time. But we would need to change the hid-core module too and it's not in new-lg4ff currently.

There's two ways to deal with this. I add hid-core to new-lg4ff or instead we work together to push these changes to upstream so the default module recognizes the G923 and does the mode switching from PS4 to classic mode in both the G923 and G29.

berarma commented 2 years ago

I've found an easier solution.

Write a file /etc/modprobe.d/g923.conf with contents:

usbhid quirks=0x046d:0xc267:0x0800

Reboot after creating the file.

This instructs the usbhid module to ignore the G923 device so it doesn't interfere with new-lg4ff.

Can someone test it?

ydallilar commented 2 years ago

Didnt work for me. I dont see any difference.

berarma commented 2 years ago

Didnt work for me. I dont see any difference.

There's two device ids involved, so it should be:

usbhid quirks=0x046d:0xc267:0x0800,0x046d:0xc266:0x0800

I can't try it but I hope someone can make it work. At least it should remove the usbhid errors in the dmesg output.

ydallilar commented 2 years ago

I will try again.

But, to understand it better, what does 0x0800 stand for as a quirk? It is not listed here:

https://github.com/torvalds/linux/blob/5f53fa508db098c9d372423a6dac31c8a5679cdf/include/linux/hid.h#L340

berarma commented 2 years ago

I will try again.

But, to understand it better, what does 0x0800 stand for as a quirk? It is not listed here:

https://github.com/torvalds/linux/blob/5f53fa508db098c9d372423a6dac31c8a5679cdf/include/linux/hid.h#L340

Yes, sorry, I got it wrong. I took the value from somewhere I don't remember.

Please, use this line instead:

usbhid quirks=0x046d:0xc267:0x0004,0x046d:0xc266:0x0004

This one should be correctly enabling HID_QUIRK_IGNORE.

Thanks @ydallilar.

ydallilar commented 2 years ago

HID_QUIRK_IGNORE=0x4!

In this case, it only gets this far.

Nov 25 21:19:44 amd-arch kernel: usb 1-3: new full-speed USB device number 4 using xhci_hcd
Nov 25 21:19:45 amd-arch kernel: usb 1-3: New USB device found, idVendor=046d, idProduct=c267, bcdDevice=38.00
Nov 25 21:19:45 amd-arch kernel: usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Nov 25 21:19:45 amd-arch kernel: usb 1-3: Product: G923 Racing Wheel for PlayStation 4 and PC
Nov 25 21:19:45 amd-arch kernel: usb 1-3: Manufacturer: Logitech
Nov 25 21:19:45 amd-arch kernel: usb 1-3: SerialNumber: EQOHELAXEZEFOWUZELEQUPAPE
ZRtmWrJqXcjbqBLIMBYMCeUw commented 2 years ago

I tried having the following line: options usbhid quirks=0x046d:0xc267:0x4 in a newly created /etc/modprobe.d/g923.conf file and after rebooting the wheel connects fine without the ugly 1 minute or so delay. Edit: removed the wrong udev rule... stuck at the same spot as @ydallilar now, sorry about that. I did want to add I am also using a Ryzen chip, just like @ydallilar, so this may be the issue considering @JacKeTUs is unable to reproduce this (assuming they do not also have a Ryzen chip). Hopefully that helps!

berarma commented 2 years ago

HID_QUIRK_IGNORE=0x4!

In this case, it only gets this far.

Nov 25 21:19:44 amd-arch kernel: usb 1-3: new full-speed USB device number 4 using xhci_hcd
Nov 25 21:19:45 amd-arch kernel: usb 1-3: New USB device found, idVendor=046d, idProduct=c267, bcdDevice=38.00
Nov 25 21:19:45 amd-arch kernel: usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Nov 25 21:19:45 amd-arch kernel: usb 1-3: Product: G923 Racing Wheel for PlayStation 4 and PC
Nov 25 21:19:45 amd-arch kernel: usb 1-3: Manufacturer: Logitech
Nov 25 21:19:45 amd-arch kernel: usb 1-3: SerialNumber: EQOHELAXEZEFOWUZELEQUPAPE

Oops, I might be need to sleep more. I've edited my last comment to fix the mistake.

Maybe I'm wrong but it's supposed to be in the quirks list like all other Logitech wheels.

JacKeTUs commented 2 years ago

@berarma, big thanks for possible solution! But isn't it supposed to be HID_QUIRK_HAVE_SPECIAL_DRIVER instead of ignorance? https://elixir.bootlin.com/linux/latest/source/drivers/hid/hid-quirks.c#L212 So like.. modprobe option will be like usbhid quirks=0x046d:0xc267:0x80000? I can't test this rn, but i will update comment after tests :)

berarma commented 2 years ago

@berarma, big thanks for possible solution! But isn't it supposed to be HID_QUIRK_HAVE_SPECIAL_DRIVER instead of ignorance? https://elixir.bootlin.com/linux/latest/source/drivers/hid/hid-quirks.c#L212 So like.. modprobe option will be like usbhid quirks=0x046d:0xc267:0x80000? I can't test this rn, but i will update comment after tests :)

Ah, yes, it looks like it is. Don't forget to set it for both device modes.

Thanks for fixing my mistakes.

JacKeTUs commented 2 years ago

@ZRtmWrJqXcjbqBLIMBYMCeUw, @ydallilar, @0x7CFE

Please, try the following and test for delays after mode-switching.

Write a file /etc/modprobe.d/g923.conf with contents:

# G923 support (added HID_QUIRK_HAVE_SPECIAL_DRIVER)
options usbhid quirks="0x046D:0xC267:0x080000,0x046D:0xC266:0x080000"

After that you will need to update initramfs for your distro. For Debian-based it is update-initramfs -u, for RedHat-based it is dracut -f. After that you can reboot your system and check if quirks were added to the kernel: cat /sys/module/usbhid/parameters/quirks

Now wheel will stop probing without a driver (new-lg4ff in our case) and will not probe by hid-generic.

ydallilar commented 2 years ago

Logs are same with no quirk.

cat /sys/module/usbhid/parameters/quirks
0x046D:0xC267:0x080000,0x046D:0xC266:0x080000,(null),(null)
berarma commented 2 years ago

Logs are same with no quirk.

cat /sys/module/usbhid/parameters/quirks
0x046D:0xC267:0x080000,0x046D:0xC266:0x080000,(null),(null)

Did you rebuild the initramfs?

ydallilar commented 2 years ago

Yes, I did.

berarma commented 2 years ago

What should we do now? Do I merge it even if it isn't completely fine for everyone or wait until a solution is found?

ydallilar commented 2 years ago

I will be off the grid for a while.

If you merge we may be able to get more feedback on the issue. faeb74fecb0e8ce631758ac1df3f9a341a4d5eed + udev rule work great for me to recover old functionality. No errors whatsoever. One can put this to FAQ as a workaround for the time being.

alemunter commented 2 years ago

Hey guys! I have no force feedback on ETS2(Proton version) or Dirt Rally 2.0. In Assetto Corsa works perfect. Any ideas?

writequit commented 2 years ago

I use a G29 but for both those games I had to use (last number is steam ID for the game):

protontricks -c "wine reg add 'HKLM\System\CurrentControlSet\Services\winebus' /v DisableHidraw /t REG_DWORD /d 0x1" 227300

To undo that:

protontricks -c "wine reg add 'HKLM\System\CurrentControlSet\Services\winebus' /v DisableHidraw /f" 227300

Chr1s70ph commented 2 years ago

Is it still planned to merge this? My G923 is recognized by lsusb but thats about it. Not even showing up in /proc/bus/input/devices. Also its not recognized as an input. Don't quite know how to deal with this.

berarma commented 2 years ago

Is it still planned to merge this? My G923 is recognized by lsusb but thats about it. Not even showing up in /proc/bus/input/devices. Also its not recognized as an input. Don't quite know how to deal with this.

Absolutely, but I don't have the wheel and I need someone to test the changes. Could you try this branch and report your results?