public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* USB audio device - ABIT UA11 dual toslink I/O
@ 2002-04-09  0:50 Sam Vilain
  2002-04-09 18:49 ` Thomas Sailer
  0 siblings, 1 reply; 3+ messages in thread
From: Sam Vilain @ 2002-04-09  0:50 UTC (permalink / raw)
  To: Alan Cox, Thomas Sailer; +Cc: linux-kernel

Hi all,

I've just bought a low cost USB audio device.  For about £45 the
device sports two optical SPDIF (=toslink) connectors (one in, one
out) clocking at 32kHz, 44.1kHz or 48kHz.  According to the specs it's
USB 1.1 and USB audio 1.1 compliant.  It is assembled and branded by
ABIT, model UA-11, the "i/Optica".

The audio module loads with these messages:
usb.c: registered new driver audio
usbaudio: device 2 audiocontrol interface 0 has 1 input and 1 output AudioStreaming interfaces
usbaudio: valid input sample rate 48000
usbaudio: valid input sample rate 32000
usbaudio: valid input sample rate 44100
usbaudio: device 2 interface 2 altsetting 1: format 0x00000010 sratelo 32000 sratehi 48000 attributes 0x01
usbaudio: valid input sample rate 48000
usbaudio: valid input sample rate 32000
usbaudio: valid input sample rate 44100
usbaudio: device 2 interface 2 altsetting 2: format 0x80000010 sratelo 32000 sratehi 48000 attributes 0x01
usbaudio: device 2 interface 1 altsetting 0 does not have an endpoint
usbaudio: valid output sample rate 48000
usbaudio: valid output sample rate 32000
usbaudio: valid output sample rate 44100
usbaudio: device 2 interface 1 altsetting 1: format 0x00000010 sratelo 32000 sratehi 48000 attributes 0x01
usbaudio: valid output sample rate 48000
usbaudio: valid output sample rate 32000
usbaudio: valid output sample rate 44100
usbaudio: device 2 interface 1 altsetting 2: format 0x80000010 sratelo 32000 sratehi 48000 attributes 0x01
usbaudio: registered dsp 14,19
usbaudio: constructing mixer for Terminal 10 type 0x0301
usbaudio: unit 8: invalid PROCESSING_UNIT descriptor
usbaudio: feature unit 9 source has no channels
usbaudio: no mixer controls found for Terminal 10
usbaudio: constructing mixer for Terminal 13 type 0x0101
usbaudio: selector unit 11: ignoring channel 1
usbaudio: selector unit 11: input pins with varying channel numbers
usbaudio: feature unit 12 source has no channels
usbaudio: no mixer controls found for Terminal 13
usb_audio_parsecontrol: usb_audio_state at d2bb6480
audio.c: v1.0.0:USB Audio Class driver
usb.c: registered new driver hiddev
usb.c: registered new driver hid
input0: USB HID v1.00 Pointer [KC Technology, Inc. KC USB Audio Device] on usb1:2.3
hid-core.c: v1.8 Andreas Gal, Vojtech Pavlik <vojtech@suse.cz>
hid-core.c: USB HID support drivers

The output from `lsusb' is a monster:

Bus 001 Device 001: ID 0000:0000 Virtual Hub
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.00
  bDeviceClass            9 Hub
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x0000 Virtual
  idProduct          0x0000 Hub
  bcdDevice            0.00
  iManufacturer           0 
  iProduct                2 USB UHCI-alt Root Hub
  iSerial                 1 cce0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           25
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x40
      Self Powered
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         9 Hub
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               none
        wMaxPacketSize          8
        bInterval             255
  Language IDs: (length=4)
     0000 (null)((null))

