All of lore.kernel.org
 help / color / mirror / Atom feed
* Lost dB volumes on USB headset between 2.6.38 and 3.0
@ 2011-08-09  9:52 David Henningsson
  2011-08-09 10:39 ` Clemens Ladisch
  0 siblings, 1 reply; 15+ messages in thread
From: David Henningsson @ 2011-08-09  9:52 UTC (permalink / raw)
  To: ALSA Development Mailing List; +Cc: Colin Guthrie

[-- Attachment #1: Type: text/plain, Size: 310 bytes --]

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?

-- 
David Henningsson
http://launchpad.net/~diwic

[-- Attachment #2: mixer38.log --]
[-- Type: text/x-log, Size: 1350 bytes --]

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]

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



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

* Re: Lost dB volumes on USB headset between 2.6.38 and 3.0
  2011-08-09  9:52 Lost dB volumes on USB headset between 2.6.38 and 3.0 David Henningsson
@ 2011-08-09 10:39 ` Clemens Ladisch
  2011-08-09 11:19   ` David Henningsson
  2011-08-09 11:19   ` Colin Guthrie
  0 siblings, 2 replies; 15+ messages in thread
From: Clemens Ladisch @ 2011-08-09 10:39 UTC (permalink / raw)
  To: David Henningsson; +Cc: ALSA Development Mailing List, Colin Guthrie

David Henningsson wrote:
> 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

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

* Re: Lost dB volumes on USB headset between 2.6.38 and 3.0
  2011-08-09 10:39 ` Clemens Ladisch
@ 2011-08-09 11:19   ` David Henningsson
  2011-08-09 11:19   ` Colin Guthrie
  1 sibling, 0 replies; 15+ messages in thread
From: David Henningsson @ 2011-08-09 11:19 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: ALSA Development Mailing List, Colin Guthrie

[-- Attachment #1: Type: text/plain, Size: 1031 bytes --]

On 2011-08-09 12:39, Clemens Ladisch wrote:
> David Henningsson wrote:
>> 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")?

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

-- 
David Henningsson
http://launchpad.net/~diwic

[-- Attachment #2: amixercontents.log --]
[-- Type: text/x-log, Size: 1721 bytes --]

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

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



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

* Re: Lost dB volumes on USB headset between 2.6.38 and 3.0
  2011-08-09 10:39 ` Clemens Ladisch
  2011-08-09 11:19   ` David Henningsson
@ 2011-08-09 11:19   ` Colin Guthrie
  2011-08-09 12:40     ` Takashi Iwai
  1 sibling, 1 reply; 15+ messages in thread
From: Colin Guthrie @ 2011-08-09 11:19 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: ALSA Development Mailing List, David Henningsson

'Twas brillig, and Clemens Ladisch at 09/08/11 12:39 did gyre and gimble:
> David Henningsson wrote:
>> 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")?

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


-- 

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/]

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

* Re: Lost dB volumes on USB headset between 2.6.38 and 3.0
  2011-08-09 11:19   ` Colin Guthrie
@ 2011-08-09 12:40     ` Takashi Iwai
  2011-08-16 12:31       ` Colin Guthrie
  0 siblings, 1 reply; 15+ messages in thread
From: Takashi Iwai @ 2011-08-09 12:40 UTC (permalink / raw)
  To: Colin Guthrie
  Cc: ALSA Development Mailing List, Clemens Ladisch, David Henningsson

At Tue, 09 Aug 2011 13:19:37 +0200,
Colin Guthrie wrote:
> 
> 'Twas brillig, and Clemens Ladisch at 09/08/11 12:39 did gyre and gimble:
> > David Henningsson wrote:
> >> 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")?
> 
> 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)

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

---
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index c04d7c7..cdd19d7 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -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 |

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

* Re: Lost dB volumes on USB headset between 2.6.38 and 3.0
  2011-08-09 12:40     ` Takashi Iwai
@ 2011-08-16 12:31       ` Colin Guthrie
  2011-08-16 13:41         ` David Henningsson
                           ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Colin Guthrie @ 2011-08-16 12:31 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: ALSA Development Mailing List, Clemens Ladisch, David Henningsson

'Twas brillig, and Takashi Iwai at 09/08/11 13:40 did gyre and gimble:
> At Tue, 09 Aug 2011 13:19:37 +0200,
> Colin Guthrie wrote:
>>
>> 'Twas brillig, and Clemens Ladisch at 09/08/11 12:39 did gyre and gimble:
>>> David Henningsson wrote:
>>>> 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")?
>>
>> 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)
> 
> 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.


> diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
> index c04d7c7..cdd19d7 100644
> --- a/sound/usb/mixer.c
> +++ b/sound/usb/mixer.c
> @@ -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 |



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

Col


-- 

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/]

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

* Re: Lost dB volumes on USB headset between 2.6.38 and 3.0
  2011-08-16 12:31       ` Colin Guthrie
