Mailing Lists: Apple Mailing Lists

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

Checking if removable disks are plugged in



Hi there,

I am writing a program that runs in a loop to check if there is any USB
flesh memory stick (removable disk) plugged in.

If yes, then it should ask me to connect one of them, and then to open a
file on this selected removable disk for read and write.

I went to Apple web site and found the sample code on 
http://developer.apple.com/documentation/DeviceDrivers/Conceptual/USBBoo
k/index.html

For my case, I need to know if any removable disks (flash memory stick)
are plugged in regardless vendorID and productID.

Here is the sample code to set the matching dictionary:
 
    //Add the vendor and product IDs to the matching dictionary.
    //This is the second key in the table of device-matching keys of the
    //USB Common Class Specification
    CFDictionarySetValue(matchingDict, CFSTR(kUSBVendorName),
                        CFNumberCreate(kCFAllocatorDefault,
                                     kCFNumberSInt32Type, &usbVendor));
    CFDictionarySetValue(matchingDict, CFSTR(kUSBProductName),
                        CFNumberCreate(kCFAllocatorDefault,
                                    kCFNumberSInt32Type, &usbProduct));
My question is:

If I just want to search the DeviceClass=Mass-Storage( 8) and 
                         DeviceSubClass=Reduced Block Commands (RBC =
1),

(I guess these conditions are sufficient for searching flash memory
stick or removable disk)

How I can replace the above statement? and what else I should do?

Thanks for any help,

Ben


 _______________________________________________
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



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.