> On 6 Jun 2015, at 04:34, Carl Hoefs <[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. _______________________________________________
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]