Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Hills <mark@xwax.org>
To: alsa-devel@alsa-project.org
Subject: Per-host .asoundrc on shared $HOME
Date: Tue, 23 Apr 2013 21:41:27 +0100 (BST)	[thread overview]
Message-ID: <alpine.LNX.2.01.1304232118010.9238@localhost> (raw)

There is a very old thread [1] on alsa-user on this topic which seems to 
go through some yucky solutions. I have the same use case, and post some 
findings here.

Since pre-2003 alsa-lib calls wordexp(3) on the filenames. I am using the 
patch below in /usr/share/alsa/alsa.conf

It follows a precedent set by other files such as .Xdefaults-hostname.

I'd submit a patch, except there seems to be no guarantee that HOSTNAME is 
in the environment (on Slackware it is explicitly set in /etc/profile.) 
Without it I can only see a bash local variable.

>From the old thread I imagine this function (or at least this mail) would 
be useful to others.

Would it be better to patch the C code to provide a token (eg. '\h') that 
is substituted by the hostname? Or is it enough to assume that HOSTNAME 
would be set?

I didn't consider short vs. long hostnames, I suppose $HOSTNAME gives the 
user/admin some control over this.

This:

  ~/.asoundrc-$(hostname -s)

may work, but I don't see that forking a process is an option.

[1] http://thread.gmane.org/gmane.linux.alsa.user/27532/focus=27542

-- 
Mark


--- alsa.conf.orig	2013-04-23 21:22:45.105454493 +0100
+++ alsa.conf	2013-04-23 21:16:41.707053308 +0100
@@ -17,6 +17,7 @@
 			}
 			"/etc/asound.conf"
 			"~/.asoundrc"
+			"~/.asoundrc-$HOSTNAME"
 		]
 		errors false
 	}

                 reply	other threads:[~2013-04-23 20:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.01.1304232118010.9238@localhost \
    --to=mark@xwax.org \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox