~mil/sxmo-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
6 3

[PATCH sxmo-utils 0/4] Add support for env device profiles

Details
Message ID
<20210423174515.3697034-1-clayton@craftyguy.net>
DKIM signature
pass
Download raw message
This series adds support for having device profiles, which set/override
env vars in sxmo for anything that requires device-specific values.

The series includes 1 profile (well, 3, but they're symlinked..) for the
Librem 5, basic audio seems to be working with this (speaker/mic),
headset audio out is untested though.

The audio scripts were changed to default to the existing values if none
are set in the env, so this should continue working on the pinephone
without any explicit profile.. but it might not be a bad idea to add an
explicit pinephone profile later on.


Clayton Craft (4):
  sxmo_xinit: add support for overriding vars with device-specific
    profiles
  sxmo_audioout: use existing env vars for audio devices
  sxmo_audiocurrentdevice: use existing env vars for audio devices
  sxmo_deviceprofile_librem5*: add initial profile for librem5

 scripts/core/sxmo_audiocurrentdevice.sh                | 10 +++++++---
 scripts/core/sxmo_audioout.sh                          |  6 +++---
 scripts/core/sxmo_xinit.sh                             |  9 +++++++++
 .../sxmo_deviceprofile_librem5r2purism.sh              |  1 +
 .../sxmo_deviceprofile_librem5r3purism.sh              |  1 +
 .../sxmo_deviceprofile_librem5r4purism.sh              |  3 +++
 6 files changed, 24 insertions(+), 6 deletions(-)
 create mode 120000 scripts/deviceprofiles/sxmo_deviceprofile_librem5r2purism.sh
 create mode 120000 scripts/deviceprofiles/sxmo_deviceprofile_librem5r3purism.sh
 create mode 100644 scripts/deviceprofiles/sxmo_deviceprofile_librem5r4purism.sh

-- 
2.31.1

[PATCH sxmo-utils 1/4] sxmo_xinit: add support for overriding vars with device-specific profiles

Details
Message ID
<20210423174515.3697034-2-clayton@craftyguy.net>
In-Reply-To
<20210423174515.3697034-1-clayton@craftyguy.net> (view parent)
DKIM signature
pass
Download raw message
Patch: +9 -0
This reads base/compatible from the devicetree to get the device name,
and sources a script in /bin with a filename in the format
'sxmo_deviceprofile_NAME.sh'. The purpose of this is to allow
setting/overriding variables in other sxmo scripts with device-specific
values. For example, some audio devices on one phone may have different
names on another.
---
 scripts/core/sxmo_xinit.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/scripts/core/sxmo_xinit.sh b/scripts/core/sxmo_xinit.sh
index 148905a..22b3ab8 100755
--- a/scripts/core/sxmo_xinit.sh
+++ b/scripts/core/sxmo_xinit.sh
@@ -20,6 +20,13 @@ envvars() {
	[ -z "$XDG_PICTURES_DIR" ] && export XDG_PICTURES_DIR=~/Pictures
}

device_envvars() {
	device="$(cut -d ',' -f 2 < /sys/firmware/devicetree/base/compatible)"
	deviceprofile="$(which "sxmo_deviceprofile_$device.sh")"
	# shellcheck disable=SC1090
	[ -f "$deviceprofile" ] && . "$deviceprofile"
}

setupxdgdir() {
	mkdir -p $XDG_RUNTIME_DIR
	chmod 700 $XDG_RUNTIME_DIR
@@ -117,6 +124,8 @@ xinit() {
	. "$(dirname "$0")/sxmo_common.sh"

	envvars
	# set device env vars here to allow potentially overriding envvars
	device_envvars
	setupxdgdir
	xdefaults
	daemons
-- 
2.31.1

[PATCH sxmo-utils 2/4] sxmo_audioout: use existing env vars for audio devices

Details
Message ID
<20210423174515.3697034-3-clayton@craftyguy.net>
In-Reply-To
<20210423174515.3697034-1-clayton@craftyguy.net> (view parent)
DKIM signature
pass
Download raw message
Patch: +3 -3
If the env variables in this script are set, use those values. Else it
defaults to using the values set before this patch.
---
 scripts/core/sxmo_audioout.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/core/sxmo_audioout.sh b/scripts/core/sxmo_audioout.sh
index 9311ab7..310f307 100755
--- a/scripts/core/sxmo_audioout.sh
+++ b/scripts/core/sxmo_audioout.sh
@@ -5,9 +5,9 @@ ARG="$1"
# shellcheck source=scripts/core/sxmo_common.sh
. "$(dirname "$0")/sxmo_common.sh"

SPEAKER="Line Out"
HEADPHONE="Headphone"
EARPIECE="Earpiece"
${SPEAKER:-"Line Out"}
${HEADPHONE:-"Headphone"}
${EARPIECE:-"Earpiece"}

amixer set "$SPEAKER" mute
amixer set "$HEADPHONE" mute
-- 
2.31.1

[PATCH sxmo-utils 3/4] sxmo_audiocurrentdevice: use existing env vars for audio devices

Details
Message ID
<20210423174515.3697034-4-clayton@craftyguy.net>
In-Reply-To
<20210423174515.3697034-1-clayton@craftyguy.net> (view parent)
DKIM signature
pass
Download raw message
Patch: +7 -3
---
 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

[PATCH sxmo-utils 4/4] sxmo_deviceprofile_librem5*: add initial profile for librem5

Details
Message ID
<20210423174515.3697034-5-clayton@craftyguy.net>
In-Reply-To
<20210423174515.3697034-1-clayton@craftyguy.net> (view parent)
DKIM signature
pass
Download raw message
Patch: +5 -0
Currently there are 3 revisions of the L5, and they are all sharing the
same profile here since this only sets audio vars and they're all the
same. In the future the symlinks can be broken if profiles need to
deviate for some reason in order to set different values for vars, etc.
---
 scripts/deviceprofiles/sxmo_deviceprofile_librem5r2purism.sh | 1 +
 scripts/deviceprofiles/sxmo_deviceprofile_librem5r3purism.sh | 1 +
 scripts/deviceprofiles/sxmo_deviceprofile_librem5r4purism.sh | 3 +++
 3 files changed, 5 insertions(+)
 create mode 120000 scripts/deviceprofiles/sxmo_deviceprofile_librem5r2purism.sh
 create mode 120000 scripts/deviceprofiles/sxmo_deviceprofile_librem5r3purism.sh
 create mode 100644 scripts/deviceprofiles/sxmo_deviceprofile_librem5r4purism.sh

diff --git a/scripts/deviceprofiles/sxmo_deviceprofile_librem5r2purism.sh b/scripts/deviceprofiles/sxmo_deviceprofile_librem5r2purism.sh
new file mode 120000
index 0000000..0c2d509
--- /dev/null
+++ b/scripts/deviceprofiles/sxmo_deviceprofile_librem5r2purism.sh
@@ -0,0 +1 @@
sxmo_deviceprofile_librem5r4purism.sh
\ No newline at end of file
diff --git a/scripts/deviceprofiles/sxmo_deviceprofile_librem5r3purism.sh b/scripts/deviceprofiles/sxmo_deviceprofile_librem5r3purism.sh
new file mode 120000
index 0000000..0c2d509
--- /dev/null
+++ b/scripts/deviceprofiles/sxmo_deviceprofile_librem5r3purism.sh
@@ -0,0 +1 @@
sxmo_deviceprofile_librem5r4purism.sh
\ No newline at end of file
diff --git a/scripts/deviceprofiles/sxmo_deviceprofile_librem5r4purism.sh b/scripts/deviceprofiles/sxmo_deviceprofile_librem5r4purism.sh
new file mode 100644
index 0000000..a81f36a
--- /dev/null
+++ b/scripts/deviceprofiles/sxmo_deviceprofile_librem5r4purism.sh
@@ -0,0 +1,3 @@
export SPEAKER="Speaker"
export HEADPHONE="Headphone"
export EARPIECE="Earpiece"
-- 
2.31.1

[sxmo-utils/patches/.build.yml] build failed

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CAVAHC1XPQMT.37N6QM69IMRSM@cirno>
In-Reply-To
<20210423174515.3697034-5-clayton@craftyguy.net> (view parent)
DKIM signature
missing
Download raw message
sxmo-utils/patches/.build.yml: FAILED in 21s

[Add support for env device profiles][0] from [Clayton Craft][1]

[0]: https://lists.sr.ht/~mil/sxmo-devel/patches/22251
[1]: clayton@craftyguy.net

✗ #494315 FAILED sxmo-utils/patches/.build.yml https://builds.sr.ht/~mil/job/494315

Re: [PATCH sxmo-utils 1/4] sxmo_xinit: add support for overriding vars with device-specific profiles

Details
Message ID
<874kfwsnbq.fsf@momi.ca>
In-Reply-To
<20210423174515.3697034-2-clayton@craftyguy.net> (view parent)
DKIM signature
pass
Download raw message
Hi Clayton!

This patch is great! I have been thinking of a clean way to fix these
issues for a while and you gave a very elegant solution.

I have fixed the shellcheck issues and merged.

To git.sr.ht:~mil/sxmo-utils
   b5e5387..7d9b86b  master -> master

Take care!
Anjan Momi
-- 
w:] www.momi.ca
pgp:] https://momi.ca/publickey.txt
Reply to thread Export thread (mbox)