StreamDeckSharp icon indicating copy to clipboard operation
StreamDeckSharp copied to clipboard

device id

Open flat-eric147 opened this issue 2 years ago • 1 comments

Hi! First of all thanks for this library, I am a long time user and I love it !!! I have a question concerning the device id that is returned StreamDeck.EnumerateDevices method. The Device ID I get looks like

\?\hid#vid_0fd9&pid_006c#6&ec79805&1&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}

From what I understand there is a vendor id, a product id and at the end a guid. In the middle the "ec79805" seems like a device id? I wonder where I can find a unique ID for the device so that I can identify a device independently on which usb slot it is connected to. That would help me to "sort" the devices if there are multiple StramDecks connected. I can of course just use the DeviceName to sort, but I'd like to understand the encoding of the above string. Any insight would be appreciated, thanks!

flat-eric147 avatar May 09 '22 17:05 flat-eric147

Hi. Sorry for my late reply.

The reported "deviceId" depends on the implementation of the MacroBoardProvider (like StreamDeckSharp). This Id is just to identify the device (if the id matches - the device is the same) but it doesn't (in general) have any further meaning. In fact there might be other MacroBoardProviders in the future with ids that are totally different and may not even have a vendor or product id because they are not USB devices.

In case of StreamDeckSharp I use the device path of the USB device which looks something like the string you posted. Even though you can "see" that the device path is composed of a few different things like vendorId, productId, etc. you should treat it like an opaque string and not try to extract information out of that string.

Here is the Microsoft documentation also noting that the device identification should not be parsed: https://docs.microsoft.com/en-us/windows-hardware/drivers/install/device-identification-strings

If you want to "sort" the devices you should first try to define some rules about the order of the devices - there might be better options than parsing the device path.

wischi-chr avatar Jul 03 '22 22:07 wischi-chr

Thank you!

flat-eric147 avatar Sep 15 '22 10:09 flat-eric147