The C Source, Patches and (shudder!) Bugs
Post Reply
Eliasvan
Posts: 4
Joined: Sun Apr 03, 2016 9:19 pm

Add support for Logitech G920 Racing Wheel

Post by Eliasvan » Mon Apr 04, 2016 10:42 pm

Although it might seem unusual to add support for a device that is not a modem,
there is technically no reason why it should not be supported by usb_modeswitch:
Logitech G920 Racing Wheel

Upon plug-in, the device has product-id 0xc261 and is in XBox mode (vendor specific USB interface class: 0xff).
After sending the magical byte-sequence, the device obtains product-id 0xc262 and enters HID mode (USB interface class: 0x03).
See below for lsusb output.

A bit of history:
Initially, the decision was to do the switch-over by the xpad kernel driver.
This initial approach was criticized by the linux-input kernel maintainer, and a new approach was born: usb_skelswitch: a tiny kernel-space driver capable of sending magical byte-sequences associated with VID/PID pairs - a very simple version of the user-space usb_modeswitch.
Finally, usb_modeswitch was mentioned as a better solution (less code in kernel), and this brings us to this post.

New usb_modeswitch config-file "046d:c261":

Code: Select all

# Logitech G920 Racing Wheel
DefaultVendor=046d
DefaultProduct=c261
MessageEndpoint=01
ResponseEndpoint=01
TargetClass=0x03
MessageContent="0f00010142"
And the corresponding lines in "40-usb_modeswitch.rules":

Code: Select all

# Logitech G920 Racing Wheel
ATTR{idVendor}=="046d", ATTR{idProduct}=="c261", RUN+="usb_modeswitch '%b/%k'"
Credit goes to Michal Malý (not me): https://lkml.org/lkml/2016/1/26/763

Here's the lsusb log before switch-over:

Code: Select all

# lsusb -v -d 046d:c261

Bus 003 Device 012: ID 046d:c261 Logitech, Inc.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          255 Vendor Specific Class
  bDeviceSubClass       255 Vendor Specific Subclass
  bDeviceProtocol       255 Vendor Specific Protocol
  bMaxPacketSize0        64
  idVendor           0x046d Logitech, Inc.
  idProduct          0xc261
  bcdDevice           96.02
  iManufacturer           1 Logitech
  iProduct                2 G920 Driving Force Racing Wheel for Xbox One
  iSerial                 3 000072fb6b3b9f58
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass     71
      bInterfaceProtocol    208
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               4
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               4
Device Status:     0x0002
  (Bus Powered)
  Remote Wakeup Enabled
Here's the lsusb log after switch-over:

Code: Select all

# lsusb -v -d 046d:c262

Bus 003 Device 013: ID 046d:c262 Logitech, Inc.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x046d Logitech, Inc.
  idProduct          0xc262
  bcdDevice           96.02
  iManufacturer           1 Logitech
  iProduct                2 G920 Driving Force Racing Wheel for Xbox One
  iSerial                 3 000072fb6b3b9f58
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           41
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          4 U96.02_B0048
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength     168
         Report Descriptors:
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
Device Status:     0x0000
  (Bus Powered)
As a possibly unrelated side-note:
Previously I was using usb_modeswitch 2.2.1 (on Fedora 22) where it did not work when using cascaded USB hubs: USB path "3-1.4".
Now I'm using usb_modeswitch 2.3.0 where it does work just fine.

Josh
Site Admin
Posts: 6534
Joined: Sat Nov 03, 2007 12:30 am

Re: Add support for Logitech G920 Racing Wheel

Post by Josh » Tue Apr 05, 2016 8:46 am

There are already a number of non-modem devices in the 'data base' of usb_modeswitch, so it's not at all unusual.

I also think it's better to leave the whole mode-switching business out of the kernel.

Thanks for the data and for the testing, the device will be added to the next data package release. Meanwhile, I assume you'll spread the word about the new configuration, so people can add it to their setups themselves.
You can link to this thread of course; in time, the robots of Bing and Google find and devour it as well ...

Eliasvan
Posts: 4
Joined: Sun Apr 03, 2016 9:19 pm

Re: Add support for Logitech G920 Racing Wheel

Post by Eliasvan » Tue Apr 05, 2016 7:23 pm

Thanks for including this!

Eliasvan
Posts: 4
Joined: Sun Apr 03, 2016 9:19 pm

Re: Add support for Logitech G920 Racing Wheel

Post by Eliasvan » Sun Jul 24, 2016 10:23 pm

Josh wrote: Thanks for the data and for the testing, the device will be added to the next data package release.
According to the ChangeLog of usb-modeswitch-data package version 20160612, I see:

Code: Select all

Added devices: [046d:c261] Logitech G920 Racing Wheel, ...
But when I look in the "40-usb_modeswitch.rules" file or in the "usb_modeswitch.d/" directory, I can't see any mention of "046d:c261" :(

Am I seeing ghosts, or was this device really left out (unintentionally)?
How can we fix this as soon as possible?

LOM
Posts: 1286
Joined: Wed Jul 11, 2012 3:14 pm
Location: Koh Samui, TH

Re: Add support for Logitech G920 Racing Wheel

Post by LOM » Mon Jul 25, 2016 5:18 am

Eliasvan wrote: According to the ChangeLog of usb-modeswitch-data package version 20160612, I see:

Code: Select all

Added devices: [046d:c261] Logitech G920 Racing Wheel, ...
But when I look in the "40-usb_modeswitch.rules" file or in the "usb_modeswitch.d/" directory, I can't see any mention of "046d:c261" :(
The config file is present in the usb_modeswitch.d directory but was forgotten to be included in the udev rule file so you'll have to create that entry yourself for now.
Sorry about that, it will be corrected in the next data package release.