Bus 001 Device 002: ID 050f:2178 KC Technology Inc. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 Interface
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x050f KC Technology Inc.
  idProduct          0x2178 
  bcdDevice            1.00
  iManufacturer           1 KC Technology, Inc.
  iProduct                2 KC USB Audio Device
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          421
    bNumInterfaces          4
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
    MaxPower              300mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      1 Control Device
      bInterfaceProtocol      0 
      iInterface              0 
      AudioControl Interface Descriptor:
        bLength                10
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength          164
        bInCollection           2
        baInterfaceNr( 0)       1
        baInterfaceNr( 1)       2
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             1
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          0
        bNrChannels             2
        wChannelConfig     0x0003
          Left Front (L)
          Right Front (R)
        iChannelNames           0 
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             2
        wTerminalType      0x0603 Line Connector
        bAssocTerminal          0
        bNrChannels             2
        wChannelConfig     0x0003
          Left Front (L)
          Right Front (R)
        iChannelNames           0 
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             3
        wTerminalType      0x0201 Microphone
        bAssocTerminal          0
        bNrChannels             1
        wChannelConfig     0x0001
          Left Front (L)
        iChannelNames           0 
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID            10
        wTerminalType      0x0301 Speaker
        bAssocTerminal          0
        bSourceID               9
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID            13
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          0
        bSourceID              12
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                14
        bDescriptorType        36
        bDescriptorSubtype      4 (MIXER_UNIT)
        bUnitID                 7
        bNrInPins               3
        baSourceID( 0)          4
        baSourceID( 1)          5
        baSourceID( 2)          6
        bNrChannels             2
        wChannelConfig     0x0003
          Left Front (L)
          Right Front (R)
        iChannelNames           0 
        bmControls         0x00
        iMixer                  0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      5 (SELECTOR_UNIT)
        bUnitID                11
        bNrInPins               3
        baSource( 0)            2
        baSource( 1)            3
        baSource( 2)            7
        iSelector               0 
      AudioControl Interface Descriptor:
        bLength                13
        bDescriptorType        36
        bDescriptorSubtype      6 (FEATURE_UNIT)
        bUnitID                 4
        bSourceID               1
        bControlSize            2
        bmaControls( 0)      0x01
        bmaControls( 1)      0x00
          Mute
        bmaControls( 0)      0x02
        bmaControls( 1)      0x00
          Volume
        bmaControls( 0)      0x02
        bmaControls( 1)      0x00
          Volume
        iFeature                0 
      AudioControl Interface Descriptor:
        bLength                13
        bDescriptorType        36
        bDescriptorSubtype      6 (FEATURE_UNIT)
        bUnitID                 5
        bSourceID               2
        bControlSize            2
        bmaControls( 0)      0x01
        bmaControls( 1)      0x00
          Mute
        bmaControls( 0)      0x02
        bmaControls( 1)      0x00
          Volume
        bmaControls( 0)      0x02
        bmaControls( 1)      0x00
          Volume
        iFeature                0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      6 (FEATURE_UNIT)
        bUnitID                 6
        bSourceID               3
        bControlSize            2
        bmaControls( 0)      0x43
        bmaControls( 1)      0x00
          Mute
          Volume
          Automatic Gain
        iFeature                0 
      AudioControl Interface Descriptor:
        bLength                13
        bDescriptorType        36
        bDescriptorSubtype      6 (FEATURE_UNIT)
        bUnitID                 9
        bSourceID               8
        bControlSize            2
        bmaControls( 0)      0x01
        bmaControls( 1)      0x00
          Mute
        bmaControls( 0)      0x02
        bmaControls( 1)      0x00
          Volume
        bmaControls( 0)      0x02
        bmaControls( 1)      0x00
          Volume
        iFeature                0 
      AudioControl Interface Descriptor:
        bLength                13
        bDescriptorType        36
        bDescriptorSubtype      6 (FEATURE_UNIT)
        bUnitID                12
        bSourceID              11
        bControlSize            2
        bmaControls( 0)      0x01
        bmaControls( 1)      0x00
          Mute
        bmaControls( 0)      0x02
        bmaControls( 1)      0x00
          Volume
        bmaControls( 0)      0x02
        bmaControls( 1)      0x00
          Volume
        iFeature                0 
      AudioControl Interface Descriptor:
        bLength                16
        bDescriptorType        36
        bDescriptorSubtype      7 (PROCESSING_UNIT)
        bUnitID                 8
        wProcessType            3
        bNrPins                 1
        baSourceID( 0)          7
        bNrChannels             2
        wChannelConfig     0x0003
          Left Front (L)
          Right Front (R)
        iChannelNames           0 
        bControlSize            2
        bmControls( 0)       0x03
        bmControls( 1)       0x00
          Enable Processing
        iProcessing             0 
        Process-Specific    
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      AudioControl Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink           1
        bDelay                  1 frames
        wFormatTag              1 PCM
      AudioControl Interface Descriptor:
        bLength                17
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             1
        bSubframeSize           2
        bBitResolution         16
        bSamFreqType            3 Discrete
        tSamFreq[ 0]        48000
        tSamFreq[ 1]        44100
        tSamFreq[ 2]        32000
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            9
          Transfer Type            Isochronous
          Synch Type               Adaptive
        wMaxPacketSize        104
        bInterval               1
        bRefresh                0
        bSynchAddress           0
        AudioControl Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x01
            Sampling Frequency
          bLockDelayUnits         2 Decoded PCM samples
          wLockDelay            512 Decoded PCM samples
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       2
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      AudioControl Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink           1
        bDelay                  1 frames
        wFormatTag              1 PCM
      AudioControl Interface Descriptor:
        bLength                17
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             2
        bSubframeSize           2
        bBitResolution         16
        bSamFreqType            3 Discrete
        tSamFreq[ 0]        48000
        tSamFreq[ 1]        44100
        tSamFreq[ 2]        32000
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            9
          Transfer Type            Isochronous
          Synch Type               Adaptive
        wMaxPacketSize        208
        bInterval               1
        bRefresh                0
        bSynchAddress           0
        AudioControl Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x01
            Sampling Frequency
          bLockDelayUnits         2 Decoded PCM samples
          wLockDelay            512 Decoded PCM samples
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      AudioControl Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink          13
        bDelay                  1 frames
        wFormatTag              1 PCM
      AudioControl Interface Descriptor:
        bLength                17
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             1
        bSubframeSize           2
        bBitResolution         16
        bSamFreqType            3 Discrete
        tSamFreq[ 0]        48000
        tSamFreq[ 1]        44100
        tSamFreq[ 2]        32000
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
        wMaxPacketSize        104
        bInterval               1
        bRefresh                0
        bSynchAddress           0
        AudioControl Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x01
            Sampling Frequency
          bLockDelayUnits         2 Decoded PCM samples
          wLockDelay              0 Decoded PCM samples
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       2
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      AudioControl Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink          13
        bDelay                  1 frames
        wFormatTag              1 PCM
      AudioControl Interface Descriptor:
        bLength                17
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             2
        bSubframeSize           2
        bBitResolution         16
        bSamFreqType            3 Discrete
        tSamFreq[ 0]        48000
        tSamFreq[ 1]        44100
        tSamFreq[ 2]        32000
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
        wMaxPacketSize        208
        bInterval               1
        bRefresh                0
        bSynchAddress           0
        AudioControl Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x01
            Sampling Frequency
          bLockDelayUnits         2 Decoded PCM samples
          wLockDelay              0 Decoded PCM samples
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Devices
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.00
          bCountryCode            0
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength     152
cannot get report descriptor
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               none
        wMaxPacketSize          8
        bInterval              48
  Language IDs: (length=4)
     0409 English(US)

Here's some strace() output from sox:

[pid  1892] open("/dev/dsp1", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
[pid  1892] fstat64(4, {st_mode=S_IFCHR|0660, st_rdev=makedev(14, 19), ...}) = 0
[pid  1892] ioctl(4, SNDCTL_TMR_TIMEBASE, 0xbffffaa8) = -1 ENOIOCTLCMD (errno 515)
[pid  1892] old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40017000
[pid  1892] fstat64(4, {st_mode=S_IFCHR|0660, st_rdev=makedev(14, 19), ...}) = 0
[pid  1892] ioctl(4, SNDCTL_DSP_RESET, 0) = 0
[pid  1892] ioctl(4, SNDCTL_DSP_SYNC, 0) = 0
[pid  1892] ioctl(4, SNDCTL_DSP_GETFMTS, 0xbffffc04) = 0
[pid  1892] ioctl(4, SOUND_PCM_READ_BITS, 0xbffffc04) = 0
[pid  1892] ioctl(4, SNDCTL_DSP_STEREO, 0xbffffc04) = 0
[pid  1892] ioctl(4, SOUND_PCM_READ_RATE, 0xbffffc04) = 0
[pid  1892] write(2, "sox: ", 5sox: )        = 5
[pid  1892] write(2, "Unable to set audio speed to 441"..., 45Unable to set audio speed to 44100 (set to 0)) = 45
[pid  1892] write(2, "\n", 1
)           = 1
[pid  1892] ioctl(4, SNDCTL_DSP_GETBLKSIZE, 0x80a52f0) = 0
[pid  1892] munmap(0x40017000, 4096)    = 0
[pid  1892] write(2, "sox: ", 5sox: )        = 5
[pid  1892] write(2, "bad output format", 17bad output format) = 17
[pid  1892] write(2, "\n", 1
)           = 1
[pid  1892] close(3)                    = 0
[pid  1892] munmap(0x40016000, 4096)    = 0
[pid  1892] close(4)                    = 0

`dd if=/dev/zero of=/dev/dsp1' writes about 256k before writes block.

`mpg123 -a /dev/dsp1 mymp3.mp3' is doing this:

open("/dev/dsp1", O_WRONLY)             = 3
ioctl(3, SNDCTL_DSP_GETBLKSIZE, 0x806e5a0) = 0
ioctl(3, SNDCTL_DSP_RESET, 0)           = 0
ioctl(3, SOUND_PCM_READ_BITS, 0xbffffab0) = -1 EINVAL (Invalid argument)
ioctl(3, SOUND_PCM_READ_BITS, 0xbffffab0) = 0
ioctl(3, SNDCTL_DSP_STEREO, 0xbffffaac) = 0
ioctl(3, SOUND_PCM_READ_RATE, 0xbffffaa8) = 0
ioctl(3, SOUND_PCM_READ_BITS, 0xbffffab0) = 0
ioctl(3, SNDCTL_DSP_STEREO, 0xbffffaac) = 0
ioctl(3, SOUND_PCM_READ_RATE, 0xbffffaa8) = 0
ioctl(3, SOUND_PCM_READ_BITS, 0xbffffab0) = 0
ioctl(3, SNDCTL_DSP_STEREO, 0xbffffaac) = 0
ioctl(3, SOUND_PCM_READ_RATE, 0xbffffaa8) = 0
ioctl(3, SOUND_PCM_READ_BITS, 0xbffffab0) = 0
<snip>
ioctl(3, SNDCTL_DSP_STEREO, 0xbffffaac) = 0
ioctl(3, SOUND_PCM_READ_RATE, 0xbffffaa8) = 0
ioctl(3, SOUND_PCM_READ_BITS, 0xbffffab0) = -1 EINVAL (Invalid argument)
close(3)                                = 0

As for the actual board inside the grey plastic case, it has two tiny
ICs on it - one is labelled "KC2178P", the other "XWM9707" + "16ADAU2"

So, what do you think?  Start reading at
http://www.usb.org/developers/data/devclass/audio10.pdf, or is there
an easy solution to this?  Perhaps some information on deciphering the
output of `lsusb'?

FWIW it works perfectly under Windows with no (advertised) special
support by the Windows USB audio driver.
--
   Sam Vilain, sam@vilain.net     WWW: http://sam.vilain.net/
    7D74 2A09 B2D3 C30F F78E      GPG: http://sam.vilain.net/sam.asc
    278A A425 30A9 05B5 2F13

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: USB audio device - ABIT UA11 dual toslink I/O
  2002-04-09  0:50 USB audio device - ABIT UA11 dual toslink I/O Sam Vilain
@ 2002-04-09 18:49 ` Thomas Sailer
  2002-04-14 11:14   ` Sam Vilain
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Sailer @ 2002-04-09 18:49 UTC (permalink / raw)
  To: Sam Vilain; +Cc: Alan Cox, Thomas Sailer, linux-kernel

Sam Vilain wrote:

> usbaudio: unit 8: invalid PROCESSING_UNIT descriptor

Aparently this is due to a superfluous test in the audiocontrol
parsing...

> [pid  1892] ioctl(4, SNDCTL_DSP_RESET, 0) = 0
> [pid  1892] ioctl(4, SNDCTL_DSP_SYNC, 0) = 0
> [pid  1892] ioctl(4, SNDCTL_DSP_GETFMTS, 0xbffffc04) = 0
> [pid  1892] ioctl(4, SOUND_PCM_READ_BITS, 0xbffffc04) = 0
> [pid  1892] ioctl(4, SNDCTL_DSP_STEREO, 0xbffffc04) = 0
> [pid  1892] ioctl(4, SOUND_PCM_READ_RATE, 0xbffffc04) = 0
> [pid  1892] write(2, "sox: ", 5sox: )        = 5
> [pid  1892] write(2, "Unable to set audio speed to 441"..., 45Unable to set audio speed to 44100 (set to 0)) = 45

Spooky. It doesn't even try to set the sampling rate but complains...
somehow cannot be...

> ioctl(3, SOUND_PCM_READ_BITS, 0xbffffab0) = -1 EINVAL (Invalid argument)

Again spooky, I don't see how audio.o ioctl handler could return EINVAL
at
that call. EFAULT yes, but EINVAL??

Tom

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: USB audio device - ABIT UA11 dual toslink I/O
  2002-04-09 18:49 ` Thomas Sailer
@ 2002-04-14 11:14   ` Sam Vilain
  0 siblings, 0 replies; 3+ messages in thread
From: Sam Vilain @ 2002-04-14 11:14 UTC (permalink / raw)
  To: t.sailer; +Cc: alan, linux-kernel

Thomas Sailer <sailer@scs.ch> wrote:

> > usbaudio: unit 8: invalid PROCESSING_UNIT descriptor
> Aparently this is due to a superfluous test in the audiocontrol
> parsing...

Would that be this test:

    case PROCESSING_UNIT:
	if (   p1[0] <  13
	   ||  p1[0] <   13 + p1[6] 
	   ||  p1[0] < 	  13 + p1[6] + p1[ 11 + p1[6] ]
	   ||  p1[0] <     13 + p1[6] + p1[ 11 + p1[6] ]
		      + p1[ 13 + p1[6] + p1[ 11 + p1[6] ] ] )
	{                       
	    printk(KERN_ERR "usbaudio: unit %u: invalid PROCESSING_UNIT"
		   "descriptor\n", unitid);
	    return;
        }
        usb_audio_processingunit(state, p1);
        return;

This relates to this section of `lsusb':

      AudioControl Interface Descriptor:
        bLength                16
        bDescriptorType        36
        bDescriptorSubtype      7 (PROCESSING_UNIT)
        bUnitID                 8
        wProcessType            3
        bNrPins                 1
        baSourceID( 0)          7
        bNrChannels             2
        wChannelConfig     0x0003
          Left Front (L)
          Right Front (R)
        iChannelNames           0 
        bControlSize            2
        bmControls( 0)       0x03
        bmControls( 1)       0x00
          Enable Processing
        iProcessing             0 
        Process-Specific    

I removed the last one of those || tests, because it was the only
figure that amounted to greater than p1[0] - it was 25, p1[0] was 16.

here's the messages out now (I changed a few #ifdef 0's to 1, so
there's a bit more debugging output, and added one on
usb_audio_recurseunit so I could see it being run):

