1
votes

I have a small program to find out the Vendor ID and Product ID of all the USB CDC devices connected to Mac. The program uses the IOServiceNameMatching and IOServiceGetMatchingServices to get the matching dictionary and service iterator respectively as shown in the code snippet below:

matchingDictionary = IOServiceNameMatching("AppleUSBCDC");
IOServiceGetMatchingServices(kIOMasterPortDefault, matchingDictionary, &serviceIterator);

I then iterate through serviceIterator to enumerate and extract the IDs of all the connected USB CDC devices. This used to perfectly work fine until OSX 10.10 but the IOServiceGetMatchingServices is returning empty iterator in OSX 10.11. Why is it returning empty iterator only on OSX 10.11 even though the USB CDC devices are connected? Is there an alternate way to get the device list in OSX 10.11?

2

2 Answers

1
votes

El Capitan changed the underlying names/architecture of the USB stack, I assume the service name is now different but I don't have a USB CDC device handy to check. Use IORegistryExplorer (included with the Hardware IO Tools) to look at the device nubs you want to match against, and see what properties they have (and what you can try to search for with IOServiceNameMatching or IOServiceMatching).

1
votes

I used "IOUSBHostInterface" instead of "AppleUSBCDC" and now able to enumerate and get the Vendor ID and Product ID of all the connected USB CDC devices. Looks like Apple no more recognizes "AppleUSBCDC".