我有使用 USB 进行交互的硬件。它是一个USB声卡配置文件需要这样的:
devstr=1-1.3.1:1.0
LSSB看起来像这样:
Bus 001 Device 004: ID 0d8c:0012 C-Media Electronics, Inc.
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
我需要Bus 001 Device 004: ID 0d8c:0012 C-Media Electronics, Inc. to
在配置文件中引用该设备。
更新 这是/var/日志/消息(重启后)
Nov 17 12:33:52 44249 kernel: [ 3.658983] usb 1-1.2: New USB device found, idVendor=0d8c, idProduct=0012
Nov 17 12:33:52 44249 kernel: [ 3.671869] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Nov 17 12:33:52 44249 kernel: [ 3.685433] usb 1-1.2: Product: USB Audio Device
Nov 17 12:33:52 44249 kernel: [ 3.694574] usb 1-1.2: Manufacturer: C-Media Electronics Inc.
Nov 17 12:33:52 44249 kernel: [ 3.710586] input: C-Media Electronics Inc. USB Audio Device as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.3/0003:0D8C:0012.0001/input/input0
Nov 17 12:33:52 44249 kernel: [ 3.790955] hid-generic 0003:0D8C:0012.0001: input,hidraw0: USB HID v1.00 Device [C-Media Electronics Inc. USB Audio Device] on usb-3f980000.usb-1.2/input3
结束更新
更新2的输出lsusb -vd 0d8c:0012
root@44249:~# lsusb -vd 0d8c:0012
Bus 001 Device 004: ID 0d8c:0012 C-Media Electronics, Inc.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x0d8c C-Media Electronics, Inc.
idProduct 0x0012
bcdDevice 1.00
iManufacturer 1 C-Media Electronics Inc.
iProduct 2 USB Audio Device
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 253
bNumInterfaces 4
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 100mA
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 100
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 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 6
wTerminalType 0x0301 Speaker
bAssocTerminal 0
bSourceID 9
iTerminal 0
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 3 (OUTPUT_TERMINAL)
bTerminalID 7
wTerminalType 0x0101 USB Streaming
bAssocTerminal 0
bSourceID 8
iTerminal 0
AudioControl Interface Descriptor:
bLength 7
bDescriptorType 36
bDescriptorSubtype 5 (SELECTOR_UNIT)
bUnitID 8
bNrInPins 1
baSource( 0) 10
iSelector 0
AudioControl Interface Descriptor:
bLength 10
bDescriptorType 36
bDescriptorSubtype 6 (FEATURE_UNIT)
bUnitID 9
bSourceID 15
bControlSize 1
bmaControls( 0) 0x01
Mute Control
bmaControls( 1) 0x02
Volume Control
bmaControls( 2) 0x02
Volume Control
iFeature 0
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 6 (FEATURE_UNIT)
bUnitID 10
bSourceID 2
bControlSize 1
bmaControls( 0) 0x43
Mute Control
Volume Control
Automatic Gain Control
bmaControls( 1) 0x00
iFeature 0
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 6 (FEATURE_UNIT)
bUnitID 13
bSourceID 2
bControlSize 1
bmaControls( 0) 0x03
Mute Control
Volume Control
bmaControls( 1) 0x00
iFeature 0
AudioControl Interface Descriptor:
bLength 13
bDescriptorType 36
bDescriptorSubtype 4 (MIXER_UNIT)
bUnitID 15
bNrInPins 2
baSourceID( 0) 1
baSourceID( 1) 13
bNrChannels 2
wChannelConfig 0x0003
Left Front (L)
Right Front (R)
iChannelNames 0
bmControls 0x00
iMixer 0
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
AudioStreaming Interface Descriptor:
bLength 7
bDescriptorType 36
bDescriptorSubtype 1 (AS_GENERAL)
bTerminalLink 1
bDelay 1 frames
wFormatTag 1 PCM
AudioStreaming Interface Descriptor:
bLength 14
bDescriptorType 36
bDescriptorSubtype 2 (FORMAT_TYPE)
bFormatType 1 (FORMAT_TYPE_I)
bNrChannels 2
bSubframeSize 2
bBitResolution 16
bSamFreqType 2 Discrete
tSamFreq[ 0] 48000
tSamFreq[ 1] 44100
Endpoint Descriptor:
bLength 9
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 9
Transfer Type Isochronous
Synch Type Adaptive
Usage Type Data
wMaxPacketSize 0x00c8 1x 200 bytes
bInterval 1
bRefresh 0
bSynchAddress 0
AudioControl Endpoint Descriptor:
bLength 7
bDescriptorType 37
bDescriptorSubtype 1 (EP_GENERAL)
bmAttributes 0x01
Sampling Frequency
bLockDelayUnits 1 Milliseconds
wLockDelay 1 Milliseconds
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
Bus 001 Device 004: ID 0d8c:0012 C-Media Electronics, Inc.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x0d8c C-Media Electronics, Inc.
idProduct 0x0012
bcdDevice 1.00
iManufacturer 1 C-Media Electronics Inc.
iProduct 2 USB Audio Device
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 253
bNumInterfaces 4
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 100mA
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 100
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 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 6
wTerminalType 0x0301 Speaker
bAssocTerminal 0
bSourceID 9
结束更新
有什么指点吗?
谢谢
丹尼
答案1
1) USB 音频设备由 ALSA 内核驱动程序处理,并且这些驱动程序会自动对 USB 设备(或通用接口)的供应商:产品标识符做出反应。您通常使用的驱动程序都不会使用devstr
.你没有说为什么需要这个字符串,但你可能做错了。
2) 您的示例内容devstr
是 USB 路径,如图所示/sys/bus/usb/devices
。无法从您的信息中获取它,但lsusb -t
如果您无法直接找到设备,则可以从中获取它。
3) 请dmesg
使用插入设备后出现的输出来编辑问题。
4) 您很可能缺少正确的 ALSA 驱动程序。如果还没有,请将内核更新到最新版本。
编辑
什么应该发生的情况是模块snd-usb-audio
是根据USB设备的类加载的。相反,根据您的dmesg
情况,该设备被识别为人机接口设备,这很奇怪,除非除了声音功能之外,它还具有以这种方式表示的按钮或类似按钮。
请使用 的输出编辑问题lsusb -vd 0d8c:0012
,以便我们可以查看它是否具有带有音频类的描述符。另外,验证您的内核是否包含该模块snd-usb-audio
,并modinfo snd-usb-audio
包含这两个
alias: usb:v*p*d*dc*dsc*dp*ic01isc01ip*in*
alias: usb:v*p*d*dc*dsc*dp*ic01isc03ip*in*
线。
编辑
假设输出末尾的重复行是复制和粘贴错误:这看起来像标准 USB 声卡,并且应该由 来自动处理snd-usb-audio
。我刚刚仔细检查了我的 USB 声卡,看起来该驱动程序在成功初始化时不会生成消息。请编辑带有输出的问题,cat /proc/asound/cards/
看看它是否被选中。
如果不是,我唯一的猜测是你以某种方式搞乱了你的模块依赖关系,尽管我不知道你做了什么,而且你没有说(但是“(我有一个未命名的软件)配置而需要......”听起来有点不祥)。如果是这种情况,您可以尝试使用手册modprobe snd-usb-audio
;您可以尝试使用 修复它depmod
,或者您可以重新安装(或升级,当您使用它时)您的内核。
如果这没有帮助,我就没主意了。