mik3y / usb-serial-for-android

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

USB Device only (Audio + CDC) Not Working #477

Closed lloovve closed 1 year ago

lloovve commented 1 year ago

my device:

error is :controlTransfer failed

Device Info 
Device Path: /dev/bus/usb/001/005
Device Class: Use class information in the Interface Descriptors (0x0)
Vendor ID:  4c4a
Vendor Name (reported):  Jieli Technology
Vendor Name (from DB):  
Product ID:  4155
Product Name (reported):  USB Composite Device
Product Name (from DB):  

Additional Info 
Interface #0 
Class: Audio Device (0x1)
    Endpoints: none
Interface #1 
Class: Audio Device (0x1)
    Endpoints: none
Interface #2 
Class: Audio Device (0x1)
Endpoint: #0
Address        : 0x03 (00000011)
Number         : 3
Direction      : Outbound (0x0)
Type           : Isochronous (0x1)
Poll Interval  : 1
Max Packet Size: 192
Attributes     : 00001001
Interface #3 
Class: Audio Device (0x1)
    Endpoints: none
Interface #4 
Class: Audio Device (0x1)
Endpoint: #0
Address        : 0x83 (10000011)
Number         : 3
Direction      : Inbound (0x80)
Type           : Isochronous (0x1)
Poll Interval  : 1
Max Packet Size: 96
Attributes     : 00000101
Interface #5 
Class: Communication Device (0x2)
Endpoint: #0
Address        : 0x85 (10000101)
Number         : 5
Direction      : Inbound (0x80)
Type           : Interrupt (0x3)
Poll Interval  : 1
Max Packet Size: 8
Attributes     : 00000011
Interface #6 
Class: Communication Device Class (CDC) (0xa)
Endpoint: #0
Address        : 0x04 (00000100)
Number         : 4
Direction      : Outbound (0x0)
Type           : Bulk (0x2)
Poll Interval  : 0
Max Packet Size: 64
Attributes     : 00000010
Endpoint: #1
Address        : 0x84 (10000100)
Number         : 4
Direction      : Inbound (0x80)
Type           : Bulk (0x2)
Poll Interval  : 0
Max Packet Size: 64
Attributes     : 00000010
lloovve commented 1 year ago

When I change the usb registration order, it can communicate normally 。

frist usb cdc after usb audio


Device Info 
Device Path: /dev/bus/usb/001/002
Device Class: Use class information in the Interface Descriptors (0x0)
Vendor ID:  4c4a
Vendor Name (reported):  Jieli Technology
Vendor Name (from DB):  
Product ID:  4155
Product Name (reported):  USB Composite Device
Product Name (from DB):  

Additional Info 
Interface #0 
Class: Communication Device (0x2)
Endpoint: #0
Address        : 0x85 (10000101)
Number         : 5
Direction      : Inbound (0x80)
Type           : Interrupt (0x3)
Poll Interval  : 1
Max Packet Size: 8
Attributes     : 00000011
Interface #1 
Class: Communication Device Class (CDC) (0xa)
Endpoint: #0
Address        : 0x04 (00000100)
Number         : 4
Direction      : Outbound (0x0)
Type           : Bulk (0x2)
Poll Interval  : 0
Max Packet Size: 64
Attributes     : 00000010
Endpoint: #1
Address        : 0x84 (10000100)
Number         : 4
Direction      : Inbound (0x80)
Type           : Bulk (0x2)
Poll Interval  : 0
Max Packet Size: 64
Attributes     : 00000010
Interface #2 
Class: Audio Device (0x1)
    Endpoints: none
Interface #3 
Class: Audio Device (0x1)
    Endpoints: none
Interface #4 
Class: Audio Device (0x1)
Endpoint: #0
Address        : 0x03 (00000011)
Number         : 3
Direction      : Outbound (0x0)
Type           : Isochronous (0x1)
Poll Interval  : 1
Max Packet Size: 192
Attributes     : 00001001
Interface #5 
Class: Audio Device (0x1)
    Endpoints: none
Interface #6 
Class: Audio Device (0x1)
Endpoint: #0
Address        : 0x83 (10000011)
Number         : 3
Direction      : Inbound (0x80)
Type           : Isochronous (0x1)
Poll Interval  : 1
Max Packet Size: 96
Attributes     : 00000101
kai-morich commented 1 year ago

which library version did you use?

kai-morich commented 1 year ago

can you check logcat output? this should print the used interfaces

lloovve commented 1 year ago

I use the latest version library test ,have same problem

lloovve commented 1 year ago
  1. customTable.addProduct(0x4c4a, 0x4155, FtdiSerialDriver.class); // e.g. device with custom VID+PID
  2. add log fun in openInterface and sendAcmControlMessage

for (int i = 0; i < mDevice.getInterfaceCount(); i++) {
                UsbInterface usbInterface = mDevice.getInterface(i);
                Log.d(TAG, "getInterfaceClass= "+ i +" = "+ usbInterface.getInterfaceClass());
            }
private int sendAcmControlMessage(int request, int value, byte[] buf) throws IOException {
            int len = mConnection.controlTransfer(
                    USB_RT_ACM, request, value, mControlIndex, buf, buf != null ? buf.length : 0, 5000);
            Log.d(TAG, "lloovve len=" + len);
            if(len < 0) {
                throw new IOException("controlTransfer failed");
            }
            return len;
        }

 try {
            usbSerialPort.open(usbConnection);
            usbSerialPort.setParameters(baudRate, 8, 1, UsbSerialPort.PARITY_NONE);
            if(withIoManager) {
                usbIoManager = new SerialInputOutputManager(usbSerialPort, this);
                usbIoManager.start();
           }
            status("connected");
           connected = true;
            controlLines.start();
        } catch (Exception e) {
            status("connection failed: " + e.getMessage());
            Log.e("USB SRV",e.getMessage());
            disconnect();
        }

version:

project.afterEvaluate {
    publishing {
        publications {
            release(MavenPublication) {
                from components.release // change 'release' to 'anyDeviceRelease' if coverage is enabled
                artifact androidSourcesJar

                // values used for local maven repo, jitpack uses github release:
                groupId 'com.github.mik3y'
                artifactId 'usb-serial-for-android'
                version '3.5.0beta'
            }
        }
    }
}

logcat:

