mik3y / usb-serial-for-android

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

CDC device with `mAlternateSetting` #499

Closed Sa-f43 closed 1 year ago

Sa-f43 commented 1 year ago

We are using a CDC-ECM composite device, and it looks like that the CDC Ethernet Control Model can have more than one data interface associated with it for different settings. For that reason, we would end up writing into the wrong interface. This maybe an issue specific to CDC-ECM devices. We think If the openInterface() function in CdcAcmSerialDriver does not increment the interfaces count for repeated interface IDs then that may fix the issue.

image

kai-morich commented 1 year ago

as USB IAD descriptors are not exposed on Java level it's difficult to to group interfaces. The library already has a workaround for RNDIS interfaces. Here would have to handle the mAlternateSettings

kai-morich commented 1 year ago

please provide complete interface list. probably could add a list of already seen mId and skip the the alternate interfaces

Sa-f43 commented 1 year ago

Here is the complete interface list image

kai-morich commented 1 year ago

@Sa-f43 could you provide the full USB descriptor, e.g. by adding

Log.d("terminal","USB descriptor:\n" + HexDump.dumpHexString(usbConnection.getRawDescriptors()));

before

usbSerialPort.open(usbConnection);

in usbSerialExamples/src/main/java/com/hoho/android/usbserial/examples/TerminalFragment.java ?