Open thebino opened 1 year ago
Puh I never tested CD roms tbh
I dont think it is compatible. They probably use a different protocol.
@magnusja It is not a real CD-drive. The USB device contains two interfaces, see attached device_dump.txt and device_info.txt for more details.
So it seems that the interface does not respond properly to a scsi inquiry. I guess one option would to not throw an exception in that case.
Not sure if there is way to recognize before if the device responds to the scisi command protocol
Does the device really have two interfaces? I can only see one.
The device_dump.txt
lists two interfaces when using dumping the USB Device from android itself.
The device_info.txt
has it listed as two different disks (disk5 the MTP storage I'm interested in, and disk6 which is just the fake CD-Rom with the application/driver for windows)
I would suggest that you change the initialization of the device so that you catch the exception, ignore it and then continue to initialize the second LUN.
The
device_dump.txt
lists two interfaces when using dumping the USB Device from android itself.This is what I see.
ConnectionService I ▶️️ start communication ConnectionService V ├── manufacturerName = null ConnectionService V ├── productId = 12801 ConnectionService V ├── productName = ConnectionService V ├── serialNumber = ConnectionService V ├── vendorId = 3141 ConnectionService V ├── version = 1.00 ConnectionService V ├── deviceClass = 0 ConnectionService V ├── deviceId = 1006 ConnectionService V ├── deviceName = /dev/bus/usb/001/006 ConnectionService V ├── deviceProtocol = 0 ConnectionService V ├── deviceSubclass = 0 ConnectionService V └─ interface ConnectionService V ├─ name = null ConnectionService V ├─ interfaceProtocol = 80 ConnectionService V ├─ interfaceClass = 8 ConnectionService V ├─ interfaceSubclass = 6 ConnectionService V ├─ endpoint ConnectionService V │ ├─ address = 129 ConnectionService V │ ├─ attributes = 2 ConnectionService V │ ├─ direction = 128 ConnectionService V │ ├─ endpointNumber = 1 ConnectionService V │ ├─ interval = 0 ConnectionService V │ ├─ maxPacketSize = 512 ConnectionService V │ └─ type = 2 ConnectionService V └─ endpoint ConnectionService V ├─ address = 2 ConnectionService V ├─ attributes = 2 ConnectionService V ├─ direction = 0 ConnectionService V ├─ endpointNumber = 2 ConnectionService V ├─ interval = 0 ConnectionService V ├─ maxPacketSize = 512 ConnectionService V └─ type = 2 MainAct...eceiver I USB Device detached ConnectionService I ⏹️ stop communication
One interface, two endpoints. What am I missing?
The
device_info.txt
has it listed as two different disks (disk5 the MTP storage I'm interested in, and disk6 which is just the fake CD-Rom with the application/driver for windows)
MTP is not supported! That is a whole nother protocol. This lib only supports the SCSI block command set. I am happy to take contributions though.
Are you sure it is an MTP device?
I would have hoped that an MTP device would not advertise itself as a device which supports scsi.
I meant "Mass Storage Device" not MTP.
And yes, 1 interface, 2 endpoints
I see. Then try what I suggested. Ignore the exception on first LUN and try the second. Maybe we are in luck. But the device not responding to the SCSI inquiry is odd. Maybe the CDRom thingy only supports an older version of that inquiry, I am unsure.
Hasn't changed anything. See attached logcat logcat.txt
This doesnt look like you did what I suggested. Did you catch the exception in you application code? That wont work. Please fork and catch the exception in libaums to ignore and continue initialization of second LUN.
It's catching the exception for the init()
which doesn't help since it is only a single device.
I can try to fork it and debug libaums directly
for (device in devices) {
Timber.d("try to init device ${device.usbDevice.deviceName}")
Timber.v("\t${device.usbDevice}")
try {
Timber.d("\twith ${device.partitions.size} partitions")
} catch (u: UninitializedPropertyAccessException) {
// no-op: partitions aren't initialized yet
}
try {
// before interacting with a device you need to call init()!
device.init()
} catch (io: IOException) {
Timber.e(io, "catch IOException while initializing device!")
}
}
Problem
When initializing a device with multiple endpoints where the first behaves like a CD-Rom drive, the initialisation fails.
See attached files for more details on the device. device_dump.txt device_info.txt
Expected behavior
Initialise at least the non virtual CD-Rom drive
Actual behavior
Crash due initialisation
Stacktrace of Excpetion
Code where problem occurs