This make using Sxmo on a desktop machine way more straigh forward.
Just install Sxmo and run it.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
---
configs/default_hooks/pine64,pinebook | 1 +configs/default_hooks/pine64,pinebook-pro | 1 +configs/default_hooks/pine64,rockpro64-v2.1 | 1 +configs/profile.d/sxmo_init.sh | 39 +++++++++++--------
.../sxmo_deviceprofile_desktop.sh | 2 +
.../sxmo_deviceprofile_pine64,pinebook-pro.sh | 1 +
.../sxmo_deviceprofile_pine64,pinebook.sh | 1 +
...xmo_deviceprofile_pine64,rockpro64-v2.1.sh | 1 +
8 files changed, 30 insertions(+), 17 deletions(-)
create mode 120000 configs/default_hooks/pine64,pinebook
create mode 120000 configs/default_hooks/pine64,pinebook-pro
create mode 120000 configs/default_hooks/pine64,rockpro64-v2.1
create mode 100644 scripts/deviceprofiles/sxmo_deviceprofile_desktop.sh
create mode 120000 scripts/deviceprofiles/sxmo_deviceprofile_pine64,pinebook-pro.sh
create mode 120000 scripts/deviceprofiles/sxmo_deviceprofile_pine64,pinebook.sh
create mode 120000 scripts/deviceprofiles/sxmo_deviceprofile_pine64,rockpro64-v2.1.sh
diff --git a/configs/default_hooks/pine64,pinebook b/configs/default_hooks/pine64,pinebook
new file mode 120000
index 0000000..00c89fd
--- /dev/null+++ b/configs/default_hooks/pine64,pinebook
@@ -0,0 +1 @@
+desktop/
\ No newline at end of file
diff --git a/configs/default_hooks/pine64,pinebook-pro b/configs/default_hooks/pine64,pinebook-pro
new file mode 120000
index 0000000..00c89fd
--- /dev/null+++ b/configs/default_hooks/pine64,pinebook-pro
@@ -0,0 +1 @@
+desktop/
\ No newline at end of file
diff --git a/configs/default_hooks/pine64,rockpro64-v2.1 b/configs/default_hooks/pine64,rockpro64-v2.1
new file mode 120000
index 0000000..00c89fd
--- /dev/null+++ b/configs/default_hooks/pine64,rockpro64-v2.1
@@ -0,0 +1 @@
+desktop/
\ No newline at end of file
diff --git a/configs/profile.d/sxmo_init.sh b/configs/profile.d/sxmo_init.sh
index 76c4c94..a9e544b 100644
--- a/configs/profile.d/sxmo_init.sh+++ b/configs/profile.d/sxmo_init.sh
@@ -80,29 +80,34 @@ _sxmo_load_environments() {
export BROWSER="${BROWSER:-firefox}"
export SHELL="${SHELL:-/bin/sh}"
- # The user can already forced a $SXMO_DEVICE_NAME value+ # The user can already force a $SXMO_DEVICE_NAME value in ~/.profile if [ -z "$SXMO_DEVICE_NAME" ] && [ -e /proc/device-tree/compatible ]; then
SXMO_DEVICE_NAME="$(tr -c '\0[:alnum:].,-' '_' < /proc/device-tree/compatible |
tr '\0' '\n' | head -n1)"
- export SXMO_DEVICE_NAME- deviceprofile="$(command -v "sxmo_deviceprofile_$SXMO_DEVICE_NAME.sh")"- # shellcheck disable=SC1090- if [ -f "$deviceprofile" ]; then- . "$deviceprofile"- printf "deviceprofile file %s loaded.\n" "$deviceprofile"- else- printf "WARNING: deviceprofile file not found for %s. Most device functions will not work. Please read: https://sxmo.org/deviceprofile \n" "$SXMO_DEVICE_NAME"+ fi++ if [ -z "$SXMO_DEVICE_NAME" ]; then+ SXMO_DEVICE_NAME=desktop+ fi++ export SXMO_DEVICE_NAME+ deviceprofile="$(command -v "sxmo_deviceprofile_$SXMO_DEVICE_NAME.sh")"+ # shellcheck disable=SC1090+ if [ -f "$deviceprofile" ]; then+ . "$deviceprofile"+ printf "deviceprofile file %s loaded.\n" "$deviceprofile"+ else+ printf "WARNING: deviceprofile file not found for %s. Most device functions will not work. Please read: https://sxmo.org/deviceprofile \n" "$SXMO_DEVICE_NAME"- # on a new device, power button won't work- # so make sure we don't go into screenoff- # or suspend- touch "$XDG_CACHE_HOME"/sxmo/sxmo.nosuspend- touch "$XDG_CACHE_HOME"/sxmo/sxmo.noidle+ # on a new device, power button won't work+ # so make sure we don't go into screenoff+ # or suspend+ touch "$XDG_CACHE_HOME"/sxmo/sxmo.nosuspend+ touch "$XDG_CACHE_HOME"/sxmo/sxmo.noidle- SXMO_DEVICE_NAME=unknown- fi- unset deviceprofile+ SXMO_DEVICE_NAME=unknown fi
+ unset deviceprofile if [ -n "$SXMO_DEVICE_NAME" ]; then
_device_hooks_path="$(xdg_data_path "sxmo/default_hooks/$SXMO_DEVICE_NAME" 0 ':')"
diff --git a/scripts/deviceprofiles/sxmo_deviceprofile_desktop.sh b/scripts/deviceprofiles/sxmo_deviceprofile_desktop.sh
new file mode 100644
index 0000000..449318e
--- /dev/null+++ b/scripts/deviceprofiles/sxmo_deviceprofile_desktop.sh
@@ -0,0 +1,2 @@
+export SXMO_DISABLE_LEDS=1+export SXMO_STATUS_DATE_FORMAT="%Y-%m-%d %H:%M"
diff --git a/scripts/deviceprofiles/sxmo_deviceprofile_pine64,pinebook-pro.sh b/scripts/deviceprofiles/sxmo_deviceprofile_pine64,pinebook-pro.sh
new file mode 120000
index 0000000..bb90917
--- /dev/null+++ b/scripts/deviceprofiles/sxmo_deviceprofile_pine64,pinebook-pro.sh
@@ -0,0 +1 @@
+sxmo_deviceprofile_desktop.sh
\ No newline at end of file
diff --git a/scripts/deviceprofiles/sxmo_deviceprofile_pine64,pinebook.sh b/scripts/deviceprofiles/sxmo_deviceprofile_pine64,pinebook.sh
new file mode 120000
index 0000000..bb90917
--- /dev/null+++ b/scripts/deviceprofiles/sxmo_deviceprofile_pine64,pinebook.sh
@@ -0,0 +1 @@
+sxmo_deviceprofile_desktop.sh
\ No newline at end of file
diff --git a/scripts/deviceprofiles/sxmo_deviceprofile_pine64,rockpro64-v2.1.sh b/scripts/deviceprofiles/sxmo_deviceprofile_pine64,rockpro64-v2.1.sh
new file mode 120000
index 0000000..bb90917
--- /dev/null+++ b/scripts/deviceprofiles/sxmo_deviceprofile_pine64,rockpro64-v2.1.sh
@@ -0,0 +1 @@
+sxmo_deviceprofile_desktop.sh
\ No newline at end of file
--
2.41.0
This change:
> +> + if [ -z "$SXMO_DEVICE_NAME" ]; then> + SXMO_DEVICE_NAME=desktop> + fi> +> + export SXMO_DEVICE_NAME> + deviceprofile="$(command -v "sxmo_deviceprofile_$SXMO_DEVICE_NAME.sh")"> + # shellcheck disable=SC1090> + if [ -f "$deviceprofile" ]; then> + . "$deviceprofile"> + printf "deviceprofile file %s loaded.\n" "$deviceprofile"
will cause this branch to never run:
> + else> + printf "WARNING: deviceprofile file not found for %s. Most device functions will not work. Please read: https://sxmo.org/deviceprofile \n" "$SXMO_DEVICE_NAME">> - # on a new device, power button won't work> - # so make sure we don't go into screenoff> - # or suspend> - touch "$XDG_CACHE_HOME"/sxmo/sxmo.nosuspend> - touch "$XDG_CACHE_HOME"/sxmo/sxmo.noidle> + # on a new device, power button won't work> + # so make sure we don't go into screenoff> + # or suspend> + touch "$XDG_CACHE_HOME"/sxmo/sxmo.nosuspend> + touch "$XDG_CACHE_HOME"/sxmo/sxmo.noidle>> - SXMO_DEVICE_NAME=unknown> - fi> - unset deviceprofile> + SXMO_DEVICE_NAME=unknown> fi
Not sure how to fix but I dont think we want all unknown devices to load the desktop profile.
Thanks,
Anjan
--
w:] www.momi.ca
pgp:] https://momi.ca/publickey.txt
I confess I have to change the rest of the script cause atm this is a
bit confusing. I'll also clarify how SXMO_DEVICE_NAME is computed.
But yes, the goal is to fallback to "desktop", when there is no
/proc/device-tree/compatible. Is that a problem to you?
"Willow Barraco" <contact@willowbarraco.fr> writes:
> I confess I have to change the rest of the script cause atm this is a> bit confusing. I'll also clarify how SXMO_DEVICE_NAME is computed.>> But yes, the goal is to fallback to "desktop", when there is no> /proc/device-tree/compatible. Is that a problem to you?
Ideally, if there is no deviceprofile written for Sxmo for a given
device, I want to disable suspend and give the user a warning.
Is there no /proc/device-tree/compatible on desktop always?
Thanks,
Anjan
--
w:] www.momi.ca
pgp:] https://momi.ca/publickey.txt
> > I confess I have to change the rest of the script cause atm this is a> > bit confusing. I'll also clarify how SXMO_DEVICE_NAME is computed.> >> > But yes, the goal is to fallback to "desktop", when there is no> > /proc/device-tree/compatible. Is that a problem to you?>> Ideally, if there is no deviceprofile written for Sxmo for a given> device, I want to disable suspend and give the user a warning.
If a device-tree compatible string is available, but no device profile,
we already and still disable suspend and give the user a notice.
> Is there no /proc/device-tree/compatible on desktop always?
This is exposed when a device-tree is used by the kernel to boot. It
happen mostly on mobile or other arm devices, but can still happen on
some regular desktop.
This patch preserve the current behaviors on new devices. This only
fallback to desktop when there is no device-tree used, which mostly
happen on regular desktops.
I think it is preferable now that it become easier to install the full
Sxmo experience on regular distros.