IdentifyUSBMassStorage 0.1.3

IdentifyUSBMassStorage 0.1.3

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2016

Maintained by raxcat.



  • By
  • raxcat liu

  • [x] Get VID value from DADiskRef
  • [x] Get PID value from DADiskRef
  • [x] Get mounted Volume Path from a DADiskRef
  • [x] Watch plugin/plugout event for specific mass storage device by pid and vid.
  • [x] Simple
  • [ ] Integration of IOKit for usb events

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Add this line of code when you need to know about disk events.

[[IdentifyUSBMassStorage shareManager] addMassStorageDeviceEventListener:self];

And implement event delegates

#pragma mark - IdentifyUSBMassStorageEvent

-(NSDictionary*)matchingDict{

    //Example of matching: Trancend thumbdrive, pid: 0x1000, vid:0x8564
    return @{ kDiskDevicePropertyVendorID:@(0x8564), kDiskDevicePropertyProductID:@(0x1000) };

//    //Example of matching: pid: 0x1000 only.
//    return @{ kDiskDevicePropertyProductID:@(0x1000) };
//    
//    //Example of matching: vid:0x8564 only.
//    return @{ kDiskDevicePropertyVendorID:@(0x8564) };
//    
//    //Example of no restriction. matching all.
//    return nil;

}

-(void)massStorageDeviceDidPlugIn:(DADiskRef)disk{

}

-(void)massStorageDeviceDidPlugOut:(DADiskRef)disk{

}

Requirements

Installation

IdentifyUSBMassStorage is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "IdentifyUSBMassStorage"

Author

raxcat liu, [email protected]

Reference

License

IdentifyUSBMassStorage is available under the MIT license. See the LICENSE file for more info.