@ 2011-08-16 13:41         ` David Henningsson
  2011-08-16 14:00         ` Raymond Yau
  2011-08-18 15:18         ` Takashi Iwai
  2 siblings, 0 replies; 15+ messages in thread
From: David Henningsson @ 2011-08-16 13:41 UTC (permalink / raw)
  To: Colin Guthrie
  Cc: Takashi Iwai, ALSA Development Mailing List, Clemens Ladisch

[-- Attachment #1: Type: text/plain, Size: 3110 bytes --]

On 08/16/2011 02:31 PM, Colin Guthrie wrote:
> 'Twas brillig, and Takashi Iwai at 09/08/11 13:40 did gyre and gimble:
>> At Tue, 09 Aug 2011 13:19:37 +0200,
>> Colin Guthrie wrote:
>>>
>>> 'Twas brillig, and Clemens Ladisch at 09/08/11 12:39 did gyre and gimble:
>>>> David Henningsson wrote:
>>>>> 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")?
>>>
>>> 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)
>>
>> 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.

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).

-- 
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic

[-- Attachment #2: lsusb.txt --]
[-- Type: text/plain, Size: 12459 bytes --]

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)


[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



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

* Re: Lost dB volumes on USB headset between 2.6.38 and 3.0
  2011-08-16 12:31       ` Colin Guthrie
  2011-08-16 13:41         ` David Henningsson
@ 2011-08-16 14:00         ` Raymond Yau
  2011-08-18 15:18         ` Takashi Iwai
  2 siblings, 0 replies; 15+ messages in thread
From: Raymond Yau @ 2011-08-16 14:00 UTC (permalink / raw)
  To: ALSA Development Mailing List

2011/8/16 Colin Guthrie <gmane@colin.guthr.ie>:
> 'Twas brillig, and Takashi Iwai at 09/08/11 13:40 did gyre and gimble:
>> At Tue, 09 Aug 2011 13:19:37 +0200,
>> Colin Guthrie wrote:
>>>
>>>>
>>>> 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

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

* Re: Lost dB volumes on USB headset between 2.6.38 and 3.0
  2011-08-16 12:31       ` Colin Guthrie
  2011-08-16 13:41         ` David Henningsson
  2011-08-16 14:00         ` Raymond Yau
@ 2011-08-18 15:18         ` Takashi Iwai
  2011-08-18 22:55           ` Raymond Yau
  2011-09-03 11:11           ` Colin Guthrie
  2 siblings, 2 replies; 15+ messages in thread
From: Takashi Iwai @ 2011-08-18 15:18 UTC (permalink / raw)
  To: Colin Guthrie
  Cc: ALSA Development Mailing List, Clemens Ladisch, David Henningsson

At Tue, 16 Aug 2011 13:31:52 +0100,
Colin Guthrie wrote:
> 
> > diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
> > index c04d7c7..cdd19d7 100644
> > --- a/sound/usb/mixer.c
> > +++ b/sound/usb/mixer.c
> > @@ -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 |
> 
> 
> 
> Not had a chance to test this yet but I will when I get a moment.

Any chance to test the patch?


Takashi

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

* Re: Lost dB volumes on USB headset between 2.6.38 and 3.0
  2011-08-18 15:18         ` Takashi Iwai
@ 2011-08-18 22:55           ` Raymond Yau
  2011-08-19  5:53             ` Takashi Iwai
  2011-09-03 11:11           ` Colin Guthrie
  1 sibling, 1 reply; 15+ messages in thread
From: Raymond Yau @ 2011-08-18 22:55 UTC (permalink / raw)
  To: ALSA Development Mailing List

2011/8/18 Takashi Iwai <tiwai@suse.de>:
> At Tue, 16 Aug 2011 13:31:52 +0100,
> Colin Guthrie wrote:
>>
>> > diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
>> > index c04d7c7..cdd19d7 100644
>> > --- a/sound/usb/mixer.c
>> > +++ b/sound/usb/mixer.c
>> > @@ -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 |
>>
>>
>>
>> Not had a chance to test this yet but I will when I get a moment.
>
> 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

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

* Re: Lost dB volumes on USB headset between 2.6.38 and 3.0
       [not found] <mailman.806.1313679978.2087.alsa-devel@alsa-project.org>
@ 2011-08-19  2:19 ` Alex Wolfson
  0 siblings, 0 replies; 15+ messages in thread
From: Alex Wolfson @ 2011-08-19  2:19 UTC (permalink / raw)
  To: alsa-devel

> 2011/8/18 Takashi Iwai<tiwai at suse.de  <http://mailman.alsa-project.org/mailman/listinfo/alsa-devel>>:
> >/  At Tue, 16 Aug 2011 13:31:52 +0100,
> />/  Colin Guthrie wrote:
> />>/
> />>/  >  diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
> />>/  >  index c04d7c7..cdd19d7 100644
> />>/  >  --- a/sound/usb/mixer.c
> />>/  >  +++ b/sound/usb/mixer.c
> />>/  >  @@ -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 |
> />>/
> />>/
> />>/
> />>/  Not had a chance to test this yet but I will when I get a moment.
> />/
> />/  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
Fixed dB scale problem for my USB Logitech headset as well (046d:0a0b)

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

