Skip to content

Instantly share code, notes, and snippets.

@sreimers
Last active April 10, 2018 04:53
Show Gist options
  • Save sreimers/562c409985610e112e1c to your computer and use it in GitHub Desktop.
Save sreimers/562c409985610e112e1c to your computer and use it in GitHub Desktop.
g_audio beaglebone black debugging
[root@studio-connect-ad8356 studio]# uname -a
Linux studio-connect-ad8356 3.14.4-1-ARCH #1 SMP Sun May 18 18:32:31 MDT 2014 armv7l GNU/Linux
[root@studio-connect-ad8356 studio]# modprobe g_audio
[ 39.787200] udc musb-hdrc.0.auto: registering UDC driver [g_audio]
[ 39.787252] g_audio gadget: adding config #1 'Linux USB Audio Gadget'/bf109398
[ 39.787271] g_audio gadget: adding 'uac2_func'/db21e410 to config 'Linux USB Audio Gadget'/bf109398
[ 39.792063] g_audio gadget: cfg 1/bf109398 speeds: high full
[ 39.792086] g_audio gadget: interface 0 = uac2_func/db21e410
[ 39.792095] g_audio gadget: interface 1 = uac2_func/db21e410
[ 39.792103] g_audio gadget: interface 2 = uac2_func/db21e410
[ 39.792125] g_audio gadget: Linux USB Audio Gadget, version: Feb 2, 2012
[ 39.799326] g_audio gadget: g_audio ready
[ 40.190218] g_audio gadget: HNP on another port
[ 40.190251] g_audio gadget: high-speed config #1: Linux USB Audio Gadget
[ 40.198191] g_audio gadget: non-core control reqa1.02 v0100 i0500 l2
[ 40.198269] g_audio gadget: non-core control reqa1.02 v0100 i0500 l14
[ 40.198664] g_audio gadget: non-core control reqa1.01 v0100 i0500 l4
[ 40.198906] g_audio gadget: non-core control reqa1.02 v0100 i0600 l2
[ 40.199030] g_audio gadget: non-core control reqa1.02 v0100 i0600 l14
[ 40.199285] g_audio gadget: non-core control reqa1.01 v0100 i0600 l4
[ 283.585722] g_audio gadget: non-core control reqa1.01 v0100 i0600 l4
[ 299.266366] g_audio gadget: non-core control reqa1.01 v0100 i0600 l4
[ 312.179135] g_audio gadget: non-core control reqa1.01 v0100 i0600 l4
[root@studio-connect-ad8356 studio]# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: CODEC [USB Audio CODEC], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: UAC2Gadget [UAC2_Gadget], device 0: UAC2 PCM [UAC2 PCM]
Subdevices: 1/1
Subdevice #0: subdevice #0
[root@studio-connect-ad8356 studio]# arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: CODEC [USB Audio CODEC], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: UAC2Gadget [UAC2_Gadget], device 0: UAC2 PCM [UAC2 PCM]
Subdevices: 1/1
Subdevice #0: subdevice #0
[root@studio-connect-ad8356 studio]# time aplay -D hw:1,0 music_orig.wav -v
Playing WAVE 'music_orig.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
Hardware PCM card 1 'UAC2_Gadget' device 0 subdevice 0
Its setup is:
stream : PLAYBACK
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 48000
exact rate : 48000 (48000/1)
msbits : 16
buffer_size : 16384
period_size : 1024
period_time : 21333
tstamp_mode : NONE
period_step : 1
avail_min : 1024
period_event : 0
start_threshold : 16384
stop_threshold : 16384
silence_threshold: 0
silence_size : 0
boundary : 1073741824
appl_ptr : 0
hw_ptr : 0
aplay: pcm_write:1939: write error: Input/output error
real 0m10.042s
user 0m0.020s
sys 0m0.000s
[root@studio-connect-ad8356 studio]# time arecord -f dat -r 64000 -D hw:1,0 test.wav -v
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 64000 Hz, Stereo
Hardware PCM card 1 'UAC2_Gadget' device 0 subdevice 0
Its setup is:
stream : CAPTURE
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 64000
exact rate : 64000 (64000/1)
msbits : 16
buffer_size : 16384
period_size : 1024
period_time : 16000
tstamp_mode : NONE
period_step : 1
avail_min : 1024
period_event : 0
start_threshold : 1
stop_threshold : 16384
silence_threshold: 0
silence_size : 0
boundary : 1073741824
appl_ptr : 0
hw_ptr : 0
arecord: pcm_read:2031: read error: Input/output error
real 0m10.054s
user 0m0.020s
sys 0m0.000s
studio@studio-connect-dev ~ $ dmesg
[ 487.618804] usb 7-7: USB disconnect, device number 3
[ 538.223359] usb 7-7: new high-speed USB device number 4 using ehci-pci
[ 538.347441] usb 7-7: Dual-Role OTG device on non-HNP port
[ 786.823371] retire_capture_urb: 4991 callbacks suppressed
[ 797.455386] retire_capture_urb: 4987 callbacks suppressed
[ 802.457379] retire_capture_urb: 4992 callbacks suppressed
[ 810.371385] retire_capture_urb: 4987 callbacks suppressed
[ 815.373380] retire_capture_urb: 4992 callbacks suppressed
studio@studio-connect-dev ~ $ sudo lsusb -v -d 1d6b:0101
Bus 007 Device 004: ID 1d6b:0101 Linux Foundation Audio Gadget
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2 ?
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
idVendor 0x1d6b Linux Foundation
idProduct 0x0101 Audio Gadget
bcdDevice 3.14
iManufacturer 1 Linux 3.14.4-1-ARCH with musb-hdrc
iProduct 2 Linux USB Audio Gadget
iSerial 0
bNumConfigurations 1
OTG Descriptor:
bLength 3
bDescriptorType 9
bmAttributes 0x03
SRP (Session Request Protocol)
HNP (Host Negotiation Protocol)
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 222
bNumInterfaces 3
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xe0
Self Powered
Remote Wakeup
MaxPower 500mA
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 0
bInterfaceCount 3
bFunctionClass 1 Audio
bFunctionSubClass 0
bFunctionProtocol 32
iFunction 4 Source/Sink
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 1 Audio
bInterfaceSubClass 1 Control Device
bInterfaceProtocol 32
iInterface 5 Topology Control
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 1 (HEADER)
bcdADC 2.00
bCategory 8
wTotalLength 74
bmControl 0x00
AudioControl Interface Descriptor:
bLength 8
bDescriptorType 36
bDescriptorSubtype 10 (CLOCK_SOURCE)
bClockID 6
bmAttributes 0x01 Internal fixed Clock
bmControls 0x01
Clock Frequency Control (read-only)
bAssocTerminal 0
iClockSource 6 48000Hz
AudioControl Interface Descriptor:
bLength 8
bDescriptorType 36
bDescriptorSubtype 10 (CLOCK_SOURCE)
bClockID 5
bmAttributes 0x01 Internal fixed Clock
bmControls 0x01
Clock Frequency Control (read-only)
bAssocTerminal 0
iClockSource 7 64000Hz
AudioControl Interface Descriptor:
bLength 17
bDescriptorType 36
bDescriptorSubtype 2 (INPUT_TERMINAL)
bTerminalID 1
wTerminalType 0x0101 USB Streaming
bAssocTerminal 0
bCSourceID 5
bNrChannels 2
bmChannelConfig 0x00000003
Front Left (FL)
Front Right (FR)
bmControls 0x0003
Copy Protect Control (read/write)
iChannelNames 0
iTerminal 8 USBH Out
AudioControl Interface Descriptor:
bLength 17
bDescriptorType 36
bDescriptorSubtype 2 (INPUT_TERMINAL)
bTerminalID 2
wTerminalType 0x0200 Input Undefined
bAssocTerminal 0
bCSourceID 6
bNrChannels 2
bmChannelConfig 0x00000003
Front Left (FL)
Front Right (FR)
bmControls 0x0003
Copy Protect Control (read/write)
iChannelNames 0
iTerminal 9 USBD Out
AudioControl Interface Descriptor:
bLength 12
bDescriptorType 36
bDescriptorSubtype 3 (OUTPUT_TERMINAL)
bTerminalID 4
wTerminalType 0x0101 USB Streaming
bAssocTerminal 0
bSourceID 2
bCSourceID 6
bmControls 0x0003
Copy Protect Control (read/write)
iTerminal 10 USBH In
AudioControl Interface Descriptor:
bLength 12
bDescriptorType 36
bDescriptorSubtype 3 (OUTPUT_TERMINAL)
bTerminalID 3
wTerminalType 0x0300 Output Undefined
bAssocTerminal 0
bSourceID 1
bCSourceID 5
bmControls 0x0003
Copy Protect Control (read/write)
iTerminal 11 USBD In
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 32
iInterface 12 Playback Inactive
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 1
bNumEndpoints 1
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 32
iInterface 13 Playback Active
AudioStreaming Interface Descriptor:
bLength 16
bDescriptorType 36
bDescriptorSubtype 1 (AS_GENERAL)
bTerminalLink 1
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 2
bBitResolution 16
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 4
AudioControl Endpoint Descriptor:
bLength 8
bDescriptorType 37
bDescriptorSubtype 1 (EP_GENERAL)
bmAttributes 0x00
bmControls 0x00
bLockDelayUnits 0 Undefined
wLockDelay 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 2
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 32
iInterface 14 Capture Inactive
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 2
bAlternateSetting 1
bNumEndpoints 1
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 32
iInterface 15 Capture Active
AudioStreaming Interface Descriptor:
bLength 16
bDescriptorType 36
bDescriptorSubtype 1 (AS_GENERAL)
bTerminalLink 4
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 2
bBitResolution 16
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 4
AudioControl Endpoint Descriptor:
bLength 8
bDescriptorType 37
bDescriptorSubtype 1 (EP_GENERAL)
bmAttributes 0x00
bmControls 0x00
bLockDelayUnits 0 Undefined
wLockDelay 0
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: 0x0020
(Bus Powered)
ALT port is HNP Capable
@rnertney
Copy link

Sorry for commenting on this zombie thread, but I’m running into this same pcm input/output error. Did you ever work around it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment