Re: HID Joysticks and Win98 by Karl
Karl
Tue Jan 11 12:20:39 CST 2005
Rob,
I tried various report descriptors, such as the one created by the hidgame
example, the example from HID Usage Table spec, etc. and combinations of
them. None of them seem to work in Windows 98.
However, the HID device does show in the htclient example, and Win98 keeps
sending me the IOCTL_HID_READ_REPORT. It's just not showing in the game
controllers app, nor is it available via the legacy jostick API.
I am currently working with the definition below. It defines a simple
2-axis, 2-buton joystick (I think...) and works with Me/2000/XP, but not
with Windows 98.
In his WDM book, Walter Oney made a cute remark: There's "opportunity for
learning" when porting a HID driver from XP to 98. As so many times, I
cannot disagree with him.
Karl
static const UCHAR DefaultReportDescriptor[] =
{
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x04, // USAGE (Joystick)
0xA1, 0x01, // COLLECTION (Application)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xFF, 0x03, // LOGICAL_MAXIMUM (1023)
0x35, 0x00, // PHYSICAL_MINIMUM (0)
0x46, 0xFF, 0x03, // PHYSICAL_MAXIMUM (1023)
0x75, 0x10, // REPORT_SIZE (16)
0x95, 0x01, // REPORT_COUNT (1)
0x09, 0x30, // USAGE (X)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x09, 0x31, // USAGE (Y)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x05, 0x09, // USAGE_PAGE (Buttons)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0x35, 0x00, // PHYSICAL_MINIMUM (0)
0x45, 0x01, // PHYSICAL_MAXIMUM (1)
0x75, 0x01, // REPORT_SIZE (1)
0x95, 0x01, // REPORT_COUNT (1)
0x09, 0x01, // USAGE (Button 1)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x09, 0x02, // USAGE (Button 2)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x95, 0x06, // REPORT_COUNT (6)
0x81, 0x01, // INPUT (Cnst,Ary,Abs)
0xC0 // END_COLLECTION
};
"Robert Marquardt" <robert_marquardt@gmx.de> wrote in message
news:uqo78o$9EHA.3596@TK2MSFTNGP12.phx.gbl...
> Karl Mattes wrote:
>
>> Since it works fine in Windows Me/2000/XP, I suspect that my HID report
>> descriptor cannot be parsed by Windows 98 (I noticed that the WinMe
>> implementation is somewhat picky in that regards, whereas 2000/XP takes
>> about anything), but I am not positive on that.
>
> What did you define in your descriptor?
> Windows for example does not accept gamepads without axes.