MBS libUSB get InterfaceNumber

Good afternoon (o;

As I decided to go for libUSB with MBS I made it so far to recognize the USB devices I want to use based on VID/PID/Name:

Bildschirmfoto 2022-04-06 um 13.22.50

And I can open the device listed. So far so good (o;

Now according to the class descriptions I need to use first ClaimInterface(InterfaceNumber) before I can do any transfers to/from an endpoint.

So where is this InterfaceNumber coming from?
Is this unique per USB device?

from LibUSBDeviceMBS you query the config descriptor to get LibUSBConfigDescriptorMBS. Then you ask it for the InterfaceDescriptor and get the LibUSBInterfaceMBS object. Then look on it for the LibUSBInterfaceDescriptorMBS objects inside. and there each has a InterfaceNumber value.

Hmmm…that sounds easy :wink:

But Feierabend for today :slight_smile:

Another easy way to find which interface number to use is by running the lsusb command (with recommended -d vendorid/productid switch) on a Linux box or VM - it will print out all interface numbers for each interface in a nice output. The lsusb on macOS isn’t the same, and shows a lot less detail, so I recommend the Linux version. You only have to do this once, as the interface numbers won’t change on a particular USB device. Usually the interface numbers are 0 or 1, so you could also just guess and check.