Author Message

<  Everything Coding  ~  Add support for Logitech G920 Racing Wheel

PostPosted: Mon Apr 04, 2016 10:42 pm Reply with quote
Posts: 4 Joined: Sun Apr 03, 2016 9:19 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:
# 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:
# 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:
# 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:
# 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.


Offline
PostPosted: Tue Apr 05, 2016 8:46 am Reply with quote
Site Admin Posts: 6420 Joined: Sat Nov 03, 2007 12:30 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 ...


Offline
PostPosted: Tue Apr 05, 2016 7:23 pm Reply with quote
Posts: 4 Joined: Sun Apr 03, 2016 9:19 pm
Thanks for including this!


Offline
PostPosted: Sun Jul 24, 2016 10:23 pm Reply with quote
Posts: 4 Joined: Sun Apr 03, 2016 9:19 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:
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?


Offline
PostPosted: Mon Jul 25, 2016 5:18 am Reply with quote
Posts: 1166 Joined: Wed Jul 11, 2012 3:14 pm Location: Koh Samui, TH
Eliasvan wrote:
According to the ChangeLog of usb-modeswitch-data package version 20160612, I see:
Code:
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.


Offline
PostPosted: Mon Jul 25, 2016 9:01 am Reply with quote
Site Admin Posts: 6420 Joined: Sat Nov 03, 2007 12:30 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.


Offline
PostPosted: Wed Aug 03, 2016 12:11 am Reply with quote
Posts: 4 Joined: Sun Apr 03, 2016 9:19 pm
LOM wrote:
Eliasvan wrote:
According to the ChangeLog of usb-modeswitch-data package version 20160612, I see:
Code:
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/amd64/usb-modeswitch-data/20160612-1

For Fedora, the rules file was fixed manually, so is now correct as well: https://www.rpmfind.net/linux/RPM/fedora/updates/testing/24/x86_64/u/usb_modeswitch-data-20160612-3.fc24.noarch.html
(thanks to @lkundrak)

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


Offline
PostPosted: Wed Aug 03, 2016 6:29 pm Reply with quote
Site Admin Posts: 6420 Joined: Sat Nov 03, 2007 12:30 am
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.


Offline

Display posts from previous:  Sort by:

All times are UTC+02:00
Page 1 of 1
8 posts
Users browsing this forum: No registered users and 1 guest
Search for:
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
cron