usb.c: registered new driver audio
usbaudio: device 5 audiocontrol interface 0 has 1 input and 1 output AudioStream
ing interfaces
usbaudio: valid input sample rate 48000
usbaudio: valid input sample rate 32000
usbaudio: valid input sample rate 44100
usbaudio: device 5 interface 2 altsetting 1: format 0x00000010 sratelo 32000 sra
tehi 48000 attributes 0x01
usbaudio: valid input sample rate 48000
usbaudio: valid input sample rate 32000
usbaudio: valid input sample rate 44100
usbaudio: device 5 interface 2 altsetting 2: format 0x80000010 sratelo 32000 sra
tehi 48000 attributes 0x01
usbaudio: device 5 interface 1 altsetting 0 does not have an endpoint
usbaudio: valid output sample rate 48000
usbaudio: valid output sample rate 32000
usbaudio: valid output sample rate 44100
usbaudio: device 5 interface 1 altsetting 1: format 0x00000010 sratelo 32000 sra
tehi 48000 attributes 0x01
usbaudio: valid output sample rate 48000
usbaudio: valid output sample rate 32000
usbaudio: valid output sample rate 44100
usbaudio: device 5 interface 1 altsetting 2: format 0x80000010 sratelo 32000 sra
tehi 48000 attributes 0x01
usbaudio: registered dsp 14,19
usbaudio: constructing mixer for Terminal 10 type 0x0301
usbaudio: usb_audio_recurseunit(struct consmixstate *state,9)
usbaudio: usb_audio_recurseunit(struct consmixstate *state,8)
usbaudio: usb_audio_recurseunit(struct consmixstate *state,7)
usbaudio: usb_audio_recurseunit(struct consmixstate *state,4)
usbaudio: usb_audio_recurseunit(struct consmixstate *state,1)
usbaudio: usb_audio_recurseunit(struct consmixstate *state,5)
usbaudio: usb_audio_recurseunit(struct consmixstate *state,2)
usbaudio: usb_audio_recurseunit(struct consmixstate *state,6)
usbaudio: usb_audio_recurseunit(struct consmixstate *state,3)
usbaudio: warning: found 1 of 0 logical channels.
usbaudio: assuming the channel found is the master channel (got a Philips camera
?). Should be fine.
usbaudio: unit 7 invalid MIXER_UNIT descriptor (bitmap too small)
usbaudio: registered mixer 14,16
usbaudio: constructing mixer for Terminal 13 type 0x0101
usbaudio: usb_audio_recurseunit(struct consmixstate *state,12)
usbaudio: usb_audio_recurseunit(struct consmixstate *state,11)
usbaudio: usb_audio_recurseunit(struct consmixstate *state,2)
usbaudio: selector unit 11: ignoring channel 1
usbaudio: usb_audio_recurseunit(struct consmixstate *state,3)
usbaudio: selector unit 11: input pins with varying channel numbers
usbaudio: feature unit 12 source has no channels
usbaudio: no mixer controls found for Terminal 13
usb_audio_parsecontrol: usb_audio_state at ce0b1760
audio.c: v1.0.0:USB Audio Class driver

