USB: Host aborts communication within or directly after enumeration Topic is solved

Sub forums for various specialist XMOS applications. e.g. USB audio, motor control and robotics.
User avatar
dsteinwe
XCore Addict
Posts: 144
Joined: Wed Jun 29, 2016 8:59 am

Post by dsteinwe »

Hi Tim,
the linux kernel log looks fine.

I recommend you to disable pulseaudio, because it modifies the audio system in my opion too heavy for development. I disable pulseaudio with these cmds (dont use sudo):

Code: Select all

systemctl --user stop pulseaudio.socket;
systemctl --user stop pulseaudio.service
After it, you can use aplay to introspect your sound card (aplay -l and aplay -L). When you playback (i.e. with audacious) you should select the alsa device with all conversion, because it simplifies your life.

You should also install alsamixer. Then you can test the control ep, if it already works fine. After it, I recommend you to verify the streaming.

Currently I'm not able to parse your descriptor, because I refactor the parser heavily. Give some time to refactor it ...
View Solution
friguly
Junior Member
Posts: 6
Joined: Fri Jun 24, 2022 7:13 am

Post by friguly »

Thanks for your advice, @dsteinwe.
The pulseaudio services are not running on my system. I use pipewire and installed a plugin to handle pulseaudio clients: https://wiki.archlinux.org/title/PipeWi ... io_clients

Using Alsamixer to check some controls is a great idea! Currently, I don't have any controls like volume, frequency or different channels etc. Therefore I think I can't apply it to this device. But I'll certainly keep it in mind for the next project :D

Currently, I have an Isochronous IN and OUT stream which does nothing really, because the implementation behind it is not done yet. I testet it with piping audio from youtube to the device and just piping the IN Stream to any audio sink. But aplay gives me much more flexibility!

My current Descriptor is as follows:

Code: Select all

❯ lsusb -d 20b1:000b -v
Bus 003 Device 015: ID 20b1:000b XMOS Ltd TEST Device
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2 
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0x20b1 XMOS Ltd
  idProduct          0x000b 
  bcdDevice            1.00
  iManufacturer           2 TestManufactuere
  iProduct                3 TEST Device
  iSerial                 4 0 0 11
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x00d3
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         0
      bInterfaceCount         3
      bFunctionClass          1 Audio
      bFunctionSubClass       0 
      bFunctionProtocol      32 
      iFunction               5 Audio Function
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      1 Control Device
      bInterfaceProtocol     32 
      iInterface              6 CTRL IF DESC
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               2.00
        bCategory               8
        wTotalLength       0x004b
        bmControls           0x00
      AudioControl Interface Descriptor:
        bLength                 8
        bDescriptorType        36
        bDescriptorSubtype     10 (CLOCK_SOURCE)
        bClockID               41
        bmAttributes            0 External clock 
        bmControls           0x01
          Clock Frequency Control (read-only)
        bAssocTerminal          0
        iClockSource            7 ClOcK SoUrCe
      AudioControl Interface Descriptor:
        bLength                17
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             2
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          0
        bCSourceID             41
        bNrChannels             2
        bmChannelConfig    0x00000003
          Front Left (FL)
          Front Right (FR)
        iChannelNames           0 
        bmControls         0x0000
        iTerminal               8 From host
      AudioControl Interface Descriptor:
        bLength                17
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             3
        wTerminalType      0x0200 Input Undefined
        bAssocTerminal          0
        bCSourceID             41
        bNrChannels             2
        bmChannelConfig    0x00000003
          Front Left (FL)
          Front Right (FR)
        iChannelNames           0 
        bmControls         0x0000
        iTerminal               9 From tdm
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID            20
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          0
        bSourceID               3
        bCSourceID             41
        bmControls         0x0000
        iTerminal              10 TOOOO HOOOOST
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID            21
        wTerminalType      0x0301 Speaker
        bAssocTerminal          0
        bSourceID               2
        bCSourceID             41
        bmControls         0x0000
        iTerminal              11 TOOOO DAAAAC
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol     32 
      iInterface             13 Nothing to see here
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol     32 
      iInterface             14 Here comes the action
      AudioStreaming Interface Descriptor:
        bLength                16
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink           2
        bmControls           0x00
        bFormatType             1
        bmFormats          0x00000001
          PCM
        bNrChannels             2
        bmChannelConfig    0x00000003
          Front Left (FL)
          Front Right (FR)
        iChannelNames           0 
      AudioStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bSubslotSize            4
        bBitResolution         32
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x00c0  1x 192 bytes
        bInterval               2
        AudioStreaming Endpoint Descriptor:
          bLength                 8
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x00
          bmControls           0x00
          bLockDelayUnits         2 Decoded PCM samples
          wLockDelay         0x0008
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol     32 
      iInterface             15 Also nothing to see here
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol     32 
      iInterface             16 Here goes the action...
      AudioStreaming Interface Descriptor:
        bLength                16
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink          20
        bmControls           0x00
        bFormatType             1
        bmFormats          0x00000001
          PCM
        bNrChannels             2
        bmChannelConfig    0x00000003
          Front Left (FL)
          Front Right (FR)
        iChannelNames           0 
      AudioStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bSubslotSize            4
        bBitResolution         32
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x00c0  1x 192 bytes
        bInterval               1
        AudioStreaming Endpoint Descriptor:
          bLength                 8
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x00
          bmControls           0x00
          bLockDelayUnits         2 Decoded PCM samples
          wLockDelay         0x0008
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2 
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0000
  (Bus Powered)

