Thanks for the suggestion. I’ve tried the variants, including kIOSerialBSD232Type and kIOSerialBSDAllTypes, but nothing is getting matched...
> On Jun 5, 2015, at 6:09 PM, Jack Brindle <[email protected]> wrote: > > You might want to try matching a kIOSerialBSDRS232Type instead of the > kIOSerialBSDModemType you now use. > I believe there are several types you can match. You might not be matching > the right one. > >> On Jun 5, 2015, at 6:00 PM, Carl Hoefs <[email protected] >> <mailto:[email protected]>> wrote: >> >> That’s my situation also. I have numerous such devices plugged in, and I'm >> assuming the matching dictionary will come back with them all. I’m hoping >> there’s a way to relate the device interface (as discovered in IOKit using >> the VID & PID) with the proper entry in the dictionary. But since I’m >> getting back a 0-entry dictionary, I don’t know yet how this will pan out! >> >> -Carl >> >> >>> On Jun 5, 2015, at 5:56 PM, Jack Brindle <[email protected] >>> <mailto:[email protected]>> wrote: >>> >>> So, what if the user has another USB serial device plugged in? Won’t you >>> get it also? >>> >>> >>>> On Jun 5, 2015, at 5:32 PM, Carl Hoefs <[email protected] >>>> <mailto:[email protected]>> wrote: >>>> >>>> >>>>> On Jun 5, 2015, at 4:57 PM, Roland King <[email protected] >>>>> <mailto:[email protected]>> wrote: >>>>> >>>>> >>>>>> On 6 Jun 2015, at 04:34, Carl Hoefs <[email protected] >>>>>> <mailto:[email protected]>> wrote: >>>>>> >>>>>> Using IOKit (OS X 10.10.3) how do I go about obtaining the mount point >>>>>> for >>>>>> a USB device? >>>>>> >>>>>> A USB device I'm using is mounted as /dev/tty.usbmodemXXXXXXXX, where the >>>>>> XXX's vary every time. >>>>>> >>>>>> I can successfully obtain the location ID for the device interface using >>>>>> the VID & PID: >>>>>> >>>>>> kreturn = (*theDeviceInterface)->GetLocationID( theDeviceInterface, >>>>>> &locationID ); >>>>>> >>>>>> But how do I obtain the mount point string? I need to return it so that I >>>>>> can do an fopen on it. >>>>>> >>>>>> -Carl >>>>>> >>>>> >>>>> I had to go look at some old code of mine to find this. Here’s where I >>>>> initialise an object of mine with an IOObject which is a plugged-in USB >>>>> serial device, I usually use the callout device /dev/cu.usbmodemxxxxx, >>>>> the tty I think is the dial in device. Usually it’s the callout you want >>>>> to open. >>>>> >>>>> -(id)initWithIOObject:(io_object_t)io_object >>>>> { >>>>> self = [ super initWithIoObject:io_object ]; >>>>> >>>>> if( self ) >>>>> { >>>>> self.modemName = (__bridge_transfer NSString* >>>>> )IORegistryEntryCreateCFProperty( io_object, CFSTR( kIOTTYDeviceKey >>>>> ), NULL, 0 ); >>>>> self.callOutDevice = (__bridge_transfer NSString* >>>>> )IORegistryEntryCreateCFProperty( io_object, CFSTR( kIOCalloutDeviceKey >>>>> ), NULL, 0 ); >>>>> self.dialInDevice = (__bridge_transfer NSString* >>>>> )IORegistryEntryCreateCFProperty( io_object, CFSTR( kIODialinDeviceKey >>>>> ), NULL, 0 ); >>>>> self.bsdType = (__bridge_transfer NSString* >>>>> )IORegistryEntryCreateCFProperty( io_object, CFSTR( kIOSerialBSDTypeKey >>>>> ), NULL, 0 ); >>>>> } >>>>> >>>>> return self; >>>>> } >>>>> >>>>> Where I found that in the documentation I have entirely forgotten. >>>> >>>> Thanks, that looks like it should work nicely! My device is equally >>>> accessible as /dev/tty.usbmodem* and /dev/cu.usbmodem*. >>>> >>>> But first I need to get an io_object_t reference to the device. The only >>>> way I know of is to get the device in a matching dictionary. Currently I’m >>>> doing the following: >>>> >>>> io_object_t device = 0; >>>> io_iterator_t serialPortIter = 0; >>>> CFMutableDictionaryRef matchDict = >>>> IOServiceMatching(kIOSerialBSDServiceValue); >>>> CFDictionarySetValue(matchDict, CFSTR(kIOSerialBSDTypeKey), >>>> CFSTR(kIOSerialBSDModemType)); >>>> kern_return_t kernResult = >>>> IOServiceGetMatchingServices(kIOMasterPortDefault, matchDict, >>>> &serialPortIter); >>>> while ((device = IOIteratorNext(serialPortIter))) { ... } >>>> >>>> For reasons that elude me, the result of the above code is an empty >>>> matchDict. >>>> >>>> -Carl >>>> >>>> _______________________________________________ >>>> Do not post admin requests to the list. They will be ignored. >>>> Usb mailing list ([email protected] <mailto:[email protected]>) >>>> Help/Unsubscribe/Update your Subscription: >>>> https://lists.apple.com/mailman/options/usb/jackbrindle%40me.com >>>> <https://lists.apple.com/mailman/options/usb/jackbrindle%40me.com> >>>> >>>> This email sent to [email protected] <mailto:[email protected]> >>> >> >
_______________________________________________ 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]
