Universal HDMI Sound (...Plug n' Play 4 Porteus)

New features which should be implemented in Porteus; suggestions are welcome. All questions or problems with testing releases (alpha, beta, or rc) should go in their relevant thread here, rather than the Bug Reports section.
User avatar
blue4meridian
Shogun
Shogun
Posts: 279
Joined: 29 Sep 2014, 05:58
Distribution: 64bit LxQt (Plastique/Mikachu)
Location: Jersey City N.J. USA

Re: Universal HDMI Sound (...Plug n' Play 4 Porteus)

Post#46 by blue4meridian » 26 Sep 2015, 11:14

Salutations... :good:

I was thinking along the lines of the script you mentioned that senses the device output
that is plugged in and automatically connects it and/or switches it (hotswapping?).

More or less what Google does with Android. I have a few of those plug and play devices.
I'm just not sure how they do it. Perhaps it might be proprietary.

Or... possibly using Arch OSS-->PulseAudio-->QtJack could be the solution?

Best Regards... :beer:

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

Re: Universal HDMI Sound (...Plug n' Play 4 Porteus)

Post#47 by brokenman » 26 Sep 2015, 22:16

The script would do essentially what I just posted (based on your output). I still have the set of scripts here, but from memory the udev implementation was buggy. This is what makes it plug and play. In its current state I was not happy releasing it.

Here is the main script for providing HDMI audio (once you have plugged in):
---------------------------
#!/bin/bash

hdmin=$1

## Backup existing asound.conf
asnd="/etc/asound.conf"
[ -f $asnd ] && mv $asnd ${asnd}.bak

## Get HDMI sound card/device number
cardnum=`aplay -l | awk '/HDMI '$hdmin'/{print$2}' | sed 's/://'`
devnum=`aplay -l | awk '/HDMI '$hdmin'/{print$8}' | sed 's/://'`

## Generate asound.conf
echo "defaults.pcm.card $cardnum" > $asnd
echo "defaults.pcm.device $devnum" >> $asnd
echo "defaults.ctl.card $cardnum" >> $asnd
---------------------------

Then you can test your speakers:
speaker-test -t sin -l 1

WARNING: This sound is irritating so be ready to ctrl + c to exit.
How do i become super user?
Wear your underpants on the outside and put on a cape.

fullmoonremix

Re: Universal HDMI Sound (...Plug n' Play 4 Porteus)

Post#48 by fullmoonremix » 02 Dec 2015, 00:16

Salutations... :good:

Would this script work with OSS?
I now have some udev rules that automatically send video to HDMI when it is plugged.
I'm not really familiar with "udev" but exactly how would I configure these rules for OSS.
I'm not the brightest bulb in the pack... however I'm a quick study if things are broken down for me.

Best Regards... :beer:

Post Reply