Skip to contentSkip to conversation

Lost dB volumes on USB headset between 2.6.38 and 3.0

DISCUSSION David Henningsson 5 participants 14 messages Aug 9, 2011 – Sep 3, 2011 Sound

lore
Share & tools
lore
#0 lore raw

Hmm, I and Colin Guthrie have found a regression between kernels 2.6.38 and 3.0.

When running "amixer -D hw:handset" for this device under 2.6.38, the attached file is returned. Under 3.0, the dB information is missing. This can't be intentional, can it?

Signature · 2 lines
David Henningsson
http://launchpad.net/~diwic

Simple mixer control 'Speaker',0
Capabilities: pvolume pswitch pswitch-joined penum
Playback channels: Front Left - Front Right
Limits: Playback 0 - 255
Mono:
Front Left: Playback 148 [58%] [-20.13dB] [on]
Front Right: Playback 148 [58%] [-20.13dB] [on]
Simple mixer control 'PCM Capture Source',0
Capabilities: enum
Items: 'Mic' 'Line' 'IEC958 In'
Item0: 'Mic'
Simple mixer control 'Line',0
Capabilities: pvolume cvolume pswitch pswitch-joined cswitch cswitch-joined penum
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: Playback 0 - 255 Capture 0 - 128
Front Left: Playback 0 [0%] [0.00dB] [off] Capture 1 [1%] [0.00dB] [on]
Front Right: Playback 0 [0%] [0.00dB] [off] Capture 1 [1%] [0.00dB] [on]
Simple mixer control 'Mic',0
Capabilities: pvolume pvolume-joined cvolume cvolume-joined pswitch pswitch-joined cswitch cswitch-joined penum Playback channels: Mono
Capture channels: Mono
Limits: Playback 0 - 255 Capture 0 - 128
Mono: Playback 191 [75%] [35.81dB] [off] Capture 0 [0%] [0.18dB] [off]
Simple mixer control 'IEC958 In',0
Capabilities: cswitch cswitch-joined penum
Capture channels: Mono
Mono: Capture [on]
Simple mixer control 'Auto Gain Control',0
Capabilities: pswitch pswitch-joined penum
Playback channels: Mono
Mono: Playback [off]

#1 lore raw
Quoted 6 lines · David Henningsson

Hmm, I and Colin Guthrie have found a regression between kernels 2.6.38 and 3.0.

When running "amixer -D hw:handset" for this device under 2.6.38, the attached file is returned. Under 3.0, the dB information is missing. This can't be intentional, can it?

There are patches that might have introduced bugs, but these two patches do remove dB information intentionally:

ALSA: usb-audio - Don't expose broken dB ranges:
http://git.alsa-project.org/?p=alsa-kernel.git;a=commitdiff;h=59bb7f0eebe6
ALSA: usb-audio - Add volume range check and warn if it too big:
http://git.alsa-project.org/?p=alsa-kernel.git;a=commitdiff;h=80acefff3bc7

Are there any messages in the system log when loading the driver? What are the controls' dB ranges (see "amixer contents")?

Regards,
Clemens

#2 lore raw
Quoted 11 lines · Clemens Ladisch
Quoted 6 lines · David Henningsson

Hmm, I and Colin Guthrie have found a regression between kernels 2.6.38 and 3.0.

When running "amixer -D hw:handset" for this device under 2.6.38, the attached file is returned. Under 3.0, the dB information is missing. This can't be intentional, can it?

There are patches that might have introduced bugs, but these two patches do remove dB information intentionally:

Quoted 7 lines

ALSA: usb-audio - Don't expose broken dB ranges:
http://git.alsa-project.org/?p=alsa-kernel.git;a=commitdiff;h=59bb7f0eebe6
ALSA: usb-audio - Add volume range check and warn if it too big:
http://git.alsa-project.org/?p=alsa-kernel.git;a=commitdiff;h=80acefff3bc7

Are there any messages in the system log when loading the driver? What are the controls' dB ranges (see "amixer contents")?

I'm attaching "amixer contents" from 2.6.38. Colin will attach some interesting dmesg output from 3.0 shortly.

Signature · 2 lines
David Henningsson
http://launchpad.net/~diwic

