Package: sl-modem
Version: 2.9.11~20080817-3
Tags: patch
User: [email protected]
Usertags: ubuntu-patch origin-ubuntu jaunty

Hello!

Peteris submitted a patch in https://launchpad.net/bugs/298424 which
makes the init script detect ALSA subdevices which only expose
themselves in "aplay -l", not in /proc/asound/cards:

$ cat /proc/asound/cards
 0 [Intel ]: HDA-Intel - HDA Intel
                      HDA Intel at 0xf4700000 irq 16

$ aplay -l is:
**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: AD198x Analog [AD198x Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 6: Si3054 Modem [Si3054 Modem]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Headset [Logitech USB Headset], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

Thank you for considering!

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
* debian/sl-modem-daemon.init: Also check for modems which are
  subdevices, and thus only expose themselves in "aplay -l", not in
  /proc/asound/cards. Thanks to Peteris Krisjanis for the patch! 
  (LP: #298424)
diff -u sl-modem-2.9.11~20080817/debian/sl-modem-daemon.init 
sl-modem-2.9.11~20080817/debian/sl-modem-daemon.init
--- sl-modem-2.9.11~20080817/debian/sl-modem-daemon.init
+++ sl-modem-2.9.11~20080817/debian/sl-modem-daemon.init
@@ -35,24 +35,45 @@
 
 alsaload() {
 
-    unset line;
+    unset aplay_grep_line;
+    unset proc_grep;
 
-    # first check to not do unneccessary modprobe calls. Some people even put
-    # it into the kernel image
+    # first check for situation when there is modem subdevice (aplay -l output 
have "(M|m)odem" string, and /proc/asound/cards doesn't).
+    # this one doesn't need modprobe (modem is part of sound card chip)
 
-    if ! line=$(grep -i "\[Modem   " /proc/asound/cards 2>/dev/null) ; then
-        for x in $driverlist ; do $modprobe $x 2>/dev/null ; done
+    if ! proc_grep=$(grep -i "\[Modem   " /proc/asound/cards) ; then
+    # if there is aplay output, get card and device numbers and form 
SLMODEMD_DEVICE as hw:a,b
+        if aplay_grep=$(aplay -l | egrep '^card [0-9].*(M|m)odem') ; then
+            aplay_grep_line=$(echo "$aplay_grep" | sed -r 's/^card 
([[:digit:]]+).*device ([[:digit:]]+).*$/\1 \2/')
+
+            # Let's configure subdevice
+            if [ -n "$aplay_grep_line" ] ; then
+                set $aplay_grep_line
+                # This one needs hw as prefix
+                ALSADEVPREFIX="hw"
+                SLMODEMD_DEVICE="$ALSADEVPREFIX:$1,$2"
+                ALSA=yes
+                return 0
+            fi
+       # if there is no aplay and proc output, try to modprobe and then check 
for modem cards again
+        else
+            # first check to not do unneccessary modprobe calls. Some people 
even put
+            # it into the kernel image
 
-        for start_reps in `seq 100` ; do
-            test -e /proc/asound/cards && line=$(grep -i "\[Modem   " -i 
/proc/asound/cards) && (aplay -l | egrep '^card [0-9]*\: Modem ' >/dev/null) && 
break
-            sleep 0.1
-        done
-    fi
+            for x in $driverlist ; do $modprobe $x 2>/dev/null ; done
 
-    if test "$line" ; then
-        # ALSA driver is loaded, use it
+            for start_reps in `seq 100` ; do
+                test -e /proc/asound/cards && proc_grep=$(grep -i "\[Modem   " 
-i /proc/asound/cards) && (aplay -l | egrep '^card [0-9]*\: Modem ' >/dev/null) 
&& break
+                sleep 0.1
+            done
 
-        set $line
+        fi
+    fi
+       
+    # if we got proc_grep (already existed or from previous if), let's use it 
to form SLMODEMD_DEVICE as modem:a
+    if [ -n "$proc_grep" ] ; then
+        # ALSA driver is loaded, use it
+        set $proc_grep
         SLMODEMD_DEVICE=$ALSADEVPREFIX:$1
         ALSA=yes
         return 0

Attachment: signature.asc
Description: Digital signature

Reply via email to