Authentication-Results: mail-b.sr.ht; dkim=pass header.d=craftyguy.net header.i=@craftyguy.net Received: from mout-p-103.mailbox.org (mout-p-103.mailbox.org [80.241.56.161]) by mail-b.sr.ht (Postfix) with ESMTPS id 9EC2011F059 for <~mil/sxmo-devel@lists.sr.ht>; Fri, 23 Apr 2021 17:45:32 +0000 (UTC) Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4FRhXC4RyYzQjwy; Fri, 23 Apr 2021 19:45:31 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=craftyguy.net; s=MBO0001; t=1619199929; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zEbCA1BNzxpgRFYHzbtYRZRtiwljkwOnoWl9iXnmTAg=; b=dBICtpF3GjuRBehIccn5V1hwYx+F8tNBn90zeDSFwT7ouNBeDyAx9jXzsyBdf8SCHLcTYJ iwxD2kZqwGpj0SDFAt/q3lpcboFrli9IgLZ92CFG96U8apTZqpUt4zhW8kmBLQsrf0/1GK s/+LI2Rf4Dtah5fUwWR0jOtNuvEafW3E3MIY5oc3x5ejYlj7zMEQfEKLzCOmVGDZRYCu7G D8Q23Kf1oZwuKIgyARq3Tal1wlVy1MuK+TNm/ORIZ44E6SukP9AcmHRJQMBll7myTKXZzx fn8GHYz19vEOCOI9SYNpRTCcOZt5BG2Ej1x02T5Jt9mRSo0t6Yz55+T4HVsM1A== Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id mbMGHM6Shwia; Fri, 23 Apr 2021 19:45:28 +0200 (CEST) From: Clayton Craft To: ~mil/sxmo-devel@lists.sr.ht Subject: [PATCH sxmo-utils 3/4] sxmo_audiocurrentdevice: use existing env vars for audio devices Date: Fri, 23 Apr 2021 10:45:14 -0700 Message-Id: <20210423174515.3697034-4-clayton@craftyguy.net> In-Reply-To: <20210423174515.3697034-1-clayton@craftyguy.net> References: <20210423174515.3697034-1-clayton@craftyguy.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-MBO-SPAM-Probability: X-Rspamd-Score: -4.76 / 15.00 / 15.00 X-Rspamd-Queue-Id: BF5C0243 X-Rspamd-UID: 49afe6 --- scripts/core/sxmo_audiocurrentdevice.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/core/sxmo_audiocurrentdevice.sh b/scripts/core/sxmo_audiocurrentdevice.sh index 37a20aa..ddef734 100755 --- a/scripts/core/sxmo_audiocurrentdevice.sh +++ b/scripts/core/sxmo_audiocurrentdevice.sh @@ -1,8 +1,12 @@ #!/usr/bin/env sh +${SPEAKER:-"Line Out"} +${HEADPHONE:-"Headphone"} +${EARPIECE:-"Earpiece"} + audiodevice() { - amixer sget "Earpiece" | grep -qE '\[on\]' && echo Earpiece && return - amixer sget "Headphone" | grep -qE '\[on\]' && echo Headphone && return - amixer sget "Line Out" | grep -qE '\[on\]' && echo Line Out && return + amixer sget "$EARPIECE" | grep -qE '\[on\]' && echo "$EARPIECE" && return + amixer sget "$HEADPHONE" | grep -qE '\[on\]' && echo "$HEADPHONE" && return + amixer sget "$SPEAKER" | grep -qE '\[on\]' && echo "$SPEAKER" && return echo "None" } -- 2.31.1