[SOLVED] change the order of the device ALSA

Here you can post about your various experiences with PC hardware. You can also post about hardware that is not compatible with the linux kernel or not recommended for use with Porteus.
User avatar
Slaxmax
Contributor
Contributor
Posts: 408
Joined: 03 Jan 2013, 09:51
Distribution: KDE4
Location: Campinas Brazil https://goo.gl/yrxwKi

[SOLVED] change the order of the device ALSA

Post#1 by Slaxmax » 22 Dec 2015, 21:49

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
Last edited by Slaxmax on 27 Dec 2015, 14:28, edited 1 time in total.
“DNA is like a computer program but far, far more advanced than any software ever created.”
― Bill Gates, The Road Ahead

aus9

Re: change the order of the device ALSA

Post#2 by aus9 » 22 Dec 2015, 22:25

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

donald
Full of knowledge
Full of knowledge
Posts: 2065
Joined: 17 Jun 2013, 13:17
Distribution: Porteus 3.2.2 XFCE 32bit
Location: Germany

Re: change the order of the device ALSA

Post#3 by donald » 23 Dec 2015, 00:10

similar problem...(changed card 0 / card 1)
http://forum.porteus.org/viewtopic.php? ... 25&p=36037

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: change the order of the device ALSA

Post#4 by brokenman » 23 Dec 2015, 03:44

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
How do i become super user?
Wear your underpants on the outside and put on a cape.

fullmoonremix

Re: change the order of the device ALSA

Post#5 by fullmoonremix » 23 Dec 2015, 10:06

Salutations... :good:

@brokenman... does this script go in the /opt/porteus-scripts directory?

Best Regards... :beer:

aus9

Re: change the order of the device ALSA

Post#6 by aus9 » 25 Dec 2015, 12:43

@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"

User avatar
Slaxmax
Contributor
Contributor
Posts: 408
Joined: 03 Jan 2013, 09:51
Distribution: KDE4
Location: Campinas Brazil https://goo.gl/yrxwKi

Re: change the order of the device ALSA

Post#7 by Slaxmax » 27 Dec 2015, 14:28

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)
“DNA is like a computer program but far, far more advanced than any software ever created.”
― Bill Gates, The Road Ahead

aus9

Re: [SOLVED] change the order of the device ALSA

Post#8 by aus9 » 27 Dec 2015, 23:39

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?

User avatar
Slaxmax
Contributor
Contributor
Posts: 408
Joined: 03 Jan 2013, 09:51
Distribution: KDE4
Location: Campinas Brazil https://goo.gl/yrxwKi

Re: [SOLVED] change the order of the device ALSA

Post#9 by Slaxmax » 11 Jan 2016, 01:52

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.
“DNA is like a computer program but far, far more advanced than any software ever created.”
― Bill Gates, The Road Ahead

aus9

Re: [SOLVED] change the order of the device ALSA

Post#10 by aus9 » 11 Jan 2016, 04:58

sorry are you saying having only this line
options snd-hda-intel id=PCH index=0

and rebooting and does not work?

User avatar
Slaxmax
Contributor
Contributor
Posts: 408
Joined: 03 Jan 2013, 09:51
Distribution: KDE4
Location: Campinas Brazil https://goo.gl/yrxwKi

Re: [SOLVED] change the order of the device ALSA

Post#11 by Slaxmax » 12 Jan 2016, 00:49

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
“DNA is like a computer program but far, far more advanced than any software ever created.”
― Bill Gates, The Road Ahead

aus9

Re: [SOLVED] change the order of the device ALSA

Post#12 by aus9 » 12 Jan 2016, 01:04

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

Post Reply