Sox says something different now:

hoffman:~/sounds/tech_samps/reference$ strace -fo /tmp/trace play -d /dev/dsp1 trumpets1.wav 
Process 4885 attached
Process 4884 suspended
Process 4884 resumed
Process 4885 detached
Process 4886 attached
Process 4886 detached
Process 4887 attached
Process 4884 suspended
sox: Unable to set audio speed to 44100 (set to 524288)
Process 4884 resumed
Process 4887 detached

Here's the trace:
4887  open("/dev/dsp1", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
4887  fstat64(4, {st_mode=S_IFCHR|0660, st_rdev=makedev(14, 19), ...}) = 0
4887  ioctl(4, SNDCTL_TMR_TIMEBASE, 0xbffff9b8) = -1 ENOIOCTLCMD (errno 515)
4887  old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 
0) = 0x40017000
4887  fstat64(4, {st_mode=S_IFCHR|0660, st_rdev=makedev(14, 19), ...}) = 0
4887  ioctl(4, SNDCTL_DSP_RESET, 0)     = 0
4887  ioctl(4, SNDCTL_DSP_SYNC, 0)      = 0
4887  ioctl(4, SNDCTL_DSP_GETFMTS, 0xbffffb14) = 0
4887  ioctl(4, SOUND_PCM_READ_BITS, 0xbffffb14) = 0
4887  ioctl(4, SNDCTL_DSP_STEREO, 0xbffffb14) = 0
4887  ioctl(4, SOUND_PCM_READ_RATE, 0xbffffb14) = 0
4887  write(2, "sox: ", 5)              = 5
4887  write(2, "Unable to set audio speed to 441"..., 50) = 50
4887  write(2, "\n", 1)                 = 1
4887  ioctl(4, SNDCTL_DSP_GETBLKSIZE, 0x80a52f0) = 0
4887  brk(0x80ae000)                    = 0x80ae000
4887  munmap(0x40017000, 4096)          = 0
4887  brk(0x80b4000)                    = 0x80b4000
4887  brk(0x80ba000)                    = 0x80ba000
4887  brk(0x80cb000)                    = 0x80cb000
4887  brk(0x80d1000)                    = 0x80d1000
4887  brk(0x80e2000)                    = 0x80e2000
4887  brk(0x80eb000)                    = 0x80eb000
4887  brk(0x80f4000)                    = 0x80f4000
4887  read(3, "\31\0\345\377\31\0\326\377\16\0\313\377#\0\306\377\23\0"..., 8192
) = 8192
4887  read(3, "\311\371m\375\323\371\326\374\375\371Z\374-\376e\374\r"..., 8192)
 = 8192