numid=13,iface=MIXER,name='PCM Capture Source'
; type=ENUMERATED,access=rw------,values=1,items=3 ; Item #0 'Mic'
; Item #1 'Line'
; Item #2 'IEC958 In'
: values=0
numid=3,iface=MIXER,name='Line Playback Switch'
; type=BOOLEAN,access=rw------,values=1
: values=off
numid=4,iface=MIXER,name='Line Playback Volume'
; type=INTEGER,access=rw---R--,values=2,min=0,max=255,step=0 : values=0,0
| dBminmax-min=0.00dB,max=47.81dB
numid=10,iface=MIXER,name='Line Capture Switch'
; type=BOOLEAN,access=rw------,values=1
: values=on
numid=11,iface=MIXER,name='Line Capture Volume'
; type=INTEGER,access=rw---R--,values=2,min=0,max=128,step=0 : values=1,1
| dBminmax-min=0.18dB,max=23.81dB
numid=1,iface=MIXER,name='Mic Playback Switch'
; type=BOOLEAN,access=rw------,values=1
: values=off
numid=2,iface=MIXER,name='Mic Playback Volume'
; type=INTEGER,access=rw---R--,values=1,min=0,max=255,step=0 : values=191
| dBminmax-min=0.00dB,max=47.81dB
numid=7,iface=MIXER,name='Mic Capture Switch'
; type=BOOLEAN,access=rw------,values=1
: values=off
numid=8,iface=MIXER,name='Mic Capture Volume'
; type=INTEGER,access=rw---R--,values=1,min=0,max=128,step=0 : values=0
| dBminmax-min=0.18dB,max=23.81dB
numid=12,iface=MIXER,name='IEC958 In Capture Switch'
; type=BOOLEAN,access=rw------,values=1
: values=on
numid=9,iface=MIXER,name='Auto Gain Control'
; type=BOOLEAN,access=rw------,values=1
: values=off
numid=5,iface=MIXER,name='Speaker Playback Switch'
; type=BOOLEAN,access=rw------,values=1
: values=on
numid=6,iface=MIXER,name='Speaker Playback Volume'
; type=INTEGER,access=rw---R--,values=2,min=0,max=255,step=0 : values=148,148
| dBminmax-min=-47.87dB,max=0.06dB

#3 lore raw
In reply to Clemens Ladisch

'Twas brillig, and Clemens Ladisch at 09/08/11 12:39 did gyre and gimble:

Quoted 11 lines
Quoted 6 lines · David Henningsson

Hmm, I and Colin Guthrie have found a regression between kernels 2.6.38 and 3.0.

When running "amixer -D hw:handset" for this device under 2.6.38, the attached file is returned. Under 3.0, the dB information is missing. This can't be intentional, can it?

There are patches that might have introduced bugs, but these two patches do remove dB information intentionally:

Quoted 7 lines

ALSA: usb-audio - Don't expose broken dB ranges:
http://git.alsa-project.org/?p=alsa-kernel.git;a=commitdiff;h=59bb7f0eebe6
ALSA: usb-audio - Add volume range check and warn if it too big:
http://git.alsa-project.org/?p=alsa-kernel.git;a=commitdiff;h=80acefff3bc7

Are there any messages in the system log when loading the driver? What are the controls' dB ranges (see "amixer contents")?

Interesting thanks fpr the hints.

I get this when plugging in the device David mentioned previously.

usb 3-1: USB disconnect, device number 2
usbcore: deregistering interface driver snd-usb-audio
usb 2-1: new full speed USB device number 7 using uhci_hcd usb 2-1: New USB device found, idVendor=1885, idProduct=0501 usb 2-1: New USB device strings: Mfr=2, Product=1, SerialNumber=0 usb 2-1: Product: BT Agile handset
usb 2-1: Manufacturer: Ascalade
input: Ascalade BT Agile handset as /devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1:1.3/input/input14 generic-usb 0003:1885:0501.0006: input,hidraw0: USB HID v1.00 Device [Ascalade BT Agile handset] on usb-0000:00:1d.1-1/input3 13:0: cannot get min/max values for control 2 (id 13) 14:0: cannot get min/max values for control 2 (id 14) 9:0: cannot get min/max values for control 2 (id 9)
10:0: cannot get min/max values for control 2 (id 10) 11:0: cannot get min/max values for control 2 (id 11) 9:0: cannot get min/max values for control 2 (id 9)
14:0: cannot get min/max values for control 2 (id 14) 11:0: cannot get min/max values for control 2 (id 11) 13:0: cannot get min/max values for control 2 (id 13) 10:0: cannot get min/max values for control 2 (id 10) 9:0: cannot get min/max values for control 2 (id 9)
usbcore: registered new interface driver snd-usb-audio

Signature · 10 lines
Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]
#4 lore raw

At Tue, 09 Aug 2011 13:19:37 +0200,

Quoted 40 lines · Colin Guthrie

'Twas brillig, and Clemens Ladisch at 09/08/11 12:39 did gyre and gimble:

Quoted 11 lines
Quoted 6 lines · David Henningsson

Hmm, I and Colin Guthrie have found a regression between kernels 2.6.38 and 3.0.

When running "amixer -D hw:handset" for this device under 2.6.38, the attached file is returned. Under 3.0, the dB information is missing. This can't be intentional, can it?

There are patches that might have introduced bugs, but these two patches do remove dB information intentionally:

Quoted 7 lines

