Re: Saitek PS1000 gamepad - HID descriptor wonky
From: Andreas Hübner <hidden>
Date: 2011-12-11 21:48:33
Hi Simon! Let's continue the discussion on the list. I did made some progress that requires input from the HID maintainers.
You have to check the rsize, otherwise you might have problems writing outside the size of the original descriptor.
That's exactly what I've been doing, or did I miss something? In fact, I wanted to be absolutely sure and only mess with the descriptor when the sizes match. (*rsize == 137)
Note a D-Pad might be defined as 'Buttons', a 'D-Pad' or as a 'Hat'. You need to check out the values change in the HID stream.
It's defined as a 'Hat' with 8 different directions.
Send me a copy of the original descriptor and I'll have a look.
Should already be on the list. And I was able to identify the culprit so
no need to bother you.
The problem is the following code in hidinput_configure_usage
(drivers/hid/hid-input.c):
if (field->flags & HID_MAIN_ITEM_CONSTANT)
goto ignore;
The buttons and the hat are defined with the constant flag enabled.
Now I might be reading the spec wrong, but I'm not so sure that we can
simply skip constant values.
This is the description of the data/constant flag.
Indicates whether the item is data or a constant
value. Data indicates the item is defining report
fields that contain modifiable device data. Constant
indicates the item is a static read-only field in a
report and cannot be modified (written) by the
host.
Well, I need to patch the descriptor nevertheless because it defines a
non-existing sixth axis. Might as well remove the constant flag on the
buttons and hat. However, other devices might be affected as well, so
I'd like to get some input on how to deal with the situation.
Andreas