[PATCH] [Dapper] alsa-utils initscript is unable to sanify sound levels when using non-Ubuntu kernels newer than 2.6.15

Bug #43197 reported by Marc Bevand
10
Affects Status Importance Assigned to Milestone
alsa-utils (Ubuntu)
Fix Released
Wishlist
Martin Pitt

Bug Description

Running "/etc/init.d/alsa-utils reset" on my system wasn't actually sanitifying the sound levels of my card. I tracked down the pb and fixed it, see below for a patch. The pb is due to the fact that recent kernels (such as 2.6.16.4) pad the card number with spaces on the left in /proc/asound/cards.

--- alsa-utils.old 2005-09-29 07:42:54.000000000 -0700
+++ alsa-utils 2006-05-06 00:38:05.137288750 -0700
@@ -83,7 +83,7 @@
 echo_card_indices()
 {
        if [ -f /proc/asound/cards ] ; then
- sed -n -e's/^\([0-7]\)[[:space:]].*/\1/p' /proc/asound/cards
+ sed -n -e's/^[[:space:]]*\([0-7]\)[[:space:]].*/\1/p' /proc/asound/cards
        fi
 }

Revision history for this message
Daniel T Chen (crimsun) wrote :

Are you using a stock Ubuntu kernel (i.e., 2.6.15-22.33) in Dapper? On my system there is no leading whitespace:

crimsun@garnish:~$ cat /proc/asound/cards
0 [ICH6 ]: ICH4 - Intel ICH6
                     Intel ICH6 with AD1981B at 0xa0040800, irq 233
1 [USB ]: USB-Audio - Transit USB
                     M-Audio Transit USB at usb-0000:00:1d.1-1, full speed

On the other hand, your patch is non-intrusive and works regardless whether there is leading whitespace, so it should be applied in case it applies to the standard Ubuntu kernels.

Changed in alsa-utils:
status: Unconfirmed → Needs Info
Revision history for this message
Marc Bevand (bevand-m) wrote :

No I am using a vanilla kernel:

$ uname -a
Linux sheratan 2.6.16.4 #2 SMP Sat Apr 22 17:49:24 PDT 2006 x86_64 GNU/Linux
$ cat /proc/asound/cards
 0 [AMD8111 ]: ICH - AMD AMD8111
                      AMD AMD8111 with AD1981B at 0xc800, irq 21

Here is the relevant kernel source code to prove the number is padded, file sound/core/init.c, function snd_card_info_read():

  snd_iprintf(buffer, "%2i [%-15s]: %s - %s\n", idx, [...]

Notice the "%2i".

Revision history for this message
Daniel T Chen (crimsun) wrote :

Ok, then you're using an unsupported configuration. I suggest we still merge this patch in case people feel the need to use their own kernels.

Changed in alsa-utils:
status: Needs Info → Confirmed
Martin Pitt (pitti)
Changed in alsa-utils:
assignee: nobody → pitti
status: Confirmed → In Progress
Revision history for this message
Martin Pitt (pitti) wrote :

 alsa-utils (1.0.10-1ubuntu11) dapper; urgency=low
 .
   * debian/init, echo_card_indices(): Fix sed expression to accept leading
     spaces in front of card numbers. Kernels 2.6.16+ write the card number
     with '%2i'. Closes: LP#43197

Thank you!

Changed in alsa-utils:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.