Page 1 of 1
[SOLVED] change the order of the device ALSA
Posted: 22 Dec 2015, 21:49
by Slaxmax
I have a notebook with hdmi, but not work audio from hdmi
Code: Select all
guest@porteus:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 1: HDMI [HDA Intel HDMI], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA Intel HDMI], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: PCH [HDA Intel PCH], device 0: CX20751/2 Analog [CX20751/2 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
The card 1 is HDMI but I need on boot change to PCH.
How I can change this?
Note: KDE (Kmix) use the first device to default master channel
Re: change the order of the device ALSA
Posted: 22 Dec 2015, 22:25
by aus9
I don't use KDE but this should work for you if interested?
viewtopic.php?f=48&t=5109
try it live first by root
Code: Select all
sudo su
rmmod snd_hda_intel
modprobe snd_hda_intel index=1
now open your mixer....I guess you use kmix but I prefer command mode alsamixer
if the mixer shows your swapped card 1 hardware then unmute and change volumes etc and test sound
You would then save that file for persistence
Re: change the order of the device ALSA
Posted: 23 Dec 2015, 00:10
by donald
Re: change the order of the device ALSA
Posted: 23 Dec 2015, 03:44
by brokenman
Tought I would add a script to try
Code: Select all
#!/bin/bash
## Concept codeblock for rc.M to select non HDMI sound
## card when two controllers/cards are found.
## Author: brokenman
## 2nd May 2015
asnd="$HOME/.asound.conf"
pa=/proc/asound
cards=`ls /proc/asound/card[0-9]/id`
if [ `wc -w <<<$cards` -gt 1 ]; then
for a in $cards; do
[ `grep HDMI $a` ] && continue
crd=`cut -d'/' -f4 <<<$a|tr -d [:alpha:]`
cnam=`grep "Codec:" $pa/card${crd}/codec* | awk '{print$NF}'`
cdev=`awk "/$cnam/&&/Device:/" $pa/card${crd}/codec*|tail -n1|awk -F= '{print$NF}'`
done
[ $crd ] && echo "defaults.pcm.card $crd" > $asnd && \
echo "defaults.pcm.device $cdev" >> $asnd && \
echo "defaults.ctl.card $crd" >> $asnd
fi
Re: change the order of the device ALSA
Posted: 23 Dec 2015, 10:06
by fullmoonremix
Salutations...
@brokenman... does this script go in the /opt/porteus-scripts directory?
Best Regards...
Re: change the order of the device ALSA
Posted: 25 Dec 2015, 12:43
by aus9
@brokenman @donald
I am not sure if you agree but me thinks brokenman has got confused on the confusion of alsa config files?
AFAIK
system wide is normally /etc/asound.conf
while local user is (dot) .asoundrc
Since Porteus/Nemesis prefers one local called guest and obviously you can only have one root (admin) it makes sense to consider modify brokenman's script to
.asoundrc
@fullmoonremix
copy and paste his script as is and run it once assuming you boot up with a changes cheatcode
---then simply rename it from .asound.conf to .asoundrc
logout and login should be sufficient to see a change.
@brokenman
I just did this test to be sure before I posted.
with a .asound.conf my card is hdmi which of course does not suit me
with .asoundrc I get the full monty ignoring mixer levels.
or edit script from
asnd="$HOME/.asound.conf" to
asnd="$HOME/.asoundrc"
Re: change the order of the device ALSA
Posted: 27 Dec 2015, 14:28
by Slaxmax
Thanks guys
I tried many times and many methods, and now works
I make this file /etc/modprobe.b/alsa-base.conf
Code: Select all
# Set this to the correct number of cards.
options snd cards_limit=2
options snd-hda-intel id=PCH index=0
options snd-hda-intel id=HDMI index=1
snd-hda-intel is the kernel drive audio
id=PCH is the sound card output
id=HDMI is the hdmi sound output
index option change the order
PCH is default device now
Code: Select all
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: CX20751/2 Analog [CX20751/2 Analog]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA Intel HDMI], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA Intel HDMI], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
Now works sound in my laptop (Kmix use the first alsa device to master channel)
Re: [SOLVED] change the order of the device ALSA
Posted: 27 Dec 2015, 23:39
by aus9
feel free to mark post as solved.
BTW once you have defined something to grab index=0, nothing else can grab it and so next card gets index=1 so you might like to try removing the index=1 line?
Re: [SOLVED] change the order of the device ALSA
Posted: 11 Jan 2016, 01:52
by Slaxmax
aus9 wrote:feel free to mark post as solved.
BTW once you have defined something to grab index=0, nothing else can grab it and so next card gets index=1 so you might like to try removing the index=1 line?
Does not work. Only works as my post above.
Re: [SOLVED] change the order of the device ALSA
Posted: 11 Jan 2016, 04:58
by aus9
sorry are you saying having only this line
options snd-hda-intel id=PCH index=0
and rebooting and does not work?
Re: [SOLVED] change the order of the device ALSA
Posted: 12 Jan 2016, 00:49
by Slaxmax
if I use
options snd-hda-intel id=PCH index=0
not work, stay the same
if I use
options snd-hda-intel id=PCH index=0
options snd-hda-intel id=HDMI index=1
works fine
Re: [SOLVED] change the order of the device ALSA
Posted: 12 Jan 2016, 01:04
by aus9
ahh thanks for the expanded info
if you have time, then try one more time to use one line try with full reboot
options snd-hda-intel id=HDMI index=1