[alsa-devel] usb: Endpoints sharing the same interface

Mark Hills mark at xwax.org
Sun Mar 3 18:53:53 CET 2013


Novation Twitch [1] is a USB device with audio capture and playback 
endpoints on the same bInterfaceNumber.

This has thrown up some tricky cases in the USB audio driver, and I'd 
appreciate some advice.

I'll follow up with my patches so far as an RFC.

This device has endpoints for 2 channels capture (0x01), 4 channels 
playback (0x82), both on interface #0. Interface #1 is raw MIDI.

I seem to be finding code that assumes pcm to always use the first 
endpoint on an interface. eg. problems with maxpacksize (see patch in 
thread)

Now I'm in a position where playback _or_ capture works reliably. But to 
start capture stops playback, and vice-versa (or sometimes causes hangs)

It seems like snd_pcm_prepare() concludes that need_setup_ep is required, 
but I think this may be based on something going on in 
set_sample_rate_v1() also looking to the first endpoint -- 
usb_sndctrlpipe(dev,0).

Before I do any more work on this, are there any hints where to go with 
this?

If we can overcome thse limitations then the same would likely apply to 
Saffire 6 USB and other Focusrite devices [2], and maybe some of the other 
devices with quirks that only support playback.

Many thanks

[1] http://uk.novationmusic.com/digital-dj/twitch/
[2] http://focusritedevelopmentteam.wordpress.com/category/drivers/

-- 
Mark


---
Bus 005 Device 010: ID 1235:0018 Novation EMS 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x1235 Novation EMS
  idProduct          0x0018 
  bcdDevice            1.00
  iManufacturer           1 Focusrite A.E. Ltd
  iProduct                2 Twitch
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           64
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              498mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       1
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x024c  1x 588 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0126  1x 294 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               1
Device Status:     0x0000
  (Bus Powered)


More information about the Alsa-devel mailing list