Josh
Site Admin
Posts: 6534
Joined: Sat Nov 03, 2007 12:30 am

Re: Add support for Logitech G920 Racing Wheel

Post by Josh » Mon Jul 25, 2016 9:01 am

Indeed. Sorry, I don't know how that happened since I create the rules file automatically from the config files with a script ...

I'll release a bugfix follow-up, no problem.

Eliasvan
Posts: 4
Joined: Sun Apr 03, 2016 9:19 pm

Re: Add support for Logitech G920 Racing Wheel

Post by Eliasvan » Wed Aug 03, 2016 12:11 am

LOM wrote:
Eliasvan wrote: According to the ChangeLog of usb-modeswitch-data package version 20160612, I see:

Code: Select all

Added devices: [046d:c261] Logitech G920 Racing Wheel, ...
But when I look in the "40-usb_modeswitch.rules" file or in the "usb_modeswitch.d/" directory, I can't see any mention of "046d:c261" :(
The config file is present in the usb_modeswitch.d directory but was forgotten to be included in the udev rule file so you'll have to create that entry yourself for now.
Sorry about that, it will be corrected in the next data package release.
Josh wrote:Indeed. Sorry, I don't know how that happened since I create the rules file automatically from the config files with a script ...

I'll release a bugfix follow-up, no problem.
It turns out that after having run "make clean" and "make" for the data package, the rules file becomes correct, containing the G920 entry.
This approach was used in the latest ubuntu package: https://launchpad.net/ubuntu/yakkety/am ... 20160612-1

For Fedora, the rules file was fixed manually, so is now correct as well: https://www.rpmfind.net/linux/RPM/fedor ... oarch.html
(thanks to @lkundrak)

So at least these two distributions should have the G920 working out of the box. :D

Josh
Site Admin
Posts: 6534
Joined: Sat Nov 03, 2007 12:30 am

Re: Add support for Logitech G920 Racing Wheel

Post by Josh » Wed Aug 03, 2016 6:29 pm

There is a script in the source package which will re-generate the rules file from the config files that are present in the "usb_modeswitch.d" subfolder.
It was the pre-generated rules file included with the last data package that was incomplete.

JeyP4
Posts: 1
Joined: Sat Dec 08, 2018 4:50 pm

Re: Add support for Logitech G920 Racing Wheel

Post by JeyP4 » Sat Dec 08, 2018 4:56 pm

Hi Thanks for drivers
My Logitech G920 is now connected with ubuntu 16.04
But I am facing 2 problems:

1. Every time I replug usb, I have to run the following command
'sudo usb_modeswitch -c /etc/usb_modeswitch.d/046d:c261'

2. As soon as I run above command. Self-centering properties of wheel gets disabled automatically.
I require force-feedback feature also.

Could you help in solving these problems.
Thank you
Last edited by JeyP4 on Fri Apr 12, 2019 1:59 pm, edited 1 time in total.

LOM
Posts: 1286
Joined: Wed Jul 11, 2012 3:14 pm
Location: Koh Samui, TH

Re: Add support for Logitech G920 Racing Wheel

Post by LOM » Mon Dec 10, 2018 4:39 pm

JeyP4 wrote:Hi Thanks for drivers
My Logitech G920 is now connected with ubuntu 16.04
But I am facing 2 problems:

1. Every time I replus usb, I have to run the following command
'sudo usb_modeswitch -c /etc/usb_modeswitch.d/046d:c261'

2. As soon as I run above command. Self-centering properties of wheel gets disabled automatically.
I require force-feedback feature also.

Could you help in solving these problems.
Thank you
Ubuntu is always way behind in updating usb_modeswitch in their distro and that is the reason for your first problem.

usb_modeswitch is not the driver for your wheel, it is only a tool to switch the mode of the device into a working mode.
The wheel driver is part of the linux kernel and you'll need to be at kernel 4.6 or later in order to have force-feedback working.

You can fix both of these problems simply by updating Ubuntu. 16.04 is old.

Bonnette
Posts: 1
Joined: Sat Oct 19, 2019 9:21 am

Re: Add support for Logitech G920 Racing Wheel

Post by Bonnette » Sat Oct 19, 2019 9:37 am

Eliasvan wrote: It turns out that after having run "make clean" and "make" for the data package, the rules file becomes correct, containing the G920 entry.
This approach was used in the latest ubuntu package: https://launchpad.net/ubuntu/usb-modeswitch-data/2012-1/reviewed-write my paper in 2 hours

For Fedora, the rules file was fixed manually, so is now correct as well: https://www.rpmfind.net/linux/RPM/fedor ... oarch.html
(thanks to @lkundrak)

So at least these two distributions should have the G920 working out of the box. :D
Hi there,

Could you please resend the updated page for Fedora (the mentioned reference is not working)? I'm trying to make some progress, recently got a G29.

Best,
Randy

Josh
Site Admin
Posts: 6534
Joined: Sat Nov 03, 2007 12:30 am

Re: Add support for Logitech G920 Racing Wheel

Post by Josh » Sun Nov 10, 2019 12:29 pm

There are many sources. You should be able to use any newer release.

https://fr2.rpmfind.net/linux/rpm2html/ ... witch-data

tocnaza
Posts: 1
Joined: Tue Nov 19, 2019 8:31 pm

Re: Add support for Logitech G920 Racing Wheel

Post by tocnaza » Tue Nov 19, 2019 8:33 pm

Thanks for the sources, Josh.

Post Reply