Anyone muck around with their own USB HID and get the clutch to work?

GeekyDeaks

Staff
Premium
I have been making a poor man's Leo Bodnar adapter (just for giggles) to allow me to connect my G29 pedals directly to the PC.

I have been using the Simulation Controls Page (0x02) and whilst I can get the Accelerator (0xC4) and Brake (0xC5) to report correctly and be identified as a Brake and Accelerator, the Clutch (0xC6) is another matter. It's picked up correctly in Diview, but there is no value reported.

I have fallen back to using an arbitrary axis of a Generic Desktop device, but I think I'm just overlooking something in my HID definition and was wondering if anyone has already done this and could share some code?
 
This rather old and unsolved post looks like an awfully similar problem, but I'm noober than noob at this stuff so please forgive me if I'm utterly missing the point :D
Did you manage to dump the HID report descriptor for your real G29 to see how it differs?
 
That is exactly the same problem I am seeing @Neilski

I did dump the HID descriptor for the G29. It doesn't even use the Simulation Controls page, it just uses the Generic Desktop with 4 axis. X for the wheel (16bit), and Z, Rz and Y for the pedals (I didn't take a note of which order):

Usage Page (Generic Desktop) 05 01
Usage (X) 09 30
Logical Maximum (65535) 27 FF FF 00 00
Physical Maximum (65535) 47 FF FF 00 00
Report Size (16) 75 10
Report Count (1) 95 01
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
Usage (Z) 09 32
Usage (Rz) 09 35
Usage :thumbsup: 09 31
Logical Maximum (255) 26 FF 00
Physical Maximum (255) 46 FF 00
Report Size (8) 75 08
Report Count (3) 95 03

I suspect it's just one of those quirks of the way the standard has been used in the past
 
Last edited:
Yeah I tried it on my G27 last night and had a similar experience - a seemingly 10-bit X axis (steering maybe), plus a Y axis and maybe two vendor-defined axes (I couldn't be sure how many bits in each but some appeared to be 8). I had thought the steering was 16-bit but maybe one nibble is junk.
I guess the Logitech driver just makes sense of it all anyway.

Weird that the usage tables define so much, but yet it doesn't then just 'work'...

Btw, is there an easy way to get the report descriptor? I resorted to Wireshark again, but it was a bit painful :)
 
hey @Neilski - sorry, I completely missed your request about the descriptor dump.

I think I used https://www.usblyzer.com/ for the G29 dump, but it's a trial based version.

For my debugging of the Arduino I have actually been using Wireshark after you suggested it. I am using the filter of usbhid and then disconnect and reconnect the device to capture the descriptor. I actually prefer it as I can highlight sections and see what the flags are for a specific item, which were not clear in the HID documentation
 
Nice, ta! I did come across that product while endlessly googling, but didn't look further when I realised it was just a trial version. Maybe will have another peek.
The Wireshark output is certainly detailed but I found it was taking me ages to open all of the collapsed bits of the analysis (for some reason I didn't notice the "expand all" button for rather a long time! :redface:).

Since there are a bunch of free USB analysis/dump tools for Linux, I might even fire up a Linux VM and see if that makes it trivial to get nice output. (The USB device will probably look the same to the Linux client, I guess...)

Meanwhile, having seen my G27 dump, I went back to the PDF documentation and studied it to try and understand the bits that were't initially making sense. So far, I'm pretty convinced that your descriptor is perfect. I guess that would mean that Windows is broken... That would also explain why the Logitech products do their own thing. I wonder what the Bodnar box does?
 
If I had to guess, it would be that the first few wheel manufacturers used the same Usage Page as the joysticks on the market to allow them to be used with the current games with minimum fuss and maximum compatibility. It would go some way to explain why the mainstream kit of the G2x is still advertising that way, but the lack of data in DiView from just the clutch is still puzzling.

I didn't capture the USB HID reports when the clutch was advertised, so I might take a look if I get some free time, but for now I'm trying to get back up to speed with Fusion 360 and come up with something for the hall sensor
 
I haven't tried DiView but yeah, Windows' built-in "Game controller" setup widget behaves as if there are only two axes when [there are three and] one of them's a clutch.

I tried it with the clutch and also 0xBB "Throttle" which more or less just worked. Surreal...
I'm attaching the text dump of the capture for the clutch version. The Throttle version has no important differences other than in the obvious single line - here's the diff:
Code:
@@ -107,7 +107,7 @@
                     .... ..01 = bSize: 1 byte (1)
                     .... 10.. = bType: Local (2)
                     0000 .... = bTag: Usage (0x0)
-                Usage: Clutch (0x200c6)
+                Usage: Throttle (0x200bb)
             Main item (Input)
                 Header
                     .... ..01 = bSize: 1 byte (1)
Edited: added words in italics above, for clarity
 

Attachments

  • arduino_g29sketch_with_clutch.txt
    5.4 KB · Views: 169
Last edited:
I did a quick test and the clutch values are reported correctly. I made it so it replicated the brake and I can clearly see the two values are duplicated in the wireshark trace. The odd thing is that whilst DiView correctly picks it up as a clutch, it doesn't assign it an Axis like it does for the Accelerator and Brake.

I also tried exposing it as the Throttle and like your tests, I also found it's correctly picked up and given an Axis identifier as [Slider] by DiView.

Unfortunately, I'm still coding by coincidence with all this as I found that removing the Usage(joystick) stops DiView picking up the device and I cannot quite work out why this would happen from the USB spec.

Think I'm going to give up gracefully for now :D
 
ok, I played a little more and there is something very odd going on. When viewed in DiView, I see an Axis mapped e.g. X,Y,Z,Rx etc... Not all Usage() types show an axis and when one is not shown, no values show up. Now, the really weird thing is that if I try and expose a generic joystick axis of the same type that is mapped to the simulation controls, it shows up with the axis, but no values are reported.

For example, the Accelerator is mapped to axis [Y], so if I change the axis as follows:

0x09, 0x31, // USAGE( Y ) - clutch

Then values are no longer reported. It's like it gets masked by the earlier Y axis. It is almost like there is some internal mapping of the simulation controls to joystick axis and not all of the controls are mapped.

Anyway, really moving on now! :D
 
LOL! I'm beyond confused about how the (very many) layers interact here. It's ugly to see that it doesn't all just automagically work.
I have a cheapo knock-off XBox controller with (I think) 6 axes. When I get around to it I'll see what the HID report descriptor looks like for that...
Meanwhile - yes, I think you are doing the right thing by moving on! :laugh:
 

Latest News

Are you buying car setups?

  • Yes

  • No


Results are only viewable after voting.
Back
Top