* Re: Lost dB volumes on USB headset between 2.6.38 and 3.0
  2011-08-18 22:55           ` Raymond Yau
@ 2011-08-19  5:53             ` Takashi Iwai
  2011-08-19  6:15               ` Takashi Iwai
  0 siblings, 1 reply; 15+ messages in thread
From: Takashi Iwai @ 2011-08-19  5:53 UTC (permalink / raw)
  To: Raymond Yau; +Cc: ALSA Development Mailing List

At Fri, 19 Aug 2011 06:55:54 +0800,
Raymond Yau wrote:
> 
> 2011/8/18 Takashi Iwai <tiwai@suse.de>:
> > At Tue, 16 Aug 2011 13:31:52 +0100,
> > Colin Guthrie wrote:
> >>
> >> > diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
> >> > index c04d7c7..cdd19d7 100644
> >> > --- a/sound/usb/mixer.c
> >> > +++ b/sound/usb/mixer.c
> >> > @@ -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 |
> >>
> >>
> >>
> >> Not had a chance to test this yet but I will when I get a moment.
> >
> > 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
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: Lost dB volumes on USB headset between 2.6.38 and 3.0
  2011-08-19  5:53             ` Takashi Iwai
@ 2011-08-19  6:15               ` Takashi Iwai
  2011-08-23  3:02                 ` Raymond Yau
  0 siblings, 1 reply; 15+ messages in thread
From: Takashi Iwai @ 2011-08-19  6:15 UTC (permalink / raw)
  To: Raymond Yau; +Cc: ALSA Development Mailing List

At Fri, 19 Aug 2011 07:53:44 +0200,
Takashi Iwai wrote:
> 
> At Fri, 19 Aug 2011 06:55:54 +0800,
> Raymond Yau wrote:
> > 
> > 2011/8/18 Takashi Iwai <tiwai@suse.de>:
> > > At Tue, 16 Aug 2011 13:31:52 +0100,
> > > Colin Guthrie wrote:
> > >>
> > >> > diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
> > >> > index c04d7c7..cdd19d7 100644
> > >> > --- a/sound/usb/mixer.c
> > >> > +++ b/sound/usb/mixer.c
> > >> > @@ -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 |
> > >>
> > >>
> > >>
> > >> Not had a chance to test this yet but I will when I get a moment.
> > >
> > > 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.

I meant something like below.


Takashi

---
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index cdd19d7..78a5abd 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -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
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: Lost dB volumes on USB headset between 2.6.38 and 3.0
  2011-08-19  6:15               ` Takashi Iwai
@ 2011-08-23  3:02                 ` Raymond Yau
  0 siblings, 0 replies; 15+ messages in thread
From: Raymond Yau @ 2011-08-23  3:02 UTC (permalink / raw)
  To: Takashi Iwai, ALSA Development Mailing List

2011/8/19 Takashi Iwai <tiwai@suse.de>:
> At Fri, 19 Aug 2011 07:53:44 +0200,
> Takashi Iwai wrote:
>>
>>
>> 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
>
> ---
> diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
> index cdd19d7..78a5abd 100644
> --- a/sound/usb/mixer.c
> +++ b/sound/usb/mixer.c
> @@ -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;
>

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

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

* Re: Lost dB volumes on USB headset between 2.6.38 and 3.0
  2011-08-18 15:18         ` Takashi Iwai
  2011-08-18 22:55           ` Raymond Yau
@ 2011-09-03 11:11           ` Colin Guthrie
  1 sibling, 0 replies; 15+ messages in thread
From: Colin Guthrie @ 2011-09-03 11:11 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: ALSA Development Mailing List, Clemens Ladisch, David Henningsson

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:
> At Tue, 16 Aug 2011 13:31:52 +0100,
> Colin Guthrie wrote:
>>
>>> diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
>>> index c04d7c7..cdd19d7 100644
>>> --- a/sound/usb/mixer.c
>>> +++ b/sound/usb/mixer.c
>>> @@ -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 |
>>
>>
>>
>> Not had a chance to test this yet but I will when I get a moment.
> 
> Any chance to test the patch?
> 
> 
> Takashi


-- 

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/]

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

end of thread, other threads:[~2011-09-03 11:11 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-09  9:52 Lost dB volumes on USB headset between 2.6.38 and 3.0 David Henningsson
2011-08-09 10:39 ` Clemens Ladisch
2011-08-09 11:19   ` David Henningsson
2011-08-09 11:19   ` Colin Guthrie
2011-08-09 12:40     ` Takashi Iwai
2011-08-16 12:31       ` Colin Guthrie
2011-08-16 13:41         ` David Henningsson
2011-08-16 14:00         ` Raymond Yau
2011-08-18 15:18         ` Takashi Iwai
2011-08-18 22:55           ` Raymond Yau
2011-08-19  5:53             ` Takashi Iwai
2011-08-19  6:15               ` Takashi Iwai
2011-08-23  3:02                 ` Raymond Yau
2011-09-03 11:11           ` Colin Guthrie
     [not found] <mailman.806.1313679978.2087.alsa-devel@alsa-project.org>
2011-08-19  2:19 ` Alex Wolfson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.