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 - Add ability to get the device path of a joystick
Summary: Add ability to get the device path of a joystick
Status: ASSIGNED
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: HG 2.1
Hardware: x86_64 Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-06 08:52 UTC by Sjoerd Simons
Modified: 2021-01-26 04:30 UTC (History)
1 user (show)

See Also:


Attachments
Proposed patch (4.79 KB, patch)
2020-05-06 08:52 UTC, Sjoerd Simons
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.