ALSA: usb-audio - Don't expose broken dB ranges:
http://git.alsa-project.org/?p=alsa-kernel.git;a=commitdiff;h=59bb7f0eebe6
ALSA: usb-audio - Add volume range check and warn if it too big:
http://git.alsa-project.org/?p=alsa-kernel.git;a=commitdiff;h=80acefff3bc7

Are there any messages in the system log when loading the driver? What are the controls' dB ranges (see "amixer contents")?

Interesting thanks fpr the hints.

I get this when plugging in the device David mentioned previously.

usb 3-1: USB disconnect, device number 2
usbcore: deregistering interface driver snd-usb-audio
usb 2-1: new full speed USB device number 7 using uhci_hcd usb 2-1: New USB device found, idVendor=1885, idProduct=0501 usb 2-1: New USB device strings: Mfr=2, Product=1, SerialNumber=0 usb 2-1: Product: BT Agile handset
usb 2-1: Manufacturer: Ascalade
input: Ascalade BT Agile handset as /devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1:1.3/input/input14 generic-usb 0003:1885:0501.0006: input,hidraw0: USB HID v1.00 Device [Ascalade BT Agile handset] on usb-0000:00:1d.1-1/input3 13:0: cannot get min/max values for control 2 (id 13) 14:0: cannot get min/max values for control 2 (id 14) 9:0: cannot get min/max values for control 2 (id 9)

Quoted 8 lines

10:0: cannot get min/max values for control 2 (id 10) 11:0: cannot get min/max values for control 2 (id 11) 9:0: cannot get min/max values for control 2 (id 9) 14:0: cannot get min/max values for control 2 (id 14) 11:0: cannot get min/max values for control 2 (id 11) 13:0: cannot get min/max values for control 2 (id 13) 10:0: cannot get min/max values for control 2 (id 10) 9:0: cannot get min/max values for control 2 (id 9)

So the problem is that the driver can't extract the dB values. If the problem is seen only at the beginning of driver initialization, the patch below may work.

Also, could you give "lsusb -v" output, too?

Takashi

---

sound/usb/mixer.c +2 -1
index c04d7c7..cdd19d7 100644
@@ -152,6 +152,7 @@ static inline void check_mapped_dB(const struct usbmix_name_map *p,
 	if (p && p->dB) {
 		cval->dBmin = p->dB->min;
 		cval->dBmax = p->dB->max;
+		cval->initialized = 1;
 	}
 }
 
