I'm trying to identify a specific USB device on an OSX Machine. The device is an arduino device with a slighly modified driver and it's own PID and VID.
I can list the device using the bash command "system_profiler SPUSBDataType":
Powerbrain :
Product ID: 0x4243
Vendor ID: 0x2bfd
Version: 1.00
Speed: Up to 12 Mb/sec
Manufacturer: Kinematics
Location ID: 0x14200000 / 27
Current Available (mA): 1000
Current Required (mA): 500
Extra Operating Current (mA): 0
I can also list the device using the bash command "ioreg -p IOUSB -l -b":
Powerbrain @14200000 <class AppleUSBDevice, id 0x100000d1b, registered, matched, active, busy 0 (8 ms), retain 15>
{
"sessionID" = 34690005456990
"iManufacturer" = 1
"bNumConfigurations" = 1
"idProduct" = 16963
"bcdDevice" = 256
"Bus Power Available" = 500
"USB Address" = 27
"bMaxPacketSize0" = 64
"iProduct" = 2
"iSerialNumber" = 0
"bDeviceClass" = 2
"Built-In" = No
"locationID" = 337641472
"bDeviceSubClass" = 0
"bcdUSB" = 512
"USB Product Name" = "Powerbrain "
"PortNum" = 2
"non-removable" = "no"
"IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IOUSBFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
"bDeviceProtocol" = 0
"IOUserClientClass" = "IOUSBDeviceUserClientV2"
"IOPowerManagement" = {"DevicePowerState"=0,"CurrentPowerState"=3,"CapabilityFlags"=65536,"MaxPowerState"=4,"DriverPowerState"=3}
"Device Speed" = 1
"USB Vendor Name" = "Kinematics "
"idVendor" = 11261
"IOGeneralInterest" = "IOCommand is not serializable"
"IOClassNameOverride" = "IOUSBDevice"
}
I also can see the port name "/dev/tty.usbmodem1421" and communicate with it.
The problem is - how does the Location ID "0x14200000 / 27" map to "usbmodem1421"?
If there would also be another way to archive this using Mono C# / Xcode, please let me know.
I solved the problem using IOKit - there is a method to iterate over all modem services and another to find the respective usb device of that communications device.
The code can be used with MonoMac is accessible at GitHub: https://github.com/Lunatix89/MonoMac-IOKit-USBDevice