Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to distinguish between USB/BT for same device #711

Open
MarkaRagnos0815 opened this issue Nov 28, 2024 · 3 comments
Open

How to distinguish between USB/BT for same device #711

MarkaRagnos0815 opened this issue Nov 28, 2024 · 3 comments
Labels
question Information is requested

Comments

@MarkaRagnos0815
Copy link

I test a bit using PS4 Controller via USB and BT (Windows).
I am able to connect via USB and BT at the same time.

the hid_device_info gives to different paths, except for the serial_number and interface_number i get teh same values.
For blutooth the serial number is empty. (I guess serial number is the same)

Is there any way to check if these two devices are the same?

@mcuee mcuee added the question Information is requested label Dec 1, 2024
@JoergAtGithub
Copy link
Contributor

On Windows you can use the the

/** @brief Get the container ID for a HID device.
Since version 0.12.0, @ref HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0)
This function returns the `DEVPKEY_Device_ContainerId` property of
the given device. This can be used to correlate different
interfaces/ports on the same hardware device.
@ingroup API
@param dev A device handle returned from hid_open().
@param container_id The device's container ID on return.
@returns
This function returns 0 on success and -1 on error.
*/
int HID_API_EXPORT_CALL hid_winapi_get_container_id(hid_device *dev, GUID *container_id);

@MarkaRagnos0815
Copy link
Author

Thanks for sharing. Found a different solution by reading the Mac address from USB. Bt seems to have a serial number. the usb Mac address is the same as USB serial number. So I am able to find same device via vendor, product and serial number

@Youw
Copy link
Member

Youw commented Dec 3, 2024

What about hid_bus_type ? Should give you USB or BT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Information is requested
Projects
None yet
Development

No branches or pull requests

4 participants