Script fixes order of Multiple sound cards

Problems and successes with specific brands/models of computer audio hardware
Post Reply
Message
Author
User avatar
darkcity
Posts: 2534
Joined: Sun 23 May 2010, 19:16
Location: near here
Contact:

Script fixes order of Multiple sound cards

#1 Post by darkcity »

I've made a script in response to a post by OscarTalks and my own experiences-
http://www.murga-linux.com/puppy/viewto ... 017#641017

This script will fix the order that sound card modules are loaded at boot-up. When executed it set the order to that of the current boot-up - as prescribed by the file-
/proc/asound/modules
for example,

Code: Select all

 0 snd_intel8x0
 1 snd_ca0106
It takes this data and adds appropriate 'options' commands to-
/etc/modprobe.d/alsa-base.conf
for example

Code: Select all

# set snd mod order - start tag
options snd_intel8x0 index=0
options snd_ca0106 index=1
# set snd mod order - end tag
It will remove this block from anywhere in the alsa-base file and add the new one on to the end.

A back up of alsa-base is stored in temp.

---

I'm new to scripting any suggestions welcome. If people find it works and they like it maybe it could be called as standard after running the Mutliple-Sound-Card-Wizard . . .
Attachments
p-snd-car-order.tar.gz
(794 Bytes) Downloaded 689 times

User avatar
darkcity
Posts: 2534
Joined: Sun 23 May 2010, 19:16
Location: near here
Contact:

#2 Post by darkcity »

OscarTalks wrote: Excellent work! I feel this is an important issue and looks like you have made a major breakthrough. I will do some testing on my various machines over the next day or two and report back.

My oldest machine is the most interesting case. That one has a USB soundcard as the second one. Looking at /proc/asound/modules in that I see that 4 modules are loaded:-

0 snd_intel8x0
1 snd_mpu401
2 snd_intel8x0m
3 snd_usb_audio

In this case index 2 is the dial-up modem, but I am not sure what snd_mpu401 is. Looks like something to do with MIDI, but if something like that were to grab index 0 at boot then even with no extra soundcards I'm sure my sound would be gone. This module does not show up at all as a card in the list in Multiple Sound Card Wizard so I get one random number missing and the others randomly juggled around. The script will hopefully lock these numbers down.

I am not sure what the best final implementation of something like this should be. Maybe a separate tool, built into Multiple Sound Card Wizard or built into Woof since it may be advantageous to run it on all Puppies regardless of additional soundcards?

If you are taking the order from the list in /proc/asound/modules then I suppose you need to be sure that they are arranged in a satisfactory order before writing the lines to /etc/modprobe.d/alsa-base.conf
Thanks for testing. You are right that mpu401 is MIDI,
http://en.wikipedia.org/wiki/MPU-401

snd-index8x0m should be black listed, do you have this entry in the
/etc/modprobe.d/alsa-base.conf ?

Code: Select all

# Prevent abnormal drivers from grabbing index 0
options bt87x index=-2
options cx88_alsa index=-2
options saa7134-alsa index=-2
options snd-atiixp-modem index=-2
options snd-intel8x0m index=-2
options snd-via82xx-modem index=-2
options snd-usb-audio index=-2
options snd-usb-caiaq index=-2
options snd-usb-ua101 index=-2
options snd-usb-us122l index=-2
options snd-usb-usx2y index=-2
built into Multiple Sound Card Wizard or built into Woof since it may be advantageous to run it on all Puppies regardless of additional soundcards?
Although, it would be harmless to run with one soundcard it would also be pointless. Therefore, I think it should be run after multi-soundcard-wizard (mswiz).

mswiz writes to /etc/asound.conf

for example,

Code: Select all

defaults.pcm.card 1
defaults.pcm.device 0
In theory it should be irrelevant which card grabs the 'index 0', as 'index 0' != default. Not sure how alsamixer and retrovol handle it?

User avatar
darkcity
Posts: 2534
Joined: Sun 23 May 2010, 19:16
Location: near here
Contact:

#3 Post by darkcity »

two problems minor

-backup shouldn't be in /tmp as its wiped on reboot (probably best just to put an unnumbered backup in /etc/modprode.d ?)

-script probably won't work if your not running a root (not usually a problem on Puppy).

-----

-having trouble when ALSA doesn't define a driver for one of two cards, will report back

User avatar
darkcity
Posts: 2534
Joined: Sun 23 May 2010, 19:16
Location: near here
Contact:

#4 Post by darkcity »

the script no longer works with slacko 5.3.5 beta - it needs /root/mod - which is created by alsaconf

Code: Select all

# /mnt/sda2/supportlibs2/-sound/soundcard/p-snd-card-orderb
'/root/mod' not present. Try command - alsawizard.

Post Reply