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 5125

Summary: Add ability to get the device path of a joystick
Product: SDL Reporter: Sjoerd Simons <sjoerd.simons>
Component: joystickAssignee: Sam Lantinga <slouken>
Status: ASSIGNED --- QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: dimitriy.ryazantcev
Version: HG 2.1   
Hardware: x86_64   
OS: Linux   
Attachments: Proposed patch

Description Sjoerd Simons 2020-05-06 08:52:26 UTC
Created attachment 4333 [details]
Proposed patch

Sometimes it can be useful to understand which device a Joystick actually refers to; E.g. to get information for it that SDL doesn't support (which usb port is it connected to, what's the bt mac as exposed of usb) or functionality not supported by SDL (firmware updates, LED controls etc). 

The attached patch adds the ability on linux to get the underlying device path, which can then futher be used with other APIs  with the device (e.g. libudev, fwupd etc).

The patch adds a Linux specific function; Unsure if that's OK for SDL or whether it should be done in a more cross-platform name (Though i have no idea what a good system device indentifier would be on other systems).
Comment 1 Dimitriy Ryazantcev 2021-01-25 11:54:58 UTC
I proposing to extend this approach with ability to return device interface path on Windows too. 
I talking about string like `\\?\HID#VID_203A&PID_FFFC&MI_01#7&2de99099&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}` that could be used for example to acquire audio interface on that PS4/5 controller via CM_* or SetupDi* API.