We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2069

Summary: Device addition/removal queries all USB devices rather than only HID devices.
Product: SDL Reporter: Andreas Ertelt <bugzilla-sdl>
Component: joystickAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: trivial    
Priority: P2    
Version: HG 2.1   
Hardware: All   
OS: Windows (All)   

Description Andreas Ertelt 2013-08-28 13:38:50 UTC
SDL_dxjoystick.c is setting the classguid for device (dis)connect events to USB Devices in general:
    dbh.dbcc_classguid = GUID_DEVINTERFACE_USB_DEVICE;

Wouldn't it make more sense to have it just subscribe to Hid device events? This would mean less meaningless events reaching the application - my proposed change of the line above would look like this:
    HidD_GetHidGuid(&dbh.dbcc_classguid);

This worked fine for me in the past, but I only have a limited number of devices to test with - are there any joysticks that are connected through USB that are not classified as HID devices?

It should also be noted that despite its availability since Windows 2000, the function HidD_GetHidGuid() was only recently added to the MinGW-w64 header files.

Relevant references:
http://msdn.microsoft.com/en-us/library/windows/hardware/ff538924%28v=vs.85%29.aspx
Comment 1 Sam Lantinga 2013-10-18 06:40:49 UTC
Fixed, thanks!
http://hg.libsdl.org/SDL/rev/214cd9137ea9