Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Handle to USB device



Title: Re: Handle to USB device
One way of distinguishing identical USB devices is to use the locationID property.  Once you have discovered USB devices from IOKit, you can look for this property.  This value is unique for each device -- and it will remain constant across reboots if the USB topology isn't changed.

Your framework will want to keep some kind of object (or handle) to represent the device.  Whether this is a real C++ Object, or just an index into an internal table, or the locationID is entirely up to you.

If you're asking if you need to open unique files to access USB devices on MacOS X, the answer is no.  If I've totally misunderstood what you're asking, perhaps you can clarify what help you need.

Regards,

David Ferguson



At 4:19 PM -0600 3/29/05, Michael Krugman wrote:
Hi List:

I'm working on a USB device that uses the EZ-USB AN2131 chip.  I am writing a framework which will eventually serve as a USB driver for the device.  The manufacturer insists that in order for this device to work under OS X, that a handle to the device must be created and this handle is referenced in every command sent to it.  They say the reason is that more than one device can be plugged into the usb box.  They also say that without a created handle to the device that this will not work.  Below is the Windows code that they supplied.  They explain that they create the handle by creating a file and the code is shown below.


bool OpenUsbDriver(){
        char completeDeviceName[64] = "";
        strcat (completeDeviceName,"\\\\.\\");
        strcat (completeDeviceName,"xxxxx-0");
       
        hDeviceHandle = CreateFile( completeDeviceName,
        GENERIC_WRITE,
        FILE_SHARE_WRITE,
        NULL,
        OPEN_EXISTING,
        0,
        NULL);
        if (hDeviceHandle == INVALID_HANDLE_VALUE) {
                return (false);
        }
        return (true);
}

Is there a way to duplicate this in OS X?  Or is there another way to create the handle?  Help is appreciated.

Sincerely,


Mike Krugman

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Usb mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/usb/email@hidden

This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Usb mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/usb/email@hidden

This email sent to email@hidden

References: 
 >Handle to USB device (From: Michael Krugman <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.