@@ -1092,7 +1093,7 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
 				" Switch" : " Volume");
 		if (control == UAC_FU_VOLUME) {
 			check_mapped_dB(map, cval);
-			if (cval->dBmin < cval->dBmax) {
+			if (cval->dBmin < cval->dBmax || !cval->initialized) {
 				kctl->tlv.c = mixer_vol_tlv;
 				kctl->vd[0].access |= 
 					SNDRV_CTL_ELEM_ACCESS_TLV_READ |
#5 lore raw

'Twas brillig, and Takashi Iwai at 09/08/11 13:40 did gyre and gimble:

Quoted 51 lines

At Tue, 09 Aug 2011 13:19:37 +0200,

Quoted 40 lines · Colin Guthrie

'Twas brillig, and Clemens Ladisch at 09/08/11 12:39 did gyre and gimble:

Quoted 11 lines
Quoted 6 lines · David Henningsson

Hmm, I and Colin Guthrie have found a regression between kernels 2.6.38 and 3.0.

When running "amixer -D hw:handset" for this device under 2.6.38, the attached file is returned. Under 3.0, the dB information is missing. This can't be intentional, can it?

There are patches that might have introduced bugs, but these two patches do remove dB information intentionally:

Quoted 7 lines

ALSA: usb-audio - Don't expose broken dB ranges:
http://git.alsa-project.org/?p=alsa-kernel.git;a=commitdiff;h=59bb7f0eebe6
ALSA: usb-audio - Add volume range check and warn if it too big:
http://git.alsa-project.org/?p=alsa-kernel.git;a=commitdiff;h=80acefff3bc7

Are there any messages in the system log when loading the driver? What are the controls' dB ranges (see "amixer contents")?

Interesting thanks fpr the hints.

I get this when plugging in the device David mentioned previously.

usb 3-1: USB disconnect, device number 2
usbcore: deregistering interface driver snd-usb-audio
usb 2-1: new full speed USB device number 7 using uhci_hcd usb 2-1: New USB device found, idVendor=1885, idProduct=0501 usb 2-1: New USB device strings: Mfr=2, Product=1, SerialNumber=0 usb 2-1: Product: BT Agile handset
usb 2-1: Manufacturer: Ascalade
input: Ascalade BT Agile handset as /devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1:1.3/input/input14 generic-usb 0003:1885:0501.0006: input,hidraw0: USB HID v1.00 Device [Ascalade BT Agile handset] on usb-0000:00:1d.1-1/input3 13:0: cannot get min/max values for control 2 (id 13) 14:0: cannot get min/max values for control 2 (id 14) 9:0: cannot get min/max values for control 2 (id 9)

Quoted 8 lines

10:0: cannot get min/max values for control 2 (id 10) 11:0: cannot get min/max values for control 2 (id 11) 9:0: cannot get min/max values for control 2 (id 9) 14:0: cannot get min/max values for control 2 (id 14) 11:0: cannot get min/max values for control 2 (id 11) 13:0: cannot get min/max values for control 2 (id 13) 10:0: cannot get min/max values for control 2 (id 10) 9:0: cannot get min/max values for control 2 (id 9)

Quoted 5 lines

So the problem is that the driver can't extract the dB values. If the problem is seen only at the beginning of driver initialization, the patch below may work.

Also, could you give "lsusb -v" output, too?

Sure here it is. I actually have two USB cards plugged in here, both of which have now lost their dB info. The one above is here and the new one is the Yamaha one.

Quoted 13 lines
sound/usb/mixer.c +1 -0
index c04d7c7..cdd19d7 100644
@@ -152,6 +152,7 @@ static inline void check_mapped_dB(const struct usbmix_name_map *p,
 	if (p && p->dB) {
 		cval->dBmin = p->dB->min;
 		cval->dBmax = p->dB->max;
+		cval->initialized = 1;
 	}
 }
 

sound/usb/mixer.c static void build_feature_ctl(struct mixer_build *state, void *raw_desc, · line 1099

Quoted 8 lines
sound/usb/mixer.c +1 -1
@@ -1092,7 +1093,7 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
 				" Switch" : " Volume");
 		if (control == UAC_FU_VOLUME) {
 			check_mapped_dB(map, cval);
-			if (cval->dBmin < cval->dBmax) {
+			if (cval->dBmin < cval->dBmax || !cval->initialized) {
 				kctl->tlv.c = mixer_vol_tlv;
 				kctl->vd[0].access |= 
 					SNDRV_CTL_ELEM_ACCESS_TLV_READ |

Not had a chance to test this yet but I will when I get a moment.

Col

Signature · 10 lines
Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]
#6 lore raw
Quoted 56 lines · Colin Guthrie

'Twas brillig, and Takashi Iwai at 09/08/11 13:40 did gyre and gimble:

Quoted 55 lines

At Tue, 09 Aug 2011 13:19:37 +0200,

Quoted 40 lines · Colin Guthrie

'Twas brillig, and Clemens Ladisch at 09/08/11 12:39 did gyre and gimble:

Quoted 11 lines
Quoted 6 lines · David Henningsson

Hmm, I and Colin Guthrie have found a regression between kernels 2.6.38 and 3.0.

When running "amixer -D hw:handset" for this device under 2.6.38, the attached file is returned. Under 3.0, the dB information is missing. This can't be intentional, can it?

There are patches that might have introduced bugs, but these two patches do remove dB information intentionally:

Quoted 7 lines

ALSA: usb-audio - Don't expose broken dB ranges:
http://git.alsa-project.org/?p=alsa-kernel.git;a=commitdiff;h=59bb7f0eebe6
ALSA: usb-audio - Add volume range check and warn if it too big:
http://git.alsa-project.org/?p=alsa-kernel.git;a=commitdiff;h=80acefff3bc7

Are there any messages in the system log when loading the driver? What are the controls' dB ranges (see "amixer contents")?

Interesting thanks fpr the hints.

I get this when plugging in the device David mentioned previously.

usb 3-1: USB disconnect, device number 2
usbcore: deregistering interface driver snd-usb-audio
usb 2-1: new full speed USB device number 7 using uhci_hcd usb 2-1: New USB device found, idVendor=1885, idProduct=0501 usb 2-1: New USB device strings: Mfr=2, Product=1, SerialNumber=0 usb 2-1: Product: BT Agile handset
usb 2-1: Manufacturer: Ascalade
input: Ascalade BT Agile handset as /devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1:1.3/input/input14 generic-usb 0003:1885:0501.0006: input,hidraw0: USB HID v1.00 Device [Ascalade BT Agile handset] on usb-0000:00:1d.1-1/input3 13:0: cannot get min/max values for control 2 (id 13) 14:0: cannot get min/max values for control 2 (id 14) 9:0: cannot get min/max values for control 2 (id 9)

Quoted 8 lines

10:0: cannot get min/max values for control 2 (id 10) 11:0: cannot get min/max values for control 2 (id 11) 9:0: cannot get min/max values for control 2 (id 9) 14:0: cannot get min/max values for control 2 (id 14) 11:0: cannot get min/max values for control 2 (id 11) 13:0: cannot get min/max values for control 2 (id 13) 10:0: cannot get min/max values for control 2 (id 10) 9:0: cannot get min/max values for control 2 (id 9)

So the problem is that the driver can't extract the dB values. If the problem is seen only at the beginning of driver initialization, the patch below may work.

Quoted 5 lines
Quoted 1 line

Also, could you give "lsusb -v" output, too?

Sure here it is. I actually have two USB cards plugged in here, both of which have now lost their dB info. The one above is here and the new one is the Yamaha one.

Never saw that attachment (did you forget to attach it?) but here's a third one which lacks dB volumes in 3.0 (but had in 2.6.38).

Signature · 2 lines
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic

Bus 003 Device 002: ID 046d:0a0c Logitech, Inc. Clear Chat Comfort USB Headset Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00

  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x046d Logitech, Inc.
  idProduct          0x0a0c Clear Chat Comfort USB Headset
  bcdDevice           10.13
  iManufacturer           1 Logitech
  iProduct                2 Logitech USB Headset
  iSerial                 0 
  bNumConfigurations      1

Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 299
bNumInterfaces 4
bConfigurationValue 1
iConfiguration 3 G8 v3.0.0.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 13
wTerminalType 0x0201 Microphone
bAssocTerminal 0
bNrChannels 1
wChannelConfig 0x0000
iChannelNames 0
iTerminal 0
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 6 (FEATURE_UNIT)
bUnitID 6
bSourceID 13
bControlSize 1
bmaControls( 0) 0x03
Mute Control
Volume Control
bmaControls( 1) 0x00
iFeature 0
AudioControl Interface Descriptor:
bLength 12
bDescriptorType 36
bDescriptorSubtype 2 (INPUT_TERMINAL)
bTerminalID 12
wTerminalType 0x0101 USB Streaming
bAssocTerminal 0
bNrChannels 2
wChannelConfig 0x0003
Left Front (L)
Right Front (R)
iChannelNames 0
iTerminal 0
AudioControl Interface Descriptor:
bLength 13
bDescriptorType 36
bDescriptorSubtype 4 (MIXER_UNIT)
bUnitID 9
bNrInPins 2
baSourceID( 0) 12
baSourceID( 1) 6
bNrChannels 2
wChannelConfig 0x0003
Left Front (L)
Right Front (R)
iChannelNames 0
bmControls 0x00
iMixer 0
AudioControl Interface Descriptor:
bLength 10
bDescriptorType 36
bDescriptorSubtype 6 (FEATURE_UNIT)
bUnitID 1
bSourceID 9
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 3 (OUTPUT_TERMINAL)
bTerminalID 14
wTerminalType 0x0301 Speaker
bAssocTerminal 0
bSourceID 1
iTerminal 0
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 6 (FEATURE_UNIT)
bUnitID 2
bSourceID 13
bControlSize 1
bmaControls( 0) 0x03
Mute Control
Volume Control
bmaControls( 1) 0x00
iFeature 0
AudioControl Interface Descriptor:
bLength 7
bDescriptorType 36
bDescriptorSubtype 5 (SELECTOR_UNIT)
bUnitID 8
bNrInPins 1
baSource( 0) 2
iSelector 0
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 3 (OUTPUT_TERMINAL)
bTerminalID 10
wTerminalType 0x0101 USB Streaming
bAssocTerminal 0
bSourceID 8
iTerminal 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 12
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 0 Continuous
tLowerSamFreq 8000
tUpperSamFreq 48000
Endpoint Descriptor:
bLength 9
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 13
Transfer Type Isochronous
Synch Type Synchronous
Usage Type Data
wMaxPacketSize 0x00c0 1x 192 bytes
bInterval 1
bRefresh 0
bSynchAddress 0
AudioControl Endpoint Descriptor:
bLength 7
bDescriptorType 37
bDescriptorSubtype 1 (EP_GENERAL)
bmAttributes 0x01
Sampling Frequency
bLockDelayUnits 0 Undefined
wLockDelay 0 Undefined
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 2
bNumEndpoints 1
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 0
iInterface 0
AudioStreaming Interface Descriptor:
bLength 7
bDescriptorType 36
bDescriptorSubtype 1 (AS_GENERAL)
bTerminalLink 12
bDelay 1 frames
wFormatTag 1 PCM
AudioStreaming Interface Descriptor:
bLength 14
bDescriptorType 36
bDescriptorSubtype 2 (FORMAT_TYPE)
bFormatType 1 (FORMAT_TYPE_I)
bNrChannels 1
bSubframeSize 2
bBitResolution 16
bSamFreqType 0 Continuous
tLowerSamFreq 8000
tUpperSamFreq 48000
Endpoint Descriptor:
bLength 9
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 13
Transfer Type Isochronous
Synch Type Synchronous
Usage Type Data
wMaxPacketSize 0x0060 1x 96 bytes
bInterval 1
bRefresh 0
bSynchAddress 0
AudioControl Endpoint Descriptor:
bLength 7
bDescriptorType 37
bDescriptorSubtype 1 (EP_GENERAL)
bmAttributes 0x01
Sampling Frequency
bLockDelayUnits 0 Undefined
wLockDelay 0 Undefined
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
AudioStreaming Interface Descriptor:
bLength 7
bDescriptorType 36
bDescriptorSubtype 1 (AS_GENERAL)
bTerminalLink 10
bDelay 0 frames
wFormatTag 1 PCM
AudioStreaming Interface Descriptor:
bLength 14
bDescriptorType 36
bDescriptorSubtype 2 (FORMAT_TYPE)
bFormatType 1 (FORMAT_TYPE_I)
bNrChannels 1
bSubframeSize 2
bBitResolution 16
bSamFreqType 0 Continuous
tLowerSamFreq 8000
tUpperSamFreq 48000
Endpoint Descriptor:
bLength 9
bDescriptorType 5
bEndpointAddress 0x84 EP 4 IN
bmAttributes 13
Transfer Type Isochronous
Synch Type Synchronous
Usage Type Data
wMaxPacketSize 0x0060 1x 96 bytes
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 1 Decoded PCM samples
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 3
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0 No Subclass
bInterfaceProtocol 0 None
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.00
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 57
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0002 1x 2 bytes
bInterval 8
Device Status: 0x0000
(Bus Powered)

#7 lore raw
In reply to Colin Guthrie

2011/8/16 Colin Guthrie <[email protected]>:

Quoted 10 lines

'Twas brillig, and Takashi Iwai at 09/08/11 13:40 did gyre and gimble:

Quoted 9 lines

At Tue, 09 Aug 2011 13:19:37 +0200,

Quoted 7 lines · Colin Guthrie
Quoted 7 lines

There are patches that might have introduced bugs, but these two patches do remove dB information intentionally:

ALSA: usb-audio - Don't expose broken dB ranges:
http://git.alsa-project.org/?p=alsa-kernel.git;a=commitdiff;h=59bb7f0eebe6

Revert this patch fix the problem for my logitech webcam since dBmin and dBmax are still zero

ALSA endpoint.c:450: 2:3:1: add audio endpoint 0x86
dBMin 0 dBMax 0 min 0 max 1
control 1 UAC_FU_VOLUME 2
ALSA mixer.c:1186: [5] FU [Mic Capture Switch] ch = 1, val = 0/1/1 ALSA mixer.c:805: 5:2: cannot get min/max values for control 2 (id 5) control 2 UAC_FU_VOLUME 2
dBmin 0 dBmax 0
ALSA mixer.c:1186: [5] FU [Mic Capture Volume] ch = 1, val = 0/1/1 ALSA mixer.c:805: 5:2: cannot get min/max values for control 2 (id 5)
usbcore: registered new interface driver snd-usb-audio dBMin 1800 dBMax 3000 min 1200 max 1e00

#8 lore raw
In reply to Colin Guthrie

At Tue, 16 Aug 2011 13:31:52 +0100,

Quoted 13 lines · Colin Guthrie
Quoted 13 lines
sound/usb/mixer.c +1 -0
index c04d7c7..cdd19d7 100644
@@ -152,6 +152,7 @@ static inline void check_mapped_dB(const struct usbmix_name_map *p,
 	if (p && p->dB) {
 		cval->dBmin = p->dB->min;
 		cval->dBmax = p->dB->max;
+		cval->initialized = 1;
 	}
 }
 
Quoted 13 lines

sound/usb/mixer.c static void build_feature_ctl(struct mixer_build *state, void *raw_desc, · line 1099

Quoted 9 lines
sound/usb/mixer.c +1 -1
@@ -1092,7 +1093,7 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
 				" Switch" : " Volume");
 		if (control == UAC_FU_VOLUME) {
 			check_mapped_dB(map, cval);
-			if (cval->dBmin < cval->dBmax) {
+			if (cval->dBmin < cval->dBmax || !cval->initialized) {
 				kctl->tlv.c = mixer_vol_tlv;
 				kctl->vd[0].access |= 
 					SNDRV_CTL_ELEM_ACCESS_TLV_READ |

Not had a chance to test this yet but I will when I get a moment.

Any chance to test the patch?

Takashi

#9 lore raw

2011/8/18 Takashi Iwai <[email protected]>:

Quoted 29 lines

At Tue, 16 Aug 2011 13:31:52 +0100,

Quoted 13 lines · Colin Guthrie
Quoted 13 lines
sound/usb/mixer.c +1 -0
index c04d7c7..cdd19d7 100644
@@ -152,6 +152,7 @@ static inline void check_mapped_dB(const struct usbmix_name_map *p,
     if (p && p->dB) {
             cval->dBmin = p->dB->min;
             cval->dBmax = p->dB->max;
+           cval->initialized = 1;
     }
  }
 
Quoted 13 lines
Quoted 9 lines
sound/usb/mixer.c +1 -1
@@ -1092,7 +1093,7 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
                             " Switch" : " Volume");
             if (control == UAC_FU_VOLUME) {
                     check_mapped_dB(map, cval);
-                   if (cval->dBmin < cval->dBmax) {
+                   if (cval->dBmin < cval->dBmax || !cval->initialized) {
                             kctl->tlv.c = mixer_vol_tlv;

                            kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ |

Not had a chance to test this yet but I will when I get a moment.

Quoted 2 lines

Any chance to test the patch?

The patch seem fix the no dB scale problem , however the broken dB test which you added seem redundant as cval->dBmin and cval->dBmax are still zero because error in get_min_max() at build_feature_ctl() and it seem that the valid dBmin and dBMax are calculated by get_min_max() at mixer_ctl_feature_info() on my usb logitech web cam

LSA endpoint.c:450: 2:3:1: add audio endpoint 0x86
ALSA mixer.c:1182: [5] FU [Mic Capture Switch] ch = 1, val = 0/1/1 ALSA mixer.c:804: 5:2: cannot get min/max values for control 2 (id 5) ALSA mixer.c:1182: [5] FU [Mic Capture Volume] ch = 1, val = 0/1/1 ALSA mixer.c:804: 5:2: cannot get min/max values for control 2 (id 5)
usbcore: registered new interface driver snd-usb-audio

#10 lore raw

At Fri, 19 Aug 2011 06:55:54 +0800,

Quoted 31 lines · Raymond Yau

2011/8/18 Takashi Iwai <[email protected]>:

Quoted 29 lines

At Tue, 16 Aug 2011 13:31:52 +0100,

Quoted 26 lines · Colin Guthrie
Quoted 20 lines
sound/usb/mixer.c +2 -1
index c04d7c7..cdd19d7 100644
@@ -152,6 +152,7 @@ static inline void check_mapped_dB(const struct usbmix_name_map *p,
     if (p && p->dB) {
             cval->dBmin = p->dB->min;
             cval->dBmax = p->dB->max;
+           cval->initialized = 1;
     }
  }
 
@@ -1092,7 +1093,7 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
                             " Switch" : " Volume");
             if (control == UAC_FU_VOLUME) {
                     check_mapped_dB(map, cval);
-                   if (cval->dBmin < cval->dBmax) {
+                   if (cval->dBmin < cval->dBmax || !cval->initialized) {
                             kctl->tlv.c = mixer_vol_tlv;
Quoted 2 lines

                            kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ |

Not had a chance to test this yet but I will when I get a moment.

Quoted 8 lines
Quoted 2 lines

Any chance to test the patch?

The patch seem fix the no dB scale problem , however the broken dB test which you added seem redundant as cval->dBmin and cval->dBmax are still zero because error in get_min_max() at build_feature_ctl() and it seem that the valid dBmin and dBMax are calculated by get_min_max() at mixer_ctl_feature_info() on my usb logitech web cam

Yeah, that's a known problem. The dB-test is missing when reading dB failed at probing time and later it gives a wrong value.

We can add another dB-test later, and remove TLV bit from kcontrol.access on the fly. But for that, we'd need to notify via SNDRV_CTL_EVENT_MASK_INFO, too.

thanks,

Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#11 lore raw

At Fri, 19 Aug 2011 07:53:44 +0200,

Quoted 43 lines · Takashi Iwai

At Fri, 19 Aug 2011 06:55:54 +0800,

Quoted 31 lines · Raymond Yau

2011/8/18 Takashi Iwai <[email protected]>:

Quoted 29 lines

At Tue, 16 Aug 2011 13:31:52 +0100,

Quoted 26 lines · Colin Guthrie
Quoted 20 lines
sound/usb/mixer.c +2 -1
index c04d7c7..cdd19d7 100644
@@ -152,6 +152,7 @@ static inline void check_mapped_dB(const struct usbmix_name_map *p,
     if (p && p->dB) {
             cval->dBmin = p->dB->min;
             cval->dBmax = p->dB->max;
+           cval->initialized = 1;
     }
  }
 
@@ -1092,7 +1093,7 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
                             " Switch" : " Volume");
             if (control == UAC_FU_VOLUME) {
                     check_mapped_dB(map, cval);
-                   if (cval->dBmin < cval->dBmax) {
+                   if (cval->dBmin < cval->dBmax || !cval->initialized) {
                             kctl->tlv.c = mixer_vol_tlv;
Quoted 2 lines

                            kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ |

Not had a chance to test this yet but I will when I get a moment.

Quoted 8 lines
Quoted 2 lines

Any chance to test the patch?

The patch seem fix the no dB scale problem , however the broken dB test which you added seem redundant as cval->dBmin and cval->dBmax are still zero because error in get_min_max() at build_feature_ctl() and it seem that the valid dBmin and dBMax are calculated by get_min_max() at mixer_ctl_feature_info() on my usb logitech web cam

Quoted 6 lines

Yeah, that's a known problem. The dB-test is missing when reading dB failed at probing time and later it gives a wrong value.

We can add another dB-test later, and remove TLV bit from kcontrol.access on the fly. But for that, we'd need to notify via SNDRV_CTL_EVENT_MASK_INFO, too.

I meant something like below.

Takashi

---

sound/usb/mixer.c +11 -2
index cdd19d7..78a5abd 100644
@@ -881,8 +881,17 @@ static int mixer_ctl_feature_info(struct snd_kcontrol *kcontrol, struct snd_ctl_
 		uinfo->value.integer.min = 0;
 		uinfo->value.integer.max = 1;
 	} else {
-		if (! cval->initialized)
-			get_min_max(cval,  0);
+		if (!cval->initialized) {
+			get_min_max(cval, 0);
+			if (cval->initialized && cval->dBmin >= cval->dBmax) {
+				kcontrol->vd[0].access &= 
+					~(SNDRV_CTL_ELEM_ACCESS_TLV_READ |
+					  SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK);
+				snd_ctl_notify(cval->mixer->chip->card,
+					       SNDRV_CTL_EVENT_MASK_INFO,
+					       &kcontrol->id);
+			}
+		}
 		uinfo->value.integer.min = 0;
 		uinfo->value.integer.max =
 			(cval->max - cval->min + cval->res - 1) / cval->res;

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#12 lore raw

2011/8/19 Takashi Iwai <[email protected]>:

Quoted 39 lines

At Fri, 19 Aug 2011 07:53:44 +0200,

Quoted 8 lines · Takashi Iwai

Yeah, that's a known problem.  The dB-test is missing when reading dB failed at probing time and later it gives a wrong value.

We can add another dB-test later, and remove TLV bit from kcontrol.access on the fly.  But for that, we'd need to notify via SNDRV_CTL_EVENT_MASK_INFO, too.

I meant something like below.

Takashi

---

sound/usb/mixer.c +11 -2
index cdd19d7..78a5abd 100644
@@ -881,8 +881,17 @@ static int mixer_ctl_feature_info(struct snd_kcontrol *kcontrol, struct snd_ctl_
                uinfo->value.integer.min = 0;
                uinfo->value.integer.max = 1;
        } else {
-               if (! cval->initialized)
-                       get_min_max(cval,  0);
+               if (!cval->initialized) {
+                       get_min_max(cval, 0);
+                       if (cval->initialized && cval->dBmin >= cval->dBmax) {
+                               kcontrol->vd[0].access &=
+                                       ~(SNDRV_CTL_ELEM_ACCESS_TLV_READ |
+                                         SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK);
+                               snd_ctl_notify(cval->mixer->chip->card,
+                                              SNDRV_CTL_EVENT_MASK_INFO,
+                                              &kcontrol->id);
+                       }
+               }
                uinfo->value.integer.min = 0;
Quoted 3 lines

               uinfo->value.integer.max =
                       (cval->max - cval->min + cval->res - 1) / cval->res;

I have doubt about this removal of tlv is enough since values of dB scale are calculated from min and max of the control , as dBmin >= dBmax imply min >= max and the control already has a invalid range and unusable

#13 lore raw
In reply to Takashi Iwai

Hi,

Sorry I only just got around to looking at kernel stuff today, but when I checked with my 3.0.4 kernel which is now installed it seems fixed!

Cheers!

Col

'Twas brillig, and Takashi Iwai at 18/08/11 17:18 did gyre and gimble:

Quoted 33 lines

At Tue, 16 Aug 2011 13:31:52 +0100,

Quoted 13 lines · Colin Guthrie
Quoted 13 lines
sound/usb/mixer.c +1 -0
index c04d7c7..cdd19d7 100644
@@ -152,6 +152,7 @@ static inline void check_mapped_dB(const struct usbmix_name_map *p,
 	if (p && p->dB) {
 		cval->dBmin = p->dB->min;
 		cval->dBmax = p->dB->max;
+		cval->initialized = 1;
 	}
 }
 
Quoted 13 lines

sound/usb/mixer.c static void build_feature_ctl(struct mixer_build *state, void *raw_desc, · line 1099

Quoted 9 lines
sound/usb/mixer.c +1 -1
@@ -1092,7 +1093,7 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
 				" Switch" : " Volume");
 		if (control == UAC_FU_VOLUME) {
 			check_mapped_dB(map, cval);
-			if (cval->dBmin < cval->dBmax) {
+			if (cval->dBmin < cval->dBmax || !cval->initialized) {
 				kctl->tlv.c = mixer_vol_tlv;
 				kctl->vd[0].access |= 
 					SNDRV_CTL_ELEM_ACCESS_TLV_READ |

Not had a chance to test this yet but I will when I get a moment.

Any chance to test the patch?

Takashi

Signature · 10 lines
Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]