Latest 0.1.3
Homepage https://github.com/raxcat/IdentifyUSBMassStorage
License MIT
Platforms osx 10.9
Frameworks IOKit, DiskArbitration
Authors

[![CI Status](http://img.shields.io/travis/raxcat liu/IdentifyUSBMassStorage.svg?style=flat)](https://travis-ci.org/raxcat liu/IdentifyUSBMassStorage)
Version
License
Platform

  • [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.

Latest podspec

{
    "name": "IdentifyUSBMassStorage",
    "version": "0.1.3",
    "summary": "Identify usb info from a mass storage device.",
    "description": "Identify usb info(ProductID, VendorID.) from a mass storage device.",
    "homepage": "https://github.com/raxcat/IdentifyUSBMassStorage",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "raxcat liu": "[email protected]"
    },
    "source": {
        "git": "https://github.com/raxcat/IdentifyUSBMassStorage.git",
        "tag": "0.1.3"
    },
    "platforms": {
        "osx": "10.9"
    },
    "source_files": "IdentifyUSBMassStorage/Classes/**/*",
    "frameworks": [
        "IOKit",
        "DiskArbitration"
    ]
}

Pin It on Pinterest

Share This