mik3y / usb-serial-for-android

Android USB host serial driver library for CDC, FTDI, Arduino and other devices.
MIT License
4.72k stars 1.57k forks source link

USB Composite Device. Could not get read & write endpoints #548

Closed diamond-61 closed 3 months ago

diamond-61 commented 7 months ago

Hello! Hello I have "composite" My device has 5 interfaces. There is a description in the screenshot.

When I call findAllDrivers(UsbManager) and get the driver CdcAcmSerialDriver.

Next I open the device and try to open the serialPort. m_serialPort.open(m_connection);

I get the message "Could not get read & write endpoints".

I discovered that in your code in the file CdsAsmSerialDriver.jac there is a check on line 187.

 if (dataInterfaceCount == mPortNumber) {
     mDataInterface = usbInterface;
}

mPortNumber= 0, when the number of dataInterfaceCount = 0, usbInterface has ID = 1 (#1 on screenshot) This interface has no endpoints. I need an interface with ID = 3 (#4 on screenshot).

I removed these lines from the code and I got my desired interface, but it's wrong. This will not work with any other device.

How can the library be adapted to work with a composite device?

3839c084-00bc-444d-abb8-4669081b1e8c

kai-morich commented 7 months ago

1 with 0 endpoints looks strange. Does the device work with Windows?

How many ports are returned by driver.getPorts()

diamond-61 commented 7 months ago

driver.getPorts() return 1 port

diamond-61 commented 7 months ago

Add scrennshot with interface #0 2

kai-morich commented 7 months ago

If you are not using usb-serial-for-android library version >= 3.6.0, you have to upgrade. If you already use it, please send logcat output from CdcAcmSerialDriver class

diamond-61 commented 7 months ago
dependencies {
 implementation 'com.github.mik3y:usb-serial-for-android:3.7.0'
}
diamond-61 commented 7 months ago

3

kai-morich commented 7 months ago

the library tries to detect the related interfaces with IAD, but the first row 12 01 00 ... does not match the spec table 1-1