4887  write(4, "\31\0\345\377\32\0\344\377\33\0\342\377\34\0\340\377\35"..., 163
84) = 16384
4887  write(4, "\377\377\270\377\377\377\270\377\0\0\270\377\0\0\271\377"..., 16
[...]
4887  write(4, "\374\377\220\377\374\377\217\377\375\377\215\377\375\377"..., 16
384) = 16384
4887  close(3)                          = 0
4887  munmap(0x40016000, 4096)          = 0
4887  write(4, "\25\0\326\377\25\0\326\377\25\0\326\377\25\0\326\377\25"..., 111
2) = 1112
4887  close(4)                          = 0
4887  _exit(0)                          = ?

Something is now coming out of the output, but it sounds like it's
being played with the wrong encoding or something like that.  It's
really broken, but the total level of the sound output is somewhat not
entirely unlike the sound I'm playing.  It also takes longer to play
than it should - something less than twice as long as the audio file,
so I doubt it's really being played with a sampling frequency of
524288 :).  My MD player seems to be happily locked onto its output,
so the device is really running at a sane sampling frequency.

The error about the MIXER_UNIT is probably expected - I don't think
that this device actually _has_ a mixer.  I suspect it's just a dumb
straight-through digital audio interface.

> > [pid  1892] ioctl(4, SNDCTL_DSP_RESET, 0) = 0
> > [pid  1892] ioctl(4, SNDCTL_DSP_SYNC, 0) = 0
> > [pid  1892] ioctl(4, SNDCTL_DSP_GETFMTS, 0xbffffc04) = 0
> > [pid  1892] ioctl(4, SOUND_PCM_READ_BITS, 0xbffffc04) = 0
> > [pid  1892] ioctl(4, SNDCTL_DSP_STEREO, 0xbffffc04) = 0
> > [pid  1892] ioctl(4, SOUND_PCM_READ_RATE, 0xbffffc04) = 0
> > [pid  1892] write(2, "sox: ", 5sox: )        = 5
> > [pid  1892] write(2, "Unable to set audio speed to 441"..., 45Unable
> > to set audio speed to 44100 (set to 0)) = 45
> 
> Spooky. It doesn't even try to set the sampling rate but complains...
> somehow cannot be...

