How to get USB Product String

How do I read the product string of a USB device?


I've used IOServiceGetMatchingServices to get to the device that I need, but I want to display a user-friendly name.


I've used IOService utility app to look at all the keys for the device, but none of the keys have the product name.


Searching the web, I found kUSBProductStringIndex, so seems I should use that somehow, but could not find methods or example code of how to use it.


I found Common QA and Roadmap for USB Software Development on Mac OS X which seems to link to some useful example programs, but pretty much all the links in the QA are dead.

Answered by john daniel in 420538022

What is the IOService utility app? I generally use "ioreg -l" and save the output to a file. Then I look for the devices I want. When I find the right one, I locate the most convenient ancestor or descendent to search for via IOServiceGetMatchingServices. When I find the object I want, I use IORegistryEntryCreateCFProperties to get its properties. I have a wrapper class that automatically walks up the device tree searching for a requested key.


In the ioreg output, I see keys like "USB Product Name" and "USB Vendor Name". Is that what you are looking for?

Accepted Answer

What is the IOService utility app? I generally use "ioreg -l" and save the output to a file. Then I look for the devices I want. When I find the right one, I locate the most convenient ancestor or descendent to search for via IOServiceGetMatchingServices. When I find the object I want, I use IORegistryEntryCreateCFProperties to get its properties. I have a wrapper class that automatically walks up the device tree searching for a requested key.


In the ioreg output, I see keys like "USB Product Name" and "USB Vendor Name". Is that what you are looking for?

Thanks, I needed to go up the device tree to find the property that I needed.


Sorry, by IOService utility app, I meant IORegistryExplorer. It is one of the XCode developer utilities. It is a GUI version of ioreg. It has good search and filter functions making it much easier to find what you are looking for.

How to get USB Product String
 
 
Q