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



David:

Thanks for the reply. From what I can see, when running the device on Windows, a file is created. The manufacturer tells me that the device is opened, queried for information about whatever is plugged into the usb box and that information is written to the created file. Then, each time the device is used, it checks to see what is plugged into it against the created files. I guess this is their way to separate the devices.

I'm not sure if I need to do this, but the manufacturer claims that I'd have to come up with a similar procedure for the device(s) to run on OS X properly.

Mike
On Mar 29, 2005, at 4:46 PM, David Ferguson wrote:

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>)
 >Re: Handle to USB device (From: David Ferguson <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.