2023-03-14 09:40:00.511 2660-2660/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: trying default interface logic
2023-03-14 09:40:00.511 2660-2660/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: claiming interfaces, count=7
2023-03-14 09:40:00.511 2660-2660/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: getInterfaceClass= 0 = 1
2023-03-14 09:40:00.511 2660-2660/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: getInterfaceClass= 1 = 1
2023-03-14 09:40:00.511 2660-2660/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: getInterfaceClass= 2 = 1
2023-03-14 09:40:00.511 2660-2660/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: getInterfaceClass= 3 = 1
2023-03-14 09:40:00.511 2660-2660/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: getInterfaceClass= 4 = 1
2023-03-14 09:40:00.511 2660-2660/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: getInterfaceClass= 5 = 2
2023-03-14 09:40:00.511 2660-2660/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: getInterfaceClass= 6 = 10
2023-03-14 09:40:00.511 2660-2660/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: Control iface=UsbInterface[mId=3,mAlternateSetting=0,mName=null,mClass=2,mSubclass=2,mProtocol=1,mEndpoints=[
    UsbEndpoint[mAddress=133,mAttributes=3,mMaxPacketSize=8,mInterval=1]]
2023-03-14 09:40:00.511 2660-2660/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: data iface=UsbInterface[mId=4,mAlternateSetting=0,mName=null,mClass=10,mSubclass=0,mProtocol=0,mEndpoints=[
    UsbEndpoint[mAddress=4,mAttributes=2,mMaxPacketSize=64,mInterval=0]
    UsbEndpoint[mAddress=132,mAttributes=2,mMaxPacketSize=64,mInterval=0]]
2023-03-14 09:40:00.512 2660-2660/com.hoho.android.usbserial.examples D/UsbRequestJNI: init
2023-03-14 09:40:00.512 2660-2660/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: lloovve len=-1
2023-03-14 09:40:00.515 2660-2660/com.hoho.android.usbserial.examples E/USB SRV: controlTransfer failed
2023-03-14 09:40:00.516 2660-2660/com.hoho.android.usbserial.examples D/UsbDeviceConnectionJNI: close
lloovve commented 1 year ago

    =========================== USB Port2 ===========================

Connection Status        : 0x01 (Device is connected)
Port Chain               : 2-6-2

      ========================== Summary =========================
Vendor ID                : 0x4C4A (Unknown Vendor)
Product ID               : 0x4155
USB Version              : 1.1
Port maximum Speed       : High-Speed
Device maximum Speed     : Full-Speed
Device Connection Speed  : Full-Speed
Self powered             : no
Demanded Current         : 100 mA
Used Endpoints           : 4

      ======================== USB Device ========================

        +++++++++++++++++ Device Information ++++++++++++++++++
Device Description       : USB Composite Device
Device Path              : \\?\USB#VID_4C4A&PID_4155#CD60144330323333#{a5dcbf10-6530-11d2-901f-00c04fb951ed} (GUID_DEVINTERFACE_USB_DEVICE)
Kernel Name              : \Device\USBPDO-11
Device ID                : USB\VID_4C4A&PID_4155\CD60144330323333
Hardware IDs             : USB\VID_4C4A&PID_4155&REV_0100 USB\VID_4C4A&PID_4155
Driver KeyName           : {36fc9e60-c465-11cf-8056-444553540000}\0100 (GUID_DEVCLASS_USB)
Driver                   : \SystemRoot\System32\drivers\usbccgp.sys (Version: 10.0.14393.1794  Date: 2017-10-09)
Driver Inf               : C:\windows\inf\usb.inf
Legacy BusType           : PNPBus
Class                    : USB
Class GUID               : {36fc9e60-c465-11cf-8056-444553540000} (GUID_DEVCLASS_USB)
Service                  : usbccgp
Enumerator               : USB
Location Info            : Port_#0002.Hub_#0004
Location IDs             : PCIROOT(0)#PCI(1400)#USBROOT(0)#USB(6)#USB(2), ACPI(_SB_)#ACPI(PCI0)#ACPI(XHC_)#ACPI(RHUB)#ACPI(HS06)#USB(2)
Container ID             : {d69d9751-511f-5e39-b5db-9afcda42a402}
Manufacturer Info        : (标准 USB 主控制器)
Capabilities             : 0x94 (Removable, UniqueID, SurpriseRemovalOK)
Status                   : 0x0180600A (DN_DRIVER_LOADED, DN_STARTED, DN_DISABLEABLE, DN_REMOVABLE, DN_NT_ENUMERATOR, DN_NT_DRIVER)
Problem Code             : 0
Address                  : 2
HcDisableSelectiveSuspend: 0
EnableSelectiveSuspend   : 0
SelectiveSuspendEnabled  : 0
EnhancedPowerMgmtEnabled : 0
IdleInWorkingState       : 0
WakeFromSleepState       : 0
Power State              : D0 (supported: D0, D2, D3, wake from D0, wake from D2)
 Child Device 1          : USBAudio1.0 (USB Audio Device)
  Device Path 1          : \\?\USB#VID_4C4A&PID_4155&MI_00#7&d8447cb&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global (AM_KSCATEGORY_CAPTURE)
  Device Path 2          : \\?\USB#VID_4C4A&PID_4155&MI_00#7&d8447cb&0&0000#{65e8773e-8f56-11d0-a3b9-00a0c9223196}\global (AM_KSCATEGORY_RENDER)
  Device Path 3          : \\?\USB#VID_4C4A&PID_4155&MI_00#7&d8447cb&0&0000#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\global (AM_KSCATEGORY_AUDIO)
  Kernel Name            : \Device\0000027a
  Device ID              : USB\VID_4C4A&PID_4155&MI_00\7&D8447CB&0&0000
  Class                  : MEDIA
  Driver KeyName         : {4d36e96c-e325-11ce-bfc1-08002be10318}\0017 (GUID_DEVCLASS_MEDIA)
  Service                : usbaudio
  Location               : 0000.0014.0000.006.002.000.000.000.000
  LocationPaths          : PCIROOT(0)#PCI(1400)#USBROOT(0)#USB(6)#USB(2)#USBMI(0)  PCIROOT(0)#PCI(1400)#USBROOT(0)#USB(6)#USB(2)#USB(2)  ACPI(_SB_)#ACPI(PCI0)#ACPI(XHC_)#ACPI(RHUB)#ACPI(HS06)#USB(2)#USBMI(0)  ACPI(_SB_)#ACPI(PCI0)#ACPI(XHC_)#ACPI(RHUB)#ACPI(HS06)#USB(2)#USB(2)
   Child Device 1        : 扬声器 (5- USBAudio1.0) (音频端点)
    Device ID            : SWD\MMDEVAPI\{0.0.0.00000000}.{1DEF7737-420A-499D-A01D-4B730E5A82FF}
    Class                : AudioEndpoint
    Driver KeyName       : {c166523c-fe0c-4a94-a586-f1a80cfbbf3e}\0031 (AUDIOENDPOINT_CLASS_UUID)
   Child Device 2        : 麦克风 (5- USBAudio1.0) (音频端点)
    Device ID            : SWD\MMDEVAPI\{0.0.1.00000000}.{F3EDC5EE-8F6D-45E6-870E-691612C9AD58}
    Class                : AudioEndpoint
    Driver KeyName       : {c166523c-fe0c-4a94-a586-f1a80cfbbf3e}\0032 (AUDIOENDPOINT_CLASS_UUID)
 Child Device 2          : USB 串行设备 (COM54)
  Device Path            : \\?\USB#VID_4C4A&PID_4155&MI_03#7&d8447cb&0&0003#{86e0d1e0-8089-11d0-9ce4-08003e301f73} (GUID_DEVINTERFACE_COMPORT)
  Kernel Name            : \Device\0000027b
  Device ID              : USB\VID_4C4A&PID_4155&MI_03\7&D8447CB&0&0003
  Class                  : Ports
  Driver KeyName         : {4d36e978-e325-11ce-bfc1-08002be10318}\0037 (GUID_DEVCLASS_PORTS)
  Service                : usbser
  Location               : 0000.0014.0000.006.002.000.000.000.000
  LocationPaths          : PCIROOT(0)#PCI(1400)#USBROOT(0)#USB(6)#USB(2)#USBMI(3)  ACPI(_SB_)#ACPI(PCI0)#ACPI(XHC_)#ACPI(RHUB)#ACPI(HS06)#USB(2)#USBMI(3)
  COM-Port               : COM54 (\Device\USBSER000)

        ---------------- Connection Information ---------------
Connection Index         : 0x02 (Port 2)
Connection Status        : 0x01 (DeviceConnected)
Current Config Value     : 0x01 (Configuration 1)
Device Address           : 0x18 (24)
Is Hub                   : 0x00 (no)
Device Bus Speed         : 0x01 (Full-Speed)
Number Of Open Pipes     : 0x03 (3 pipes to data endpoints)
Pipe[0]                  : EndpointID=5  Direction=IN   ScheduleOffset=0  Type=Interrupt  wMaxPacketSize=0x8     bInterval=1   -> 196 Bits/ms = 24500 Bytes/s
Pipe[1]                  : EndpointID=4  Direction=OUT  ScheduleOffset=0  Type=Bulk       wMaxPacketSize=0x40    bInterval=0  
Pipe[2]                  : EndpointID=4  Direction=IN   ScheduleOffset=0  Type=Bulk       wMaxPacketSize=0x40    bInterval=0  
Data (HexDump)           : 02 00 00 00 12 01 10 01 00 00 00 40 4A 4C 55 41   ...........@JLUA
                           00 01 01 02 03 01 01 01 00 18 00 03 00 00 00 01   ................
                           00 00 00 07 05 85 03 08 00 01 00 00 00 00 07 05   ................
                           04 02 40 00 00 00 00 00 00 07 05 84 02 40 00 00   ..@..........@..
                           00 00 00 00                                       ....

        --------------- Connection Information V2 -------------
Connection Index         : 0x02 (2)
Length                   : 0x10 (16 bytes)
SupportedUsbProtocols    : 0x03
 Usb110                  : 1 (yes, port supports USB 1.1)
 Usb200                  : 1 (yes, port supports USB 2.0)
 Usb300                  : 0 (no, port not supports USB 3.0)
 ReservedMBZ             : 0x00
Flags                    : 0x00
 DevIsOpAtSsOrHigher     : 0 (Device is not operating at SuperSpeed or higher)
 DevIsSsCapOrHigher      : 0 (Device is not SuperSpeed capable or higher)
 DevIsOpAtSsPlusOrHigher : 0 (Device is not operating at SuperSpeedPlus or higher)
 DevIsSsPlusCapOrHigher  : 0 (Device is not SuperSpeedPlus capable or higher)
 ReservedMBZ             : 0x00
Data (HexDump)           : 02 00 00 00 10 00 00 00 03 00 00 00 00 00 00 00   ................

    ---------------------- Device Descriptor ----------------------
bLength                  : 0x12 (18 bytes)
bDescriptorType          : 0x01 (Device Descriptor)
bcdUSB                   : 0x110 (USB Version 1.1)
bDeviceClass             : 0x00 (defined by the interface descriptors)
bDeviceSubClass          : 0x00
bDeviceProtocol          : 0x00
bMaxPacketSize0          : 0x40 (64 bytes)
idVendor                 : 0x4C4A (Unknown Vendor)
idProduct                : 0x4155
bcdDevice                : 0x0100
iManufacturer            : 0x01 (String Descriptor 1)
 Language 0x0409         : "Jieli Technology"
iProduct                 : 0x02 (String Descriptor 2)
 Language 0x0409         : "USB Composite Device"
iSerialNumber            : 0x03 (String Descriptor 3)
 Language 0x0409         : "CD60144330323333"
bNumConfigurations       : 0x01 (1 Configuration)
Data (HexDump)           : 12 01 10 01 00 00 00 40 4A 4C 55 41 00 01 01 02   .......@JLUA....
                           03 01                                             ..

    ------------------ Configuration Descriptor -------------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x02 (Configuration Descriptor)
wTotalLength             : 0x0119 (281 bytes)
bNumInterfaces           : 0x05 (5 Interfaces)
bConfigurationValue      : 0x01 (Configuration 1)
iConfiguration           : 0x00 (No String Descriptor)
bmAttributes             : 0x80
 D7: Reserved, set 1     : 0x01
 D6: Self Powered        : 0x00 (no)
 D5: Remote Wakeup       : 0x00 (no)
 D4..0: Reserved, set 0  : 0x00
MaxPower                 : 0x32 (100 mA)
Data (HexDump)           : 09 02 19 01 05 01 00 80 32 08 0B 00 03 01 02 00   ........2.......
                           05 09 04 00 00 00 01 01 00 05 0A 24 01 00 01 4E   ...........$...N
                           00 02 01 02 0C 24 02 01 01 01 00 02 03 00 00 00   .....$..........
                           0C 24 02 04 01 02 00 01 00 00 00 00 09 24 03 03   .$...........$..
                           01 03 00 08 00 09 24 03 06 01 01 02 07 00 07 24   ......$........$
                           05 08 01 02 00 07 24 05 07 01 05 00 0A 24 06 02   ......$......$..
                           01 01 01 02 02 00 09 24 06 05 04 01 43 00 00 09   .......$....C...
                           04 01 00 00 01 02 00 00 09 04 01 01 01 01 02 00   ................
                           00 07 24 01 01 01 01 00 0B 24 02 01 02 02 10 01   ..$......$......
                           80 BB 00 09 05 03 09 C0 00 01 00 00 07 25 01 00   .............%..
                           00 00 00 09 04 02 00 00 01 02 00 00 09 04 02 01   ................
                           01 01 02 00 00 07 24 01 06 01 01 00 0B 24 02 01   ......$......$..
                           01 02 10 01 80 BB 00 09 05 83 05 60 00 01 00 00   ...........`....
                           07 25 01 00 00 00 00 08 0B 03 02 02 02 01 00 09   .%..............
                           04 03 00 01 02 02 01 00 05 24 00 10 01 05 24 01   .........$....$.
                           03 04 04 24 02 02 05 24 06 03 04 07 05 85 03 08   ...$...$........
                           00 01 09 04 04 00 02 0A 00 00 00 07 05 04 02 40   ...............@
                           00 00 07 05 84 02 40 00 00                        ......@..

        ------------------- IAD Descriptor --------------------
bLength                  : 0x08 (8 bytes)
bDescriptorType          : 0x0B (Interface Association Descriptor)
bFirstInterface          : 0x00 (Interface 0)
bInterfaceCount          : 0x03 (3 Interfaces)
bFunctionClass           : 0x01 (Audio)
bFunctionSubClass        : 0x02 (Audio Streaming)
bFunctionProtocol        : 0x00
iFunction                : 0x05 (String Descriptor 5)
 Language 0x0409         : "USBAudio1.0"
Data (HexDump)           : 08 0B 00 03 01 02 00 05                           ........

        ---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x00 (Interface 0)
bAlternateSetting        : 0x00
bNumEndpoints            : 0x00 (Default Control Pipe only)
bInterfaceClass          : 0x01 (Audio)
bInterfaceSubClass       : 0x01 (Audio Control)
bInterfaceProtocol       : 0x00
iInterface               : 0x05 (String Descriptor 5)
 Language 0x0409         : "USBAudio1.0"
Data (HexDump)           : 09 04 00 00 00 01 01 00 05                        .........

        ------ Audio Control Interface Header Descriptor ------
bLength                  : 0x0A (10 bytes)
bDescriptorType          : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype       : 0x01 (Header)
bcdADC                   : 0x0100
wTotalLength             : 0x004E (78 bytes)
bInCollection            : 0x02
baInterfaceNr[1]         : 0x01
baInterfaceNr[2]         : 0x02
Data (HexDump)           : 0A 24 01 00 01 4E 00 02 01 02                     .$...N....

        ------- Audio Control Input Terminal Descriptor -------
bLength                  : 0x0C (12 bytes)
bDescriptorType          : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype       : 0x02 (Input Terminal)
bTerminalID              : 0x01
wTerminalType            : 0x0101 (USB Streaming)
bAssocTerminal           : 0x00
bNrChannels              : 0x02 (2 channels)
wChannelConfig           : 0x0003 (L, R)
iChannelNames            : 0x00 (No String Descriptor)
iTerminal                : 0x00 (No String Descriptor)
Data (HexDump)           : 0C 24 02 01 01 01 00 02 03 00 00 00               .$..........

        ------- Audio Control Input Terminal Descriptor -------
bLength                  : 0x0C (12 bytes)
bDescriptorType          : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype       : 0x02 (Input Terminal)
bTerminalID              : 0x04
wTerminalType            : 0x0201 (Microphone)
bAssocTerminal           : 0x00
bNrChannels              : 0x01 (1 channel)
wChannelConfig           : 0x0000 (-)
iChannelNames            : 0x00 (No String Descriptor)
iTerminal                : 0x00 (No String Descriptor)
Data (HexDump)           : 0C 24 02 04 01 02 00 01 00 00 00 00               .$..........

        ------- Audio Control Output Terminal Descriptor ------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype       : 0x03 (Output Terminal)
bTerminalID              : 0x03
wTerminalType            : 0x0301 (Speaker)
bAssocTerminal           : 0x00 (0)
bSourceID                : 0x08 (8)
iTerminal                : 0x00 (No String Descriptor)
Data (HexDump)           : 09 24 03 03 01 03 00 08 00                        .$.......

        ------- Audio Control Output Terminal Descriptor ------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype       : 0x03 (Output Terminal)
bTerminalID              : 0x06
wTerminalType            : 0x0101 (USB Streaming)
bAssocTerminal           : 0x02 (2)
bSourceID                : 0x07 (7)
iTerminal                : 0x00 (No String Descriptor)
Data (HexDump)           : 09 24 03 06 01 01 02 07 00                        .$.......

        ------- Audio Control Selector Unit Descriptor --------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype       : 0x05 (Selector Unit)
bUnitID                  : 0x08
bNrInPins                : 0x01 (1 Input Pin)
baSourceID[1]            : 0x02 (2)
iSelector                : 0x00 (No String Descriptor)
Data (HexDump)           : 07 24 05 08 01 02 00                              .$.....

        ------- Audio Control Selector Unit Descriptor --------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype       : 0x05 (Selector Unit)
bUnitID                  : 0x07
bNrInPins                : 0x01 (1 Input Pin)
baSourceID[1]            : 0x05 (5)
iSelector                : 0x00 (No String Descriptor)
Data (HexDump)           : 07 24 05 07 01 05 00                              .$.....

        -------- Audio Control Feature Unit Descriptor --------
bLength                  : 0x0A (10 bytes)
bDescriptorType          : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype       : 0x06 (Feature Unit)
bUnitID                  : 0x02 (2)
bSourceID                : 0x01 (1)
bControlSize             : 0x01 (1 byte per control)
bmaControls[0]           : 0x01
 D0: Mute                : 1
 D1: Volume              : 0
 D2: Bass                : 0
 D3: Mid                 : 0
 D4: Treble              : 0
 D5: Graphic Equalizer   : 0
 D6: Automatic Gain      : 0
 D7: Delay               : 0
bmaControls[1]           : 0x02
 D0: Mute                : 0
 D1: Volume              : 1
 D2: Bass                : 0
 D3: Mid                 : 0
 D4: Treble              : 0
 D5: Graphic Equalizer   : 0
 D6: Automatic Gain      : 0
 D7: Delay               : 0
bmaControls[2]           : 0x02
 D0: Mute                : 0
 D1: Volume              : 1
 D2: Bass                : 0
 D3: Mid                 : 0
 D4: Treble              : 0
 D5: Graphic Equalizer   : 0
 D6: Automatic Gain      : 0
 D7: Delay               : 0
iFeature                 : 0x00 (No String Descriptor)
Data (HexDump)           : 0A 24 06 02 01 01 01 02 02 00                     .$........

        -------- Audio Control Feature Unit Descriptor --------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype       : 0x06 (Feature Unit)
bUnitID                  : 0x05 (5)
bSourceID                : 0x04 (4)
bControlSize             : 0x01 (1 byte per control)
bmaControls[0]           : 0x43
 D0: Mute                : 1
 D1: Volume              : 1
 D2: Bass                : 0
 D3: Mid                 : 0
 D4: Treble              : 0
 D5: Graphic Equalizer   : 0
 D6: Automatic Gain      : 1
 D7: Delay               : 0
bmaControls[1]           : 0x00
 D0: Mute                : 0
 D1: Volume              : 0
 D2: Bass                : 0
 D3: Mid                 : 0
 D4: Treble              : 0
 D5: Graphic Equalizer   : 0
 D6: Automatic Gain      : 0
 D7: Delay               : 0
iFeature                 : 0x00 (No String Descriptor)
Data (HexDump)           : 09 24 06 05 04 01 43 00 00                        .$....C..

        ---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x01 (Interface 1)
bAlternateSetting        : 0x00
bNumEndpoints            : 0x00 (Default Control Pipe only)
bInterfaceClass          : 0x01 (Audio)
bInterfaceSubClass       : 0x02 (Audio Streaming)
bInterfaceProtocol       : 0x00
iInterface               : 0x00 (No String Descriptor)
Data (HexDump)           : 09 04 01 00 00 01 02 00 00                        .........

        ---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x01 (Interface 1)
bAlternateSetting        : 0x01
bNumEndpoints            : 0x01 (1 Endpoint)
bInterfaceClass          : 0x01 (Audio)
bInterfaceSubClass       : 0x02 (Audio Streaming)
bInterfaceProtocol       : 0x00
iInterface               : 0x00 (No String Descriptor)
Data (HexDump)           : 09 04 01 01 01 01 02 00 00                        .........

        -------- Audio Streaming Interface Descriptor ---------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype       : 0x01 (AS_GENERAL)
bTerminalLink            : 0x01 (Terminal ID 1)
bDelay                   : 0x01 (1 frame)
wFormatTag               : 0x0001 (PCM)
Data (HexDump)           : 07 24 01 01 01 01 00                              .$.....

        ------- Audio Streaming Format Type Descriptor --------
bLength                  : 0x0B (11 bytes)
bDescriptorType          : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype       : 0x02 (Format Type)
bFormatType              : 0x01 (FORMAT_TYPE_I)
bNrChannels              : 0x02 (2 channels)
bSubframeSize            : 0x02 (2 bytes per subframe)
bBitResolution           : 0x10 (16 bits per sample)
bSamFreqType             : 0x01 (supports 1 sample frequence)
tSamFreq[1]              : 0x0BB80 (48000 Hz)
Data (HexDump)           : 0B 24 02 01 02 02 10 01 80 BB 00                  .$.........

        ----------------- Endpoint Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x03 (Direction=OUT EndpointID=3)
bmAttributes             : 0x09 (TransferType=Isochronous  SyncType=Adaptive  EndpointType=Data)
wMaxPacketSize           : 0x00C0 (192 bytes)
bInterval                : 0x01 (1 ms)
bRefresh                 : 0x00
bSynchAddress            : 0x00
Data (HexDump)           : 09 05 03 09 C0 00 01 00 00                        .........

        ----------- Audio Data Endpoint Descriptor ------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x25 (Audio Endpoint Descriptor)
bDescriptorSubtype       : 0x01 (General)
bmAttributes             : 0x00
 D0   : Sampling Freq    : 0x00 (not supported)
 D1   : Pitch            : 0x00 (not supported)
 D6..2: Reserved         : 0x00
 D7   : MaxPacketsOnly   : 0x00 (no)
bLockDelayUnits          : 0x00 (Undefined)
wLockDelay               : 0x0000
Data (HexDump)           : 07 25 01 00 00 00 00                              .%.....

        ---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x02 (Interface 2)
bAlternateSetting        : 0x00
bNumEndpoints            : 0x00 (Default Control Pipe only)
bInterfaceClass          : 0x01 (Audio)
bInterfaceSubClass       : 0x02 (Audio Streaming)
bInterfaceProtocol       : 0x00
iInterface               : 0x00 (No String Descriptor)
Data (HexDump)           : 09 04 02 00 00 01 02 00 00                        .........

        ---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x02 (Interface 2)
bAlternateSetting        : 0x01
bNumEndpoints            : 0x01 (1 Endpoint)
bInterfaceClass          : 0x01 (Audio)
bInterfaceSubClass       : 0x02 (Audio Streaming)
bInterfaceProtocol       : 0x00
iInterface               : 0x00 (No String Descriptor)
Data (HexDump)           : 09 04 02 01 01 01 02 00 00                        .........

        -------- Audio Streaming Interface Descriptor ---------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype       : 0x01 (AS_GENERAL)
bTerminalLink            : 0x06 (Terminal ID 6)
bDelay                   : 0x01 (1 frame)
wFormatTag               : 0x0001 (PCM)
Data (HexDump)           : 07 24 01 06 01 01 00                              .$.....

        ------- Audio Streaming Format Type Descriptor --------
bLength                  : 0x0B (11 bytes)
bDescriptorType          : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype       : 0x02 (Format Type)
bFormatType              : 0x01 (FORMAT_TYPE_I)
bNrChannels              : 0x01 (1 channel)
bSubframeSize            : 0x02 (2 bytes per subframe)
bBitResolution           : 0x10 (16 bits per sample)
bSamFreqType             : 0x01 (supports 1 sample frequence)
tSamFreq[1]              : 0x0BB80 (48000 Hz)
Data (HexDump)           : 0B 24 02 01 01 02 10 01 80 BB 00                  .$.........

        ----------------- Endpoint Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x83 (Direction=IN EndpointID=3)
bmAttributes             : 0x05 (TransferType=Isochronous  SyncType=Asynchronous  EndpointType=Data)
wMaxPacketSize           : 0x0060 (96 bytes)
bInterval                : 0x01 (1 ms)
bRefresh                 : 0x00
bSynchAddress            : 0x00
Data (HexDump)           : 09 05 83 05 60 00 01 00 00                        ....`....

        ----------- Audio Data Endpoint Descriptor ------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x25 (Audio Endpoint Descriptor)
bDescriptorSubtype       : 0x01 (General)
bmAttributes             : 0x00
 D0   : Sampling Freq    : 0x00 (not supported)
 D1   : Pitch            : 0x00 (not supported)
 D6..2: Reserved         : 0x00
 D7   : MaxPacketsOnly   : 0x00 (no)
bLockDelayUnits          : 0x00 (Undefined)
wLockDelay               : 0x0000
Data (HexDump)           : 07 25 01 00 00 00 00                              .%.....

        ------------------- IAD Descriptor --------------------
bLength                  : 0x08 (8 bytes)
bDescriptorType          : 0x0B (Interface Association Descriptor)
bFirstInterface          : 0x03 (Interface 3)
bInterfaceCount          : 0x02 (2 Interfaces)
bFunctionClass           : 0x02 (Communications and CDC Control)
bFunctionSubClass        : 0x02
bFunctionProtocol        : 0x01
iFunction                : 0x00 (No String Descriptor)
Data (HexDump)           : 08 0B 03 02 02 02 01 00                           ........

        ---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x03 (Interface 3)
bAlternateSetting        : 0x00
bNumEndpoints            : 0x01 (1 Endpoint)
bInterfaceClass          : 0x02 (Communications and CDC Control)
bInterfaceSubClass       : 0x02 (Abstract Control Model)
bInterfaceProtocol       : 0x01 (AT Commands defined by ITU-T V.250 etc)
iInterface               : 0x00 (No String Descriptor)
Data (HexDump)           : 09 04 03 00 01 02 02 01 00                        .........

        -------------- CDC Interface Descriptor ---------------
bFunctionLength          : 0x05 (5 bytes)
bDescriptorType          : 0x24 (Interface)
bDescriptorSubType       : 0x00 (Header Functional Descriptor)
bcdCDC                   : 0x110 (CDC Version 1.10)
Data (HexDump)           : 05 24 00 10 01                                    .$...

        -------------- CDC Interface Descriptor ---------------
bFunctionLength          : 0x05 (5 bytes)
bDescriptorType          : 0x24 (Interface)
bDescriptorSubType       : 0x01 (Call Management Functional Descriptor)
bmCapabilities           : 0x03
 D7..2                   : 0x00 (Reserved)
 D1                      : 0x01 (can send/receive call management information over a Data Class interface)
 D0                      : 0x01 (handles call management itself)
bDataInterface           : 0x04
Data (HexDump)           : 05 24 01 03 04                                    .$...

        -------------- CDC Interface Descriptor ---------------
bFunctionLength          : 0x04 (4 bytes)
bDescriptorType          : 0x24 (Interface)
bDescriptorSubType       : 0x02 (Abstract Control Management Functional Descriptor)
bmCapabilities           : 0x02
 D7..4                   : 0x00 (Reserved)
 D3                      : 0x00 (not supports the notification Network_Connection)
 D2                      : 0x00 (not supports the request Send_Break)
 D1                      : 0x01 (supports the request combination of Set_Line_Coding, Set_Control_Line_State, Get_Line_Coding, and the notification Serial_State)
 D0                      : 0x00 (not supports the request combination of Set_Comm_Feature, Clear_Comm_Feature, and Get_Comm_Feature)
Data (HexDump)           : 04 24 02 02                                       .$..

        -------------- CDC Interface Descriptor ---------------
bFunctionLength          : 0x05 (5 bytes)
bDescriptorType          : 0x24 (Interface)
bDescriptorSubType       : 0x06 (Union Functional Descriptor)
bControlInterface        : 0x03
bSubordinateInterface[0] : 0x04
Data (HexDump)           : 05 24 06 03 04                                    .$...

        ----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x85 (Direction=IN EndpointID=5)
bmAttributes             : 0x03 (TransferType=Interrupt)
wMaxPacketSize           : 0x0008 (8 bytes)
bInterval                : 0x01 (1 ms)
Data (HexDump)           : 07 05 85 03 08 00 01                              .......

        ---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x04 (Interface 4)
bAlternateSetting        : 0x00
bNumEndpoints            : 0x02 (2 Endpoints)
bInterfaceClass          : 0x0A (CDC-Data)
bInterfaceSubClass       : 0x00
bInterfaceProtocol       : 0x00
iInterface               : 0x00 (No String Descriptor)
Data (HexDump)           : 09 04 04 00 02 0A 00 00 00                        .........

        ----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x04 (Direction=OUT EndpointID=4)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0040 (64 bytes)
bInterval                : 0x00 (ignored)
Data (HexDump)           : 07 05 04 02 40 00 00                              ....@..

        ----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x84 (Direction=IN EndpointID=4)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0040 (64 bytes)
bInterval                : 0x00 (ignored)
Data (HexDump)           : 07 05 84 02 40 00 00                              ....@..

      -------------------- String Descriptors -------------------
             ------ String Descriptor 0 ------
bLength                  : 0x04 (4 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language ID[0]           : 0x0409 (English - United States)
Data (HexDump)           : 04 03 09 04                                       ....
             ------ String Descriptor 1 ------
bLength                  : 0x22 (34 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "Jieli Technology"
Data (HexDump)           : 22 03 4A 00 69 00 65 00 6C 00 69 00 20 00 54 00   ".J.i.e.l.i. .T.
                           65 00 63 00 68 00 6E 00 6F 00 6C 00 6F 00 67 00   e.c.h.n.o.l.o.g.
                           79 00                                             y.
             ------ String Descriptor 2 ------
bLength                  : 0x2A (42 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "USB Composite Device"
Data (HexDump)           : 2A 03 55 00 53 00 42 00 20 00 43 00 6F 00 6D 00   *.U.S.B. .C.o.m.
                           70 00 6F 00 73 00 69 00 74 00 65 00 20 00 44 00   p.o.s.i.t.e. .D.
                           65 00 76 00 69 00 63 00 65 00                     e.v.i.c.e.
             ------ String Descriptor 3 ------
bLength                  : 0x22 (34 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "CD60144330323333"
Data (HexDump)           : 22 03 43 00 44 00 36 00 30 00 31 00 34 00 34 00   ".C.D.6.0.1.4.4.
                           33 00 33 00 30 00 33 00 32 00 33 00 33 00 33 00   3.3.0.3.2.3.3.3.
                           33 00                                             3.
             ------ String Descriptor 5 ------
bLength                  : 0x18 (24 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "USBAudio1.0"
Data (HexDump)           : 18 03 55 00 53 00 42 00 41 00 75 00 64 00 69 00   ..U.S.B.A.u.d.i.
                           6F 00 31 00 2E 00 30 00                           o.1...0.
lloovve commented 1 year ago

when i use frist cdc after audio ,it is runing ok;

logcat:

2023-03-14 10:04:09.478 14032-14032/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: trying default interface logic
2023-03-14 10:04:09.478 14032-14032/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: claiming interfaces, count=7
2023-03-14 10:04:09.478 14032-14032/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: getInterfaceClass= 0 = 2
2023-03-14 10:04:09.478 14032-14032/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: getInterfaceClass= 1 = 10
2023-03-14 10:04:09.478 14032-14032/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: getInterfaceClass= 2 = 1
2023-03-14 10:04:09.478 14032-14032/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: getInterfaceClass= 3 = 1
2023-03-14 10:04:09.478 14032-14032/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: getInterfaceClass= 4 = 1
2023-03-14 10:04:09.478 14032-14032/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: getInterfaceClass= 5 = 1
2023-03-14 10:04:09.478 14032-14032/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: getInterfaceClass= 6 = 1
2023-03-14 10:04:09.478 14032-14032/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: Control iface=UsbInterface[mId=0,mAlternateSetting=0,mName=null,mClass=2,mSubclass=2,mProtocol=1,mEndpoints=[
    UsbEndpoint[mAddress=133,mAttributes=3,mMaxPacketSize=8,mInterval=1]]
2023-03-14 10:04:09.479 14032-14032/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: data iface=UsbInterface[mId=1,mAlternateSetting=0,mName=null,mClass=10,mSubclass=0,mProtocol=0,mEndpoints=[
    UsbEndpoint[mAddress=4,mAttributes=2,mMaxPacketSize=64,mInterval=0]
    UsbEndpoint[mAddress=132,mAttributes=2,mMaxPacketSize=64,mInterval=0]]
2023-03-14 10:04:09.479 14032-14032/com.hoho.android.usbserial.examples D/UsbRequestJNI: init
2023-03-14 10:04:09.482 14032-14032/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: lloovve len=7
2023-03-14 10:04:15.466 14032-14032/com.hoho.android.usbserial.examples I/Toast: Show toast from OpPackageName:com.hoho.android.usbserial.examples, PackageName:com.hoho.android.usbserial.examples
2023-03-14 10:04:49.822 14579-14579/? I/Zygote: seccomp disabled by setenforce 0
2023-03-14 10:04:49.832 14579-14579/? I/serial.example: Late-enabling -Xcheck:jni
2023-03-14 10:04:50.210 14579-14579/com.hoho.android.usbserial.examples I/Perf: Connecting to perf service.
2023-03-14 10:04:50.627 14579-14665/com.hoho.android.usbserial.examples I/Adreno: QUALCOMM build                   : cf57c9c, I1cb5c4d1cc
    Build Date                       : 09/23/18
    OpenGL ES Shader Compiler Version: EV031.25.03.01
    Local Branch                     : 
    Remote Branch                    : 
    Remote Branch                    : 
    Reconstruct Branch               : 
2023-03-14 10:04:50.627 14579-14665/com.hoho.android.usbserial.examples I/Adreno: Build Config                     : S L 6.0.7 AArch64
2023-03-14 10:04:50.633 14579-14665/com.hoho.android.usbserial.examples I/Adreno: PFP: 0x005ff112, ME: 0x005ff066
2023-03-14 10:04:50.638 14579-14665/com.hoho.android.usbserial.examples I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
2023-03-14 10:04:50.639 14579-14665/com.hoho.android.usbserial.examples I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
2023-03-14 10:04:50.639 14579-14665/com.hoho.android.usbserial.examples I/OpenGLRenderer: Initialized EGL, version 1.4
2023-03-14 10:04:50.640 14579-14665/com.hoho.android.usbserial.examples D/OpenGLRenderer: Swap behavior 2
2023-03-14 10:04:55.114 14579-14579/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: trying default interface logic
2023-03-14 10:04:55.114 14579-14579/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: claiming interfaces, count=7
2023-03-14 10:04:55.114 14579-14579/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: getInterfaceClass= 0 = 2
2023-03-14 10:04:55.114 14579-14579/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: getInterfaceClass= 1 = 10
2023-03-14 10:04:55.114 14579-14579/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: getInterfaceClass= 2 = 1
2023-03-14 10:04:55.114 14579-14579/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: getInterfaceClass= 3 = 1
2023-03-14 10:04:55.114 14579-14579/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: getInterfaceClass= 4 = 1
2023-03-14 10:04:55.114 14579-14579/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: getInterfaceClass= 5 = 1
2023-03-14 10:04:55.114 14579-14579/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: getInterfaceClass= 6 = 1
2023-03-14 10:04:55.115 14579-14579/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: Control iface=UsbInterface[mId=0,mAlternateSetting=0,mName=null,mClass=2,mSubclass=2,mProtocol=1,mEndpoints=[
    UsbEndpoint[mAddress=133,mAttributes=3,mMaxPacketSize=8,mInterval=1]]
2023-03-14 10:04:55.115 14579-14579/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: data iface=UsbInterface[mId=1,mAlternateSetting=0,mName=null,mClass=10,mSubclass=0,mProtocol=0,mEndpoints=[
    UsbEndpoint[mAddress=4,mAttributes=2,mMaxPacketSize=64,mInterval=0]
    UsbEndpoint[mAddress=132,mAttributes=2,mMaxPacketSize=64,mInterval=0]]
2023-03-14 10:04:55.115 14579-14579/com.hoho.android.usbserial.examples D/UsbRequestJNI: init
2023-03-14 10:04:55.119 14579-14579/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: lloovve len=7
2023-03-14 10:04:55.133 14579-14711/com.hoho.android.usbserial.examples I/SerialInputOutputManager: Running ...
2023-03-14 10:04:58.224 14579-14622/com.hoho.android.usbserial.examples I/serial.example: ProcessProfilingInfo new_methods=1782 is saved saved_to_disk=1 resolve_classes_delay=8000
lloovve commented 1 year ago

the frist cdc after audio

UsbDevice[mName=/dev/bus/usb/001/002,mVendorId=19530,mProductId=16725,mClass=0,mSubclass=0,mProtocol=0,mManufacturerName=Jieli Technology,mProductName=USB Composite Device,mVersion=1.00,mSerialNumber=CD60144330323333,
mConfigurations=[
    UsbConfiguration[mId=1,mName=null,mAttributes=128,mMaxPower=50,mInterfaces=[
    UsbInterface[mId=0,mAlternateSetting=0,mName=null,mClass=2,mSubclass=2,mProtocol=1,mEndpoints=[
    UsbEndpoint[mAddress=133,mAttributes=3,mMaxPacketSize=8,mInterval=1]]
    UsbInterface[mId=1,mAlternateSetting=0,mName=null,mClass=10,mSubclass=0,mProtocol=0,mEndpoints=[
    UsbEndpoint[mAddress=4,mAttributes=2,mMaxPacketSize=64,mInterval=0]
    UsbEndpoint[mAddress=132,mAttributes=2,mMaxPacketSize=64,mInterval=0]]
    UsbInterface[mId=2,mAlternateSetting=0,mName=USBAudio1.0,mClass=1,mSubclass=1,mProtocol=0,mEndpoints=[]
    UsbInterface[mId=3,mAlternateSetting=0,mName=null,mClass=1,mSubclass=2,mProtocol=0,mEndpoints=[]
    UsbInterface[mId=3,mAlternateSetting=1,mName=null,mClass=1,mSubclass=2,mProtocol=0,mEndpoints=[
    UsbEndpoint[mAddress=3,mAttributes=9,mMaxPacketSize=192,mInterval=1]]
    UsbInterface[mId=4,mAlternateSetting=0,mName=null,mClass=1,mSubclass=2,mProtocol=0,mEndpoints=[]
    UsbInterface[mId=4,mAlternateSetting=1,mName=null,mClass=1,mSubclass=2,mProtocol=0,mEndpoints=[
    UsbEndpoint[mAddress=131,mAttributes=5,mMaxPacketSize=96,mInterval=1]]]]
kai-morich commented 1 year ago

both variants show the correct interfaces

audio first:

2023-03-14 09:40:00.511 2660-2660/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: getInterfaceClass= 5 = 2
2023-03-14 09:40:00.511 2660-2660/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: getInterfaceClass= 6 = 10
2023-03-14 09:40:00.511 2660-2660/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: Control iface=UsbInterface[mId=3,mAlternateSetting=0,mName=null,mClass=2,mSubclass=2,mProtocol=1,mEndpoints=[
    UsbEndpoint[mAddress=133,mAttributes=3,mMaxPacketSize=8,mInterval=1]]
2023-03-14 09:40:00.511 2660-2660/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: data iface=UsbInterface[mId=4,mAlternateSetting=0,mName=null,mClass=10,mSubclass=0,mProtocol=0,mEndpoints=[
    UsbEndpoint[mAddress=4,mAttributes=2,mMaxPacketSize=64,mInterval=0]
    UsbEndpoint[mAddress=132,mAttributes=2,mMaxPacketSize=64,mInterval=0]]

cdc first:

2023-03-14 10:04:55.114 14579-14579/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: getInterfaceClass= 0 = 2
2023-03-14 10:04:55.114 14579-14579/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: getInterfaceClass= 1 = 10
...
2023-03-14 10:04:55.115 14579-14579/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: Control iface=UsbInterface[mId=0,mAlternateSetting=0,mName=null,mClass=2,mSubclass=2,mProtocol=1,mEndpoints=[
    UsbEndpoint[mAddress=133,mAttributes=3,mMaxPacketSize=8,mInterval=1]]
2023-03-14 10:04:55.115 14579-14579/com.hoho.android.usbserial.examples D/CdcAcmSerialDriver: data iface=UsbInterface[mId=1,mAlternateSetting=0,mName=null,mClass=10,mSubclass=0,mProtocol=0,mEndpoints=[
    UsbEndpoint[mAddress=4,mAttributes=2,mMaxPacketSize=64,mInterval=0]
    UsbEndpoint[mAddress=132,mAttributes=2,mMaxPacketSize=64,mInterval=0]]

the only suspicious difference is that mId in first case is different from interface count. Does that number come from your device and you maybe have an issue in your descriptor table?

lloovve commented 1 year ago

any case in windows or ubuntu every thing is ok. when in android ,i am use adb test,the cdc runing ok

lloovve commented 1 year ago

cdc frist :

   =========================== USB Port4 ===========================

Connection Status        : 0x01 (Device is connected)
Port Chain               : 2-6-4

      ========================== Summary =========================
Vendor ID                : 0x4C4A (Unknown Vendor)
Product ID               : 0x4155
USB Version              : 1.1
Port maximum Speed       : High-Speed
Device maximum Speed     : Full-Speed
Device Connection Speed  : Full-Speed
Self powered             : no
Demanded Current         : 100 mA
Used Endpoints           : 4

      ======================== USB Device ========================

        +++++++++++++++++ Device Information ++++++++++++++++++
Device Description       : USB Composite Device
Device Path              : \\?\USB#VID_4C4A&PID_4155#CD60144330323333#{a5dcbf10-6530-11d2-901f-00c04fb951ed} (GUID_DEVINTERFACE_USB_DEVICE)
Kernel Name              : \Device\USBPDO-12
Device ID                : USB\VID_4C4A&PID_4155\CD60144330323333
Hardware IDs             : USB\VID_4C4A&PID_4155&REV_0100 USB\VID_4C4A&PID_4155
Driver KeyName           : {36fc9e60-c465-11cf-8056-444553540000}\0100 (GUID_DEVCLASS_USB)
Driver                   : \SystemRoot\System32\drivers\usbccgp.sys (Version: 10.0.14393.1794  Date: 2017-10-09)
Driver Inf               : C:\windows\inf\usb.inf
Legacy BusType           : PNPBus
Class                    : USB
Class GUID               : {36fc9e60-c465-11cf-8056-444553540000} (GUID_DEVCLASS_USB)
Service                  : usbccgp
Enumerator               : USB
Location Info            : Port_#0004.Hub_#0004
Location IDs             : PCIROOT(0)#PCI(1400)#USBROOT(0)#USB(6)#USB(4), ACPI(_SB_)#ACPI(PCI0)#ACPI(XHC_)#ACPI(RHUB)#ACPI(HS06)#USB(4)
Container ID             : {d69d9751-511f-5e39-b5db-9afcda42a402}
Manufacturer Info        : (标准 USB 主控制器)
Capabilities             : 0x94 (Removable, UniqueID, SurpriseRemovalOK)
Status                   : 0x0180600A (DN_DRIVER_LOADED, DN_STARTED, DN_DISABLEABLE, DN_REMOVABLE, DN_NT_ENUMERATOR, DN_NT_DRIVER)
Problem Code             : 0
Address                  : 4
HcDisableSelectiveSuspend: 0
EnableSelectiveSuspend   : 0
SelectiveSuspendEnabled  : 0
EnhancedPowerMgmtEnabled : 0
IdleInWorkingState       : 0
WakeFromSleepState       : 0
Power State              : D0 (supported: D0, D2, D3, wake from D0, wake from D2)
 Child Device 1          : USB 串行设备 (COM53)
  Device Path            : \\?\USB#VID_4C4A&PID_4155&MI_00#7&d8447cb&0&0000#{86e0d1e0-8089-11d0-9ce4-08003e301f73} (GUID_DEVINTERFACE_COMPORT)
  Kernel Name            : \Device\0000034a
  Device ID              : USB\VID_4C4A&PID_4155&MI_00\7&D8447CB&0&0000
  Class                  : Ports
  Driver KeyName         : {4d36e978-e325-11ce-bfc1-08002be10318}\0012 (GUID_DEVCLASS_PORTS)
  Service                : usbser
  Location               : 0000.0014.0000.006.004.000.000.000.000
  LocationPaths          : PCIROOT(0)#PCI(1400)#USBROOT(0)#USB(6)#USB(4)#USBMI(0)  PCIROOT(0)#PCI(1400)#USBROOT(0)#USB(6)#USB(4)#USB(4)  ACPI(_SB_)#ACPI(PCI0)#ACPI(XHC_)#ACPI(RHUB)#ACPI(HS06)#USB(4)#USBMI(0)  ACPI(_SB_)#ACPI(PCI0)#ACPI(XHC_)#ACPI(RHUB)#ACPI(HS06)#USB(4)#USB(4)
  COM-Port               : COM53 (\Device\USBSER000)
 Child Device 2          : USBAudio1.0 (USB Audio Device)
  Device Path 1          : \\?\USB#VID_4C4A&PID_4155&MI_02#7&d8447cb&0&0002#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\global (AM_KSCATEGORY_AUDIO)
  Device Path 2          : \\?\USB#VID_4C4A&PID_4155&MI_02#7&d8447cb&0&0002#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global (AM_KSCATEGORY_CAPTURE)
  Device Path 3          : \\?\USB#VID_4C4A&PID_4155&MI_02#7&d8447cb&0&0002#{65e8773e-8f56-11d0-a3b9-00a0c9223196}\global (AM_KSCATEGORY_RENDER)
  Kernel Name            : \Device\0000034b
  Device ID              : USB\VID_4C4A&PID_4155&MI_02\7&D8447CB&0&0002
  Class                  : MEDIA
  Driver KeyName         : {4d36e96c-e325-11ce-bfc1-08002be10318}\0028 (GUID_DEVCLASS_MEDIA)
  Service                : usbaudio
  Location               : 0000.0014.0000.006.004.000.000.000.000
  LocationPaths          : PCIROOT(0)#PCI(1400)#USBROOT(0)#USB(6)#USB(4)#USBMI(2)  ACPI(_SB_)#ACPI(PCI0)#ACPI(XHC_)#ACPI(RHUB)#ACPI(HS06)#USB(4)#USBMI(2)
   Child Device 1        : 扬声器 (USBAudio1.0) (音频端点)
    Device ID            : SWD\MMDEVAPI\{0.0.0.00000000}.{F1B130A4-84ED-462F-9180-606DF3B655B8}
    Class                : AudioEndpoint
    Driver KeyName       : {c166523c-fe0c-4a94-a586-f1a80cfbbf3e}\0013 (AUDIOENDPOINT_CLASS_UUID)
   Child Device 2        : 麦克风 (USBAudio1.0) (音频端点)
    Device ID            : SWD\MMDEVAPI\{0.0.1.00000000}.{69B12C57-567E-4358-89CA-F9A107987B58}
    Class                : AudioEndpoint
    Driver KeyName       : {c166523c-fe0c-4a94-a586-f1a80cfbbf3e}\0014 (AUDIOENDPOINT_CLASS_UUID)

        ---------------- Connection Information ---------------
Connection Index         : 0x04 (Port 4)
Connection Status        : 0x01 (DeviceConnected)
Current Config Value     : 0x01 (Configuration 1)
Device Address           : 0x0E (14)
Is Hub                   : 0x00 (no)
Device Bus Speed         : 0x01 (Full-Speed)
Number Of Open Pipes     : 0x03 (3 pipes to data endpoints)
Pipe[0]                  : EndpointID=5  Direction=IN   ScheduleOffset=0  Type=Interrupt  wMaxPacketSize=0x8     bInterval=1   -> 196 Bits/ms = 24500 Bytes/s
Pipe[1]                  : EndpointID=4  Direction=OUT  ScheduleOffset=0  Type=Bulk       wMaxPacketSize=0x40    bInterval=0  
Pipe[2]                  : EndpointID=4  Direction=IN   ScheduleOffset=0  Type=Bulk       wMaxPacketSize=0x40    bInterval=0  
Data (HexDump)           : 04 00 00 00 12 01 10 01 00 00 00 40 4A 4C 55 41   ...........@JLUA
                           00 01 01 02 03 01 01 01 00 0E 00 03 00 00 00 01   ................
                           00 00 00 07 05 85 03 08 00 01 00 00 00 00 07 05   ................
                           04 02 40 00 00 00 00 00 00 07 05 84 02 40 00 00   ..@..........@..
                           00 00 00 00                                       ....

        --------------- Connection Information V2 -------------
Connection Index         : 0x04 (4)
Length                   : 0x10 (16 bytes)
SupportedUsbProtocols    : 0x03
 Usb110                  : 1 (yes, port supports USB 1.1)
 Usb200                  : 1 (yes, port supports USB 2.0)
 Usb300                  : 0 (no, port not supports USB 3.0)
 ReservedMBZ             : 0x00
Flags                    : 0x00
 DevIsOpAtSsOrHigher     : 0 (Device is not operating at SuperSpeed or higher)
 DevIsSsCapOrHigher      : 0 (Device is not SuperSpeed capable or higher)
 DevIsOpAtSsPlusOrHigher : 0 (Device is not operating at SuperSpeedPlus or higher)
 DevIsSsPlusCapOrHigher  : 0 (Device is not SuperSpeedPlus capable or higher)
 ReservedMBZ             : 0x00
Data (HexDump)           : 04 00 00 00 10 00 00 00 03 00 00 00 00 00 00 00   ................

    ---------------------- Device Descriptor ----------------------
bLength                  : 0x12 (18 bytes)
bDescriptorType          : 0x01 (Device Descriptor)
bcdUSB                   : 0x110 (USB Version 1.1)
bDeviceClass             : 0x00 (defined by the interface descriptors)
bDeviceSubClass          : 0x00
bDeviceProtocol          : 0x00
bMaxPacketSize0          : 0x40 (64 bytes)
idVendor                 : 0x4C4A (Unknown Vendor)
idProduct                : 0x4155
bcdDevice                : 0x0100
iManufacturer            : 0x01 (String Descriptor 1)
 Language 0x0409         : "Jieli Technology"
iProduct                 : 0x02 (String Descriptor 2)
 Language 0x0409         : "USB Composite Device"
iSerialNumber            : 0x03 (String Descriptor 3)
 Language 0x0409         : "CD60144330323333"
bNumConfigurations       : 0x01 (1 Configuration)
Data (HexDump)           : 12 01 10 01 00 00 00 40 4A 4C 55 41 00 01 01 02   .......@JLUA....
                           03 01                                             ..

    ------------------ Configuration Descriptor -------------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x02 (Configuration Descriptor)
wTotalLength             : 0x0119 (281 bytes)
bNumInterfaces           : 0x05 (5 Interfaces)
bConfigurationValue      : 0x01 (Configuration 1)
iConfiguration           : 0x00 (No String Descriptor)
bmAttributes             : 0x80
 D7: Reserved, set 1     : 0x01
 D6: Self Powered        : 0x00 (no)
 D5: Remote Wakeup       : 0x00 (no)
 D4..0: Reserved, set 0  : 0x00
MaxPower                 : 0x32 (100 mA)
Data (HexDump)           : 09 02 19 01 05 01 00 80 32 08 0B 00 02 02 02 01   ........2.......
                           00 09 04 00 00 01 02 02 01 00 05 24 00 10 01 05   ...........$....
                           24 01 03 01 04 24 02 02 05 24 06 00 01 07 05 85   $....$...$......
                           03 08 00 01 09 04 01 00 02 0A 00 00 00 07 05 04   ................
                           02 40 00 00 07 05 84 02 40 00 00 08 0B 02 03 01   .@......@.......
                           02 00 05 09 04 02 00 00 01 01 00 05 0A 24 01 00   .............$..
                           01 4E 00 02 03 04 0C 24 02 01 01 01 00 02 03 00   .N.....$........
                           00 00 0C 24 02 04 01 02 00 01 00 00 00 00 09 24   ...$...........$
                           03 03 01 03 00 08 00 09 24 03 06 01 01 02 07 00   ........$.......
                           07 24 05 08 01 02 00 07 24 05 07 01 05 00 0A 24   .$......$......$
                           06 02 01 01 01 02 02 00 09 24 06 05 04 01 43 00   .........$....C.
                           00 09 04 03 00 00 01 02 00 00 09 04 03 01 01 01   ................
                           02 00 00 07 24 01 01 01 01 00 0B 24 02 01 02 02   ....$......$....
                           10 01 80 BB 00 09 05 03 09 C0 00 01 00 00 07 25   ...............%
                           01 00 00 00 00 09 04 04 00 00 01 02 00 00 09 04   ................
                           04 01 01 01 02 00 00 07 24 01 06 01 01 00 0B 24   ........$......$
                           02 01 01 02 10 01 80 BB 00 09 05 83 05 60 00 01   .............`..
                           00 00 07 25 01 00 00 00 00                        ...%.....

        ------------------- IAD Descriptor --------------------
bLength                  : 0x08 (8 bytes)
bDescriptorType          : 0x0B (Interface Association Descriptor)
bFirstInterface          : 0x00 (Interface 0)
bInterfaceCount          : 0x02 (2 Interfaces)
bFunctionClass           : 0x02 (Communications and CDC Control)
bFunctionSubClass        : 0x02
bFunctionProtocol        : 0x01
iFunction                : 0x00 (No String Descriptor)
Data (HexDump)           : 08 0B 00 02 02 02 01 00                           ........

        ---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x00 (Interface 0)
bAlternateSetting        : 0x00
bNumEndpoints            : 0x01 (1 Endpoint)
bInterfaceClass          : 0x02 (Communications and CDC Control)
bInterfaceSubClass       : 0x02 (Abstract Control Model)
bInterfaceProtocol       : 0x01 (AT Commands defined by ITU-T V.250 etc)
iInterface               : 0x00 (No String Descriptor)
Data (HexDump)           : 09 04 00 00 01 02 02 01 00                        .........

        -------------- CDC Interface Descriptor ---------------
bFunctionLength          : 0x05 (5 bytes)
bDescriptorType          : 0x24 (Interface)
bDescriptorSubType       : 0x00 (Header Functional Descriptor)
bcdCDC                   : 0x110 (CDC Version 1.10)
Data (HexDump)           : 05 24 00 10 01                                    .$...

        -------------- CDC Interface Descriptor ---------------
bFunctionLength          : 0x05 (5 bytes)
bDescriptorType          : 0x24 (Interface)
bDescriptorSubType       : 0x01 (Call Management Functional Descriptor)
bmCapabilities           : 0x03
 D7..2                   : 0x00 (Reserved)
 D1                      : 0x01 (can send/receive call management information over a Data Class interface)
 D0                      : 0x01 (handles call management itself)
bDataInterface           : 0x01
Data (HexDump)           : 05 24 01 03 01                                    .$...

        -------------- CDC Interface Descriptor ---------------
bFunctionLength          : 0x04 (4 bytes)
bDescriptorType          : 0x24 (Interface)
bDescriptorSubType       : 0x02 (Abstract Control Management Functional Descriptor)
bmCapabilities           : 0x02
 D7..4                   : 0x00 (Reserved)
 D3                      : 0x00 (not supports the notification Network_Connection)
 D2                      : 0x00 (not supports the request Send_Break)
 D1                      : 0x01 (supports the request combination of Set_Line_Coding, Set_Control_Line_State, Get_Line_Coding, and the notification Serial_State)
 D0                      : 0x00 (not supports the request combination of Set_Comm_Feature, Clear_Comm_Feature, and Get_Comm_Feature)
Data (HexDump)           : 04 24 02 02                                       .$..

        -------------- CDC Interface Descriptor ---------------
bFunctionLength          : 0x05 (5 bytes)
bDescriptorType          : 0x24 (Interface)
bDescriptorSubType       : 0x06 (Union Functional Descriptor)
bControlInterface        : 0x00
bSubordinateInterface[0] : 0x01
Data (HexDump)           : 05 24 06 00 01                                    .$...

        ----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x85 (Direction=IN EndpointID=5)
bmAttributes             : 0x03 (TransferType=Interrupt)
wMaxPacketSize           : 0x0008 (8 bytes)
bInterval                : 0x01 (1 ms)
Data (HexDump)           : 07 05 85 03 08 00 01                              .......

        ---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x01 (Interface 1)
bAlternateSetting        : 0x00
bNumEndpoints            : 0x02 (2 Endpoints)
bInterfaceClass          : 0x0A (CDC-Data)
bInterfaceSubClass       : 0x00
bInterfaceProtocol       : 0x00
iInterface               : 0x00 (No String Descriptor)
Data (HexDump)           : 09 04 01 00 02 0A 00 00 00                        .........

        ----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x04 (Direction=OUT EndpointID=4)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0040 (64 bytes)
bInterval                : 0x00 (ignored)
Data (HexDump)           : 07 05 04 02 40 00 00                              ....@..

        ----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x84 (Direction=IN EndpointID=4)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0040 (64 bytes)
bInterval                : 0x00 (ignored)
Data (HexDump)           : 07 05 84 02 40 00 00                              ....@..

        ------------------- IAD Descriptor --------------------
bLength                  : 0x08 (8 bytes)
bDescriptorType          : 0x0B (Interface Association Descriptor)
bFirstInterface          : 0x02 (Interface 2)
bInterfaceCount          : 0x03 (3 Interfaces)
bFunctionClass           : 0x01 (Audio)
bFunctionSubClass        : 0x02 (Audio Streaming)
bFunctionProtocol        : 0x00
iFunction                : 0x05 (String Descriptor 5)
 Language 0x0409         : "USBAudio1.0"
Data (HexDump)           : 08 0B 02 03 01 02 00 05                           ........

        ---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x02 (Interface 2)
bAlternateSetting        : 0x00
bNumEndpoints            : 0x00 (Default Control Pipe only)
bInterfaceClass          : 0x01 (Audio)
bInterfaceSubClass       : 0x01 (Audio Control)
bInterfaceProtocol       : 0x00
iInterface               : 0x05 (String Descriptor 5)
 Language 0x0409         : "USBAudio1.0"
Data (HexDump)           : 09 04 02 00 00 01 01 00 05                        .........

        ------ Audio Control Interface Header Descriptor ------
bLength                  : 0x0A (10 bytes)
bDescriptorType          : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype       : 0x01 (Header)
bcdADC                   : 0x0100
wTotalLength             : 0x004E (78 bytes)
bInCollection            : 0x02
baInterfaceNr[1]         : 0x03
baInterfaceNr[2]         : 0x04
Data (HexDump)           : 0A 24 01 00 01 4E 00 02 03 04                     .$...N....

        ------- Audio Control Input Terminal Descriptor -------
bLength                  : 0x0C (12 bytes)
bDescriptorType          : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype       : 0x02 (Input Terminal)
bTerminalID              : 0x01
wTerminalType            : 0x0101 (USB Streaming)
bAssocTerminal           : 0x00
bNrChannels              : 0x02 (2 channels)
wChannelConfig           : 0x0003 (L, R)
iChannelNames            : 0x00 (No String Descriptor)
iTerminal                : 0x00 (No String Descriptor)
Data (HexDump)           : 0C 24 02 01 01 01 00 02 03 00 00 00               .$..........

        ------- Audio Control Input Terminal Descriptor -------
bLength                  : 0x0C (12 bytes)
bDescriptorType          : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype       : 0x02 (Input Terminal)
bTerminalID              : 0x04
wTerminalType            : 0x0201 (Microphone)
bAssocTerminal           : 0x00
bNrChannels              : 0x01 (1 channel)
wChannelConfig           : 0x0000 (-)
iChannelNames            : 0x00 (No String Descriptor)
iTerminal                : 0x00 (No String Descriptor)
Data (HexDump)           : 0C 24 02 04 01 02 00 01 00 00 00 00               .$..........

        ------- Audio Control Output Terminal Descriptor ------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype       : 0x03 (Output Terminal)
bTerminalID              : 0x03
wTerminalType            : 0x0301 (Speaker)
bAssocTerminal           : 0x00 (0)
bSourceID                : 0x08 (8)
iTerminal                : 0x00 (No String Descriptor)
Data (HexDump)           : 09 24 03 03 01 03 00 08 00                        .$.......

        ------- Audio Control Output Terminal Descriptor ------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype       : 0x03 (Output Terminal)
bTerminalID              : 0x06
wTerminalType            : 0x0101 (USB Streaming)
bAssocTerminal           : 0x02 (2)
bSourceID                : 0x07 (7)
iTerminal                : 0x00 (No String Descriptor)
Data (HexDump)           : 09 24 03 06 01 01 02 07 00                        .$.......

        ------- Audio Control Selector Unit Descriptor --------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype       : 0x05 (Selector Unit)
bUnitID                  : 0x08
bNrInPins                : 0x01 (1 Input Pin)
baSourceID[1]            : 0x02 (2)
iSelector                : 0x00 (No String Descriptor)
Data (HexDump)           : 07 24 05 08 01 02 00                              .$.....

        ------- Audio Control Selector Unit Descriptor --------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype       : 0x05 (Selector Unit)
bUnitID                  : 0x07
bNrInPins                : 0x01 (1 Input Pin)
baSourceID[1]            : 0x05 (5)
iSelector                : 0x00 (No String Descriptor)
Data (HexDump)           : 07 24 05 07 01 05 00                              .$.....

        -------- Audio Control Feature Unit Descriptor --------
bLength                  : 0x0A (10 bytes)
bDescriptorType          : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype       : 0x06 (Feature Unit)
bUnitID                  : 0x02 (2)
bSourceID                : 0x01 (1)
bControlSize             : 0x01 (1 byte per control)
bmaControls[0]           : 0x01
 D0: Mute                : 1
 D1: Volume              : 0
 D2: Bass                : 0
 D3: Mid                 : 0
 D4: Treble              : 0
 D5: Graphic Equalizer   : 0
 D6: Automatic Gain      : 0
 D7: Delay               : 0
bmaControls[1]           : 0x02
 D0: Mute                : 0
 D1: Volume              : 1
 D2: Bass                : 0
 D3: Mid                 : 0
 D4: Treble              : 0
 D5: Graphic Equalizer   : 0
 D6: Automatic Gain      : 0
 D7: Delay               : 0
bmaControls[2]           : 0x02
 D0: Mute                : 0
 D1: Volume              : 1
 D2: Bass                : 0
 D3: Mid                 : 0
 D4: Treble              : 0
 D5: Graphic Equalizer   : 0
 D6: Automatic Gain      : 0
 D7: Delay               : 0
iFeature                 : 0x00 (No String Descriptor)
Data (HexDump)           : 0A 24 06 02 01 01 01 02 02 00                     .$........

        -------- Audio Control Feature Unit Descriptor --------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype       : 0x06 (Feature Unit)
bUnitID                  : 0x05 (5)
bSourceID                : 0x04 (4)
bControlSize             : 0x01 (1 byte per control)
bmaControls[0]           : 0x43
 D0: Mute                : 1
 D1: Volume              : 1
 D2: Bass                : 0
 D3: Mid                 : 0
 D4: Treble              : 0
 D5: Graphic Equalizer   : 0
 D6: Automatic Gain      : 1
 D7: Delay               : 0
bmaControls[1]           : 0x00
 D0: Mute                : 0
 D1: Volume              : 0
 D2: Bass                : 0
 D3: Mid                 : 0
 D4: Treble              : 0
 D5: Graphic Equalizer   : 0
 D6: Automatic Gain      : 0
 D7: Delay               : 0
iFeature                 : 0x00 (No String Descriptor)
Data (HexDump)           : 09 24 06 05 04 01 43 00 00                        .$....C..

        ---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x03 (Interface 3)
bAlternateSetting        : 0x00
bNumEndpoints            : 0x00 (Default Control Pipe only)
bInterfaceClass          : 0x01 (Audio)
bInterfaceSubClass       : 0x02 (Audio Streaming)
bInterfaceProtocol       : 0x00
iInterface               : 0x00 (No String Descriptor)
Data (HexDump)           : 09 04 03 00 00 01 02 00 00                        .........

        ---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x03 (Interface 3)
bAlternateSetting        : 0x01
bNumEndpoints            : 0x01 (1 Endpoint)
bInterfaceClass          : 0x01 (Audio)
bInterfaceSubClass       : 0x02 (Audio Streaming)
bInterfaceProtocol       : 0x00
iInterface               : 0x00 (No String Descriptor)
Data (HexDump)           : 09 04 03 01 01 01 02 00 00                        .........

        -------- Audio Streaming Interface Descriptor ---------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype       : 0x01 (AS_GENERAL)
bTerminalLink            : 0x01 (Terminal ID 1)
bDelay                   : 0x01 (1 frame)
wFormatTag               : 0x0001 (PCM)
Data (HexDump)           : 07 24 01 01 01 01 00                              .$.....

        ------- Audio Streaming Format Type Descriptor --------
bLength                  : 0x0B (11 bytes)
bDescriptorType          : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype       : 0x02 (Format Type)
bFormatType              : 0x01 (FORMAT_TYPE_I)
bNrChannels              : 0x02 (2 channels)
bSubframeSize            : 0x02 (2 bytes per subframe)
bBitResolution           : 0x10 (16 bits per sample)
bSamFreqType             : 0x01 (supports 1 sample frequence)
tSamFreq[1]              : 0x0BB80 (48000 Hz)
Data (HexDump)           : 0B 24 02 01 02 02 10 01 80 BB 00                  .$.........

        ----------------- Endpoint Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x03 (Direction=OUT EndpointID=3)
bmAttributes             : 0x09 (TransferType=Isochronous  SyncType=Adaptive  EndpointType=Data)
wMaxPacketSize           : 0x00C0 (192 bytes)
bInterval                : 0x01 (1 ms)
bRefresh                 : 0x00
bSynchAddress            : 0x00
Data (HexDump)           : 09 05 03 09 C0 00 01 00 00                        .........

        ----------- Audio Data Endpoint Descriptor ------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x25 (Audio Endpoint Descriptor)
bDescriptorSubtype       : 0x01 (General)
bmAttributes             : 0x00
 D0   : Sampling Freq    : 0x00 (not supported)
 D1   : Pitch            : 0x00 (not supported)
 D6..2: Reserved         : 0x00
 D7   : MaxPacketsOnly   : 0x00 (no)
bLockDelayUnits          : 0x00 (Undefined)
wLockDelay               : 0x0000
Data (HexDump)           : 07 25 01 00 00 00 00                              .%.....

        ---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x04 (Interface 4)
bAlternateSetting        : 0x00
bNumEndpoints            : 0x00 (Default Control Pipe only)
bInterfaceClass          : 0x01 (Audio)
bInterfaceSubClass       : 0x02 (Audio Streaming)
bInterfaceProtocol       : 0x00
iInterface               : 0x00 (No String Descriptor)
Data (HexDump)           : 09 04 04 00 00 01 02 00 00                        .........

        ---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x04 (Interface 4)
bAlternateSetting        : 0x01
bNumEndpoints            : 0x01 (1 Endpoint)
bInterfaceClass          : 0x01 (Audio)
bInterfaceSubClass       : 0x02 (Audio Streaming)
bInterfaceProtocol       : 0x00
iInterface               : 0x00 (No String Descriptor)
Data (HexDump)           : 09 04 04 01 01 01 02 00 00                        .........

        -------- Audio Streaming Interface Descriptor ---------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype       : 0x01 (AS_GENERAL)
bTerminalLink            : 0x06 (Terminal ID 6)
bDelay                   : 0x01 (1 frame)
wFormatTag               : 0x0001 (PCM)
Data (HexDump)           : 07 24 01 06 01 01 00                              .$.....

        ------- Audio Streaming Format Type Descriptor --------
bLength                  : 0x0B (11 bytes)
bDescriptorType          : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype       : 0x02 (Format Type)
bFormatType              : 0x01 (FORMAT_TYPE_I)
bNrChannels              : 0x01 (1 channel)
bSubframeSize            : 0x02 (2 bytes per subframe)
bBitResolution           : 0x10 (16 bits per sample)
bSamFreqType             : 0x01 (supports 1 sample frequence)
tSamFreq[1]              : 0x0BB80 (48000 Hz)
Data (HexDump)           : 0B 24 02 01 01 02 10 01 80 BB 00                  .$.........

        ----------------- Endpoint Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x83 (Direction=IN EndpointID=3)
bmAttributes             : 0x05 (TransferType=Isochronous  SyncType=Asynchronous  EndpointType=Data)
wMaxPacketSize           : 0x0060 (96 bytes)
bInterval                : 0x01 (1 ms)
bRefresh                 : 0x00
bSynchAddress            : 0x00
Data (HexDump)           : 09 05 83 05 60 00 01 00 00                        ....`....

        ----------- Audio Data Endpoint Descriptor ------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x25 (Audio Endpoint Descriptor)
bDescriptorSubtype       : 0x01 (General)
bmAttributes             : 0x00
 D0   : Sampling Freq    : 0x00 (not supported)
 D1   : Pitch            : 0x00 (not supported)
 D6..2: Reserved         : 0x00
 D7   : MaxPacketsOnly   : 0x00 (no)
bLockDelayUnits          : 0x00 (Undefined)
wLockDelay               : 0x0000
Data (HexDump)           : 07 25 01 00 00 00 00                              .%.....

      -------------------- String Descriptors -------------------
             ------ String Descriptor 0 ------
bLength                  : 0x04 (4 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language ID[0]           : 0x0409 (English - United States)
Data (HexDump)           : 04 03 09 04                                       ....
             ------ String Descriptor 1 ------
bLength                  : 0x22 (34 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "Jieli Technology"
Data (HexDump)           : 22 03 4A 00 69 00 65 00 6C 00 69 00 20 00 54 00   ".J.i.e.l.i. .T.
                           65 00 63 00 68 00 6E 00 6F 00 6C 00 6F 00 67 00   e.c.h.n.o.l.o.g.
                           79 00                                             y.
             ------ String Descriptor 2 ------
bLength                  : 0x2A (42 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "USB Composite Device"
Data (HexDump)           : 2A 03 55 00 53 00 42 00 20 00 43 00 6F 00 6D 00   *.U.S.B. .C.o.m.
                           70 00 6F 00 73 00 69 00 74 00 65 00 20 00 44 00   p.o.s.i.t.e. .D.
                           65 00 76 00 69 00 63 00 65 00                     e.v.i.c.e.
             ------ String Descriptor 3 ------
bLength                  : 0x22 (34 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "CD60144330323333"
Data (HexDump)           : 22 03 43 00 44 00 36 00 30 00 31 00 34 00 34 00   ".C.D.6.0.1.4.4.
                           33 00 33 00 30 00 33 00 32 00 33 00 33 00 33 00   3.3.0.3.2.3.3.3.
                           33 00                                             3.
             ------ String Descriptor 5 ------
bLength                  : 0x18 (24 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "USBAudio1.0"
Data (HexDump)           : 18 03 55 00 53 00 42 00 41 00 75 00 64 00 69 00   ..U.S.B.A.u.d.i.
                           6F 00 31 00 2E 00 30 00                           o.1...0.
kai-morich commented 1 year ago

please try with:

mControlIndex = usbInterface.getId();

instead of

mControlIndex = i;

So far I have seen only devices with both numbers being identical, but maybe the other is correct.

lloovve commented 1 year ago

thanks ,problem has been solved

if (usbInterface.getInterfaceClass() == UsbConstants.USB_CLASS_COMM) {
                    if(controlInterfaceCount == mPortNumber) {
                        //mControlIndex = i;
                        mControlIndex = usbInterface.getId();
                        mControlInterface = usbInterface;
                    }
                    controlInterfaceCount++;
                }