Thanks, that’s what I was looking for! -Carl > On Jul 10, 2015, at 10:59 PM, Stuart Smith <[email protected]> wrote: > > Carl, > https://developer.apple.com/library/mac/documentation/DeviceDrivers/Concep > tual/AccessingHardware/AH_IOKitLib_API/AH_IOKitLib_API.html > > You're looking for IORegistryCreateIterator or > IORegistryEntryCreateIterator. From these you can iterate up, down or > across planes as required. > > Stuart > > On 7/9/15, 8:26 PM, "Carl Hoefs" <[email protected]> wrote: > >> >>> On Jul 8, 2015, at 6:02 PM, Stuart Smith <[email protected]> wrote: >>> >>> Given a vid/pid, look for an object with idVendor and idProduct matching >>> your vid/pid, then look down the tree for the IODialinDevice key; its >>> value gives you the mount point. >> >> Hi Stuart, >> >> I can locate the topmost device entry by pid/vid, but how to "look down >> the tree”? >> For one device, the IOCalloutDevice key is located way down: >> >> +-o USB Device 2x30A@6200000 <class IOUSBDevice, id 0x1000003b5> >> | +-o IOUSBInterface@1 <class IOUSBInterface, id 0x1000003bb> >> | +-o AppleUSBCDCACMData <class AppleUSBCDCACMData, id 0x1000003be> >> | +-o IOModemSerialStreamSync <class IOModemSerialStreamSync, id >> 0x1000003c0> >> | +-o IOSerialBSDClient <class IOSerialBSDClient, id 0x1000003c1> >> | "IOCalloutDevice" = "/dev/cu.usbmodem621" >> | "IODialinDevice" = "/dev/tty.usbmodem621” >> >> Here’s the relevant code that I have working to this point: >> >> while ((usbDevice = IOIteratorNext(iter))) { >> CFMutableDictionaryRef properties = NULL; >> result = >> IORegistryEntryCreateCFProperties(usbDevice,&properties,kCFAllocatorDefaul >> t,kNilOptions); >> if ((result == KERN_SUCCESS) && properties) { >> NSDictionary *propertiesDict = (__bridge NSDictionary >> *)(properties); >> NSString *pid = [ propertiesDict objectForKey:@"idProduct" ]; >> NSString *vid = [ propertiesDict objectForKey:@"idVendor" ]; >> if ( ( pid.intValue != 0x0089 ) || ( vid.intValue != 0x1FFB ) >> ) { >> . . . // topmost level properties dictionary >> } >> } >> } >> >> The properties dictionary at the topmost level doesn’t have the >> dialing/callout values. What call is used to chain down the tree? >> >> -Carl >> >> >> >> > > >
_______________________________________________ Do not post admin requests to the list. They will be ignored. Usb mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/usb/archive%40mail-archive.com This email sent to [email protected]