Code: Select all

Device Desc:
0x12, 0x01, 0x00, 0x02, 0xef, 0x02, 0x01, 0x40,  0xb1, 0x20,
0x0b, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x01

Config Desc:
0x09, 0x02, 0xd3, 0x00, 0x03, 0x01, 0x00, 0x80, 0xfa, 0x08,
0x0b, 0x00, 0x03, 0x01, 0x00, 0x20, 0x05, 0x09, 0x04, 0x00,
0x00, 0x00, 0x01, 0x01, 0x20, 0x06, 0x09, 0x24, 0x01, 0x00,
0x02, 0x08, 0x4b, 0x00, 0x00, 0x08, 0x24, 0x0a, 0x29, 0x00,
0x01, 0x00, 0x07, 0x11, 0x24, 0x02, 0x02, 0x01, 0x01, 0x00,
0x29, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
0x11, 0x24, 0x02, 0x03, 0x00, 0x02, 0x00, 0x29, 0x02, 0x03,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x0c, 0x24, 0x03,
0x14, 0x01, 0x01, 0x00, 0x03, 0x29, 0x00, 0x00, 0x0a, 0x0c,
0x24, 0x03, 0x15, 0x01, 0x03, 0x00, 0x02, 0x29, 0x00, 0x00,
0x0b, 0x09, 0x04, 0x01, 0x00, 0x00, 0x01, 0x02, 0x20, 0x0d,
0x09, 0x04, 0x01, 0x01, 0x01, 0x01, 0x02, 0x20, 0x0e, 0x10,
0x24, 0x01, 0x02, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x02,
0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0x24, 0x02, 0x01, 0x04,
0x20, 0x07, 0x05, 0x01, 0x05, 0xc0, 0x00, 0x02, 0x08, 0x25,
0x01, 0x00, 0x00, 0x02, 0x08, 0x00, 0x09, 0x04, 0x02, 0x00,
0x00, 0x01, 0x02, 0x20, 0x0f, 0x09, 0x04, 0x02, 0x01, 0x01,
0x01, 0x02, 0x20, 0x10, 0x10, 0x24, 0x01, 0x14, 0x00, 0x01,
0x01, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00,
0x06, 0x24, 0x02, 0x01, 0x04, 0x20, 0x07, 0x05, 0x81, 0x05,
0xc0, 0x00, 0x01, 0x08, 0x25, 0x01, 0x00, 0x00, 0x02, 0x08,
0x00
With this, I pretty much have what I wanted and simply have to implement the data streams (and perhaps some control requests). A wireshark file is attached to visualize the traffic from and to the device.

I think I can close this thread now since further problems would be too much off-topic :)
Thank you very much for your help @dsteinwe. Your comments helped me a lot!
You do not have the required permissions to view the files attached to this post.
User avatar
dsteinwe
XCore Addict
Posts: 144
Joined: Wed Jun 29, 2016 8:59 am

Post by dsteinwe »

Thanks for the flowers!