I'm trying to access the SD Card on my DSLR via USB Host using my OTG cable. I believe this is through PTP. I've seen a couple of apps that could do this w/o root permission also, not only can they access it they can also control shutter speed and stuff. But I'm only interested in accessing the SD Card on the DSLR. I got stuck after connecting to the USB Device. See attached code
private void checkInfo() {
manager = (UsbManager) getSystemService(Context.USB_SERVICE);
/*
* this block required if you need to communicate to USB devices it's
* take permission to device
* if you want than you can set this to which device you want to communicate
*/
// ------------------------------------------------------------------
mPermissionIntent = PendingIntent.getBroadcast(this, 0, new Intent(
ACTION_USB_PERMISSION), 0);
IntentFilter filter = new IntentFilter(ACTION_USB_PERMISSION);
registerReceiver(mUsbReceiver, filter);
// -------------------------------------------------------------------
HashMap<String , UsbDevice> deviceList = manager.getDeviceList();
Iterator<UsbDevice> deviceIterator = deviceList.values().iterator();
String i = "";
while (deviceIterator.hasNext()) {
device = deviceIterator.next();
manager.requestPermission(device, mPermissionIntent);
i += "\n" + "DeviceID: " + device.getDeviceId() + "\n"
+ "DeviceName: " + device.getDeviceName() + "\n"
+ "DeviceClass: " + device.getDeviceClass() + " - "
+ "DeviceSubClass: " + device.getDeviceSubclass() + "\n"
+ "VendorID: " + device.getVendorId() + "\n"
+ "ProductID: " + device.getProductId() + "\n";
}
textInfo.setText(i);
}
Could someone please tell me how can I read then eventually download the photo from the DSLR's SD Card to my android application.
UPDATE
So I tried this library https://github.com/mjdev/libaums
Its awesome but the thing is it only supports USB Mass Storage. It wont recognise my camera storage.
Any help is appreciated.