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 4730

Summary: [PATCH] hidapi: Zero out new hid_device_info structs
Product: SDL Reporter: Andrew Eikum <aeikum>
Component: joystickAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: sezeroz
Version: HG 2.0   
Hardware: x86_64   
OS: Linux   
Attachments: [PATCH] hidapi: Zero out new hid_device_info structs
[PATCH] hidapi: Zero out new hid_device_info structs on mac, too

Description Andrew Eikum 2019-07-23 19:43:43 UTC
Created attachment 3892 [details]
[PATCH] hidapi: Zero out new hid_device_info structs

In particular this fixes a garbage usage_page value from the hidraw hidapi-backend being used, which meant the hidapi joystick-backend wouldn't match drivers for a device.
Comment 1 Andrew Eikum 2019-07-23 19:46:28 UTC
Created attachment 3893 [details]
[PATCH] hidapi: Zero out new hid_device_info structs on mac, too

It occurred to me to check the other backends, too. This patch applies it to the macOS backend, although they already set usage_page, so perhaps it fixes nothing. The libusb and Windows backends already use calloc.
Comment 2 Ozkan Sezer 2019-07-24 07:55:26 UTC
Applied these two patches as obvious.
https://hg.libsdl.org/SDL/rev/bc90ce38f1e2