I think it was probably complaining about this error:

[pid  1892] ioctl(4, SNDCTL_TMR_TIMEBASE, 0xbffffaa8) = -1 ENOIOCTLCMD
(errno 515)

it looks to me like it's trying to set the time base of sampler/sampling
period.  It gets an error, so it then falls back to reading what the
sampler is currently running at to see if it just happens to be what we
want.  It reads a period of "0".  Hmm, a wave with a period of 0 ...
that's the sound of one hand clapping isn't it?

> > ioctl(3, SOUND_PCM_READ_BITS, 0xbffffab0) = -1 EINVAL (Invalid
> > argument)
> Again spooky, I don't see how audio.o ioctl handler could return EINVAL
> at that call. EFAULT yes, but EINVAL??

How would I go about debugging that?
--
   Sam Vilain, sam@vilain.net     WWW: http://sam.vilain.net/
    7D74 2A09 B2D3 C30F F78E      GPG: http://sam.vilain.net/sam.asc
    278A A425 30A9 05B5 2F13

  "God is a comedian playing to an audience too afraid to laugh."
 - Voltaire -

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-04-14 11:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-09  0:50 USB audio device - ABIT UA11 dual toslink I/O Sam Vilain
2002-04-09 18:49 ` Thomas Sailer
2002-04-14 11:14   ` Sam Vilain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox