Sxmo:Oneplus6

Here are some tips and tricks to ease the use of sxmo on the Oneplus6/T

Sound issues
Sxmo images seem come with pipewire by default.

At the moment pipewire does not seem to work well (see https://gitlab.com/postmarketOS/pmaports/-/issues/1534). Sound volume is low and saturated (as if there were some too low gains as well as saturated ones on the sound path).

To get better results it is advised to switch back to pulse (sxmo supports alsa/pulse/pipewire). You can do so by removing the constraint on pipewire and installing pulseaudio :

$ sudo apk del sxmo-common-audio-pipewire $ sudo apk add sxmo-common-audio-pulse

If you use pmbootstrap to generate your image, you can add sxmo-common-audio-pulse to your extra packages, it will generate a correct image.

Sometimes sound stops to work in calls, it can sometimes be solved by reloading ucm files :

$ sudo alsaucm reload

Calls
Once sound problems are solved you should be able to make calls.

But as there is no proximity sensor (yet), when receiving calls, the screen stays black.

A workaround is to add sxmo_wm.sh dpms off to sxmo_hook_ring.sh.

Beware that it does not (intentionaly) turns on the touchscreen, you'll have to answer using the physical button.

Lisgd
Oneplus6 and Oneplus6t have round corners, and corner gestures might not work well.

One workaround is to recompile lisgd increasing edgesizes increasing it to 100 seems to work. Here is a diff of the changes that works for me.

diff --git a/config.def.h b/config.def.h index d07f50d..feb6003 100644 --- a/config.def.h +++ b/config.def.h @@ -16,10 +16,10 @@ unsigned int degreesleniency = 15; unsigned int timeoutms = 800; unsigned int orientation = 0; unsigned int verbose = 0; -double edgesizeleft = 50.0; -double edgesizetop = 50.0; -double edgesizeright = 50.0; -double edgesizebottom = 50.0; +double edgesizeleft = 100.0; +double edgesizetop = 100.0; +double edgesizeright = 100.0; +double edgesizebottom = 100.0; char *device = "/dev/input/touchscreen"; //Gestures can also be specified interactively from the command line using -g

Working around the notch
This can be done playing with gaps. On my OP6T, using SXMO_SWAY_SCALE=1 (my personal preference), the bar can be defined this way in .config/sxmo/sway

bar { position top gaps 30 30 0 40 height 46 # When the status_command prints a new line to stdout, swaybar updates. # The default just shows the current date and time. status_command sxmo_status_watch.sh -o pango swaybar_command /home/florent/bin/swaybar pango_markup enabled colors { statusline #ffffff background #00000000 inactive_workspace #32323200 #32323200 #5c5c5c font "sxmo" 22 }                                                                                                                         }

Then, to update the bars when rotating the screen you can use sxmo_rotate_hook.sh

case $1 in normal)   swaymsg bar bar-0 gaps 30 30 0 40    swaymsg bar bar-0 height 46    swaymsg gaps left all set 0    swaymsg gaps right all set 0    ;; left) swaymsg bar bar-0 gaps 0 80 0 80 swaymsg bar bar-0 height 40 swaymsg gaps left all set 0 swaymsg gaps right all set 80 ;; right)   swaymsg bar bar-0 gaps 0 80 0 80    swaymsg bar bar-0 height 40    swaymsg gaps left all set 80    swaymsg gaps right all set 0    ;; esac

The tristate button
Tristate button support has been included in the kernel and can be queried with evtest.

So if you type evtest /dev/input/event2 it should follow the state of your button (note: on my installation the top position (17) does not work, but it doesn't matter because middle and bottom position work and you can infer top from them). Here is what should happen when launching evtest and playing with the switch.

$ evtest /dev/input/event2 Input driver version is 1.0.1 Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100 Input device name: "Tri-state key" Supported events: Event type 0 (EV_SYN) Event type 5 (EV_SW) Event code 17 (?) state 1 Event code 18 (?) state 0 Event code 19 (?) state 1 Properties: Testing ... (interrupt to exit) Event: time 1686057348.435336, type 5 (EV_SW), code 18 (?), value 1 Event: time 1686057348.435336, -- SYN_REPORT Event: time 1686057348.439594, type 5 (EV_SW), code 19 (?), value 0 Event: time 1686057348.439594, -- SYN_REPORT Event: time 1686057349.312552, type 5 (EV_SW), code 19 (?), value 1 Event: time 1686057349.312552, -- SYN_REPORT Event: time 1686057349.348182, type 5 (EV_SW), code 18 (?), value 0 Event: time 1686057349.348182, -- SYN_REPORT Event: time 1686057349.788464, type 5 (EV_SW), code 18 (?), value 1 Event: time 1686057349.788464, -- SYN_REPORT Event: time 1686057350.658555, type 5 (EV_SW), code 18 (?), value 0 Event: time 1686057350.658555, -- SYN_REPORT Event: time 1686057351.145399, type 5 (EV_SW), code 18 (?), value 1 Event: time 1686057351.145399, -- SYN_REPORT Event: time 1686057351.159578, type 5 (EV_SW), code 19 (?), value 0 Event: time 1686057351.159578, -- SYN_REPORT Event: time 1686057351.974367, type 5 (EV_SW), code 19 (?), value 1 Event: time 1686057351.974367, -- SYN_REPORT Event: time 1686057352.121047, type 5 (EV_SW), code 18 (?), value 0

It should be possible to use evetest to query each position

evtest --query /dev/input/event2 5 18

The return code should be non-null if the switch is on the middle position. But if you issue that command, evtest fails with a Key 18 out of bounds. error. One dirty workaround is to recompile evtest removing the offending test. you can then test your switch for each position.

For instance, in my installation, I use the tristate switch to control suspend. So I added a wakelock in sxmo_hook_wakelocks.sh

if lowsw || midsw ; then sxmo_wakelock.sh lock tristate_disabled "$DEFAULT_DURATION" else sxmo_wakelock.sh unlock tristate_disabled fi
 * 1) tristate

lowsw and midsw are small utility scripts in my ~/bin

$ cat ~/bin/midsw myevt --query /dev/input/event2 5 18
 * 1) !/bin/bash

Vibration
You need to modify the hooks for vibraton to work. In fact default hooks does not set the second argument of sxmo_vibrate. To perceive something it needs to be set at least to 1000, 20000 is ok.

So to vibrate during 1s you should use :

$ sxmo_vibrate 10000 20000