User:Magdesign

From postmarketOS Wiki

Creator of the opensource multimedia server https://pocketvj.com

Opensource nomad cycling the world since September 2022.

     __o
   _ \<_
  (_)/(_)  #linuxmobile

The idea to travel the world with an opensource phone died after hacking a year on pinephone and librem5 and a month before leaving, the pinephonepro started to melt on the backside...

I really do like to write documentation/howto/wiki and therefore I'd love to be a part of PostmarketOS community. Believe it or not, all the stuff is written on my pmos or my android phone, even the scripts, which took a lot of time and nerves. If you read this, drop me a line, it motivates me to know that you read the page here...

xmpp: magdesign@conversations.im

Love and hate my OP6 running sxmo (daily driving since 3. Feb. 24).

Update: out of frustration I physicaly broke an OP6 into two parts. It just does not make sense to be part of the testing team when reporting commit xy breaks something, it gets ignored over several iterations until one of the core team experience the same problem on their device. This was such a frustrating experience and I also learned that a lot of users dont make noise if a new kernel version breaks things, they rather compile their own to get things fixed for them. Or since 2 years people complain about gps not working, but its just an outdated ModemManager in the edge repo and the lack of knowledge that geoclue must be enabled by hand. So many energy of people gets wasted for shit like that..

The downside on projects like this is, that you have to make terrible loud noise if some update breaks things or if you made a patch/fix.

Lack of structure/roadmap and of clean documentation is a big issue. I gave my best on the latter. (People, please stop putting knowledge into discord, youtube, matrix, masto etc. the lifespawn of this medias is way too short). Thanks to everyone for this amazing project and all the effort you are putting into this. I am doing a big step back now and stay more quiet, there are other things to explore...

btw. gps for navigation does work!

podcast: https://cast.postmarketos.org/episode/39-Interview-magdesign/

git: https://codeberg.org/magdesign/

masto: @pocketvj@fosstodon.org

gemini://magdesign.flounder.online/index.gmi

about our travels:

https://pixelfed.social/cyclingtogether

https://odysee.com/@sharinggoodmoments

                           __ _ 
 _____  ___ __ ___   ___  / _/ |
/ __\ \/ / '_ ` _ \ / _ \| |_| |
\__ \>  <| | | | | | (_) |  _| |
|___/_/\_\_| |_| |_|\___/|_| |_|
          _ _    _ 
__      _(_) | _(_)
\ \ /\ / / | |/ / |
 \ V  V /| |   <| |
  \_/\_/ |_|_|\_\_|
                                
              

Owns devices

Device Notes
Xiaomi Poco F1 (xiaomi-beryllium) sxmo, daily, many hacks


Pocof1 pmos sxmo sxmop6.jpg

Userscripts

I wrote some useful scripts for op6 users. Since my op6 broke,the script now also works for pocof1.

Clone the repo to your home and for the major fixes you can use the deploy_sxmop6.sh installer 🤓

There are some very nice fixes in sxmo_networks.sh which never went upstream, e.g. not showing double names of wifi networks, not asking for pw when a wifi is without a pw, show the security level of a wifi network, fixed hotspot creation bug, entry to enable/disable ssh and gsm, show wifi password as qr-code, etc.

Also very useful launchers to start navigation apps with all needed side tools or fixed userscripts like the weather or an essential screen scaling script for apps which don't fit the screen, a custom conky script to show data usage, enable the sensors to get screen rotation... etc.

It was too frustrating for me to

a.) commit the fixes with send-mail

and even worse

b.) argue with the core team why this little fixes/helpers are needed.

Luckily its all opensource and this showed me, why there are so many distros and so many forks and you still have fix old bugs after every update by yourself. People who sit behind the computer all day dont share the same view/experience/philosophy as people who are outside and moving all day.

Njoy!

Work Around the Notch

pocof1 version

  • comment in /usr/bin/sxmo_deviceprofile_xiaomi,beryllium.sh the

SXMO_MONITOR line to get correct scaling.

  • Copy the default hook:

cp /usr/share/sxmo/default_hooks/sxmo_hook_statusbar.sh ~/.config/sxmo/hooks/sxmo_hook_statusbar.sh

  • Add some placeholder text between the battery and the wifi symbol nearly on the end of the file below:

set_notifications

with adding this line:

sxmobar -a notch 31 "|-------NOTCH------|"
  • you can also disable the clock (see below) and change the value from the notch hack to 22

(if you have better ideas, let me know..)

  • Disable tray icons in swaybar:

~/.config/sxmo/sway

  • Scroll down to the

Status Bar: section and just below position top add

tray_output none
  • Hide the workspace buttons in ~/.config/sxmo/sway

just below position top add:

workspace_buttons no
  • make the height of the bar same as the notch, add
height 28
  • disable clock with commenting everything containing 'time'.
  • create a symbol counter to inject/move the placeholder accordingly..

We will also cleanup the speaker/mic symbols, but later...

reload sway with the new config:

swaymsg reload

Set Darkmode

For Gnome apps:

gsettings set org.gnome.desktop.interface color-scheme prefer-dark


For Kde plasma-mobile apps:

sudo apk add plasma-integration

sudo apk add qqc2-breeze-style

Get the style file here.

Move it to where it belongs:

mv kdeglobals ~/.config

Now we need to set the environment variables (not sure if we need this, pasted once into terminal):

QT_QUICK_CONTROLS_STYLE=org.kde.breeze QT_QPA_PLATFORMTHEME=kde

thanks to user: x-m7


For Flatpaks

some flatpaks just refuse to run in dark mode, edit the launcher of each flatpak to contain the dark theme like this:

flatpak run --env=GTK_THEME=Adwaita:dark org.gnome.Fractal


Gtk apps can be forced with a prefix:

GTK_THEME=Adwaita:dark application 

Manage App Menu

Some stuff exist only as a flatpak, but it will not show in application menu... simply change in nano ~/.config/sxmo/hooks/sxmo_hook_apps.sh :

write_line_app() {
        executable="$1"
        label="$2"
        command="$3"
        if command -v "$executable" >/dev/null; then
                write_line "$label" "$command"
        fi

to:

write_line_app() {
        executable="$1"
        label="$2"
        command="$3"
        if command -v "$executable" >/dev/null; then
                write_line "$label" "$command"
        elif ls /var/lib/flatpak/app/"$executable" >/dev/null; then
                write_line "$label" "$command"
        fi

and add e.g. Flare like this:

write_line_app de.schmidhuberj.Flare "$icon_msg Flare" "flatpak run de.schmidhuberj.Flare"

Manage Menu's (Volup_one)

Copy the contextmenu hook to your user:

cp /usr/share/sxmo/default_hooks/sxmo_hook_contextmenu.sh ~/.config/sxmo/hooks/sxmo_contextmenu.sh

Then edit this copy.


For example to remove the Binaries from the System Menu, go down to: # Default system menu (no matches)

and remove the whole line containing $icon_grd Binaries.



Application specific Context Menu's

Can be really handy to set the most used shortcuts of a specific app.

In this example we add a menu for Krita with the most used commands.


we scroll to the block containing Firefox, and add a new one:

*krita*)
		# Krita
		CHOICES="
			$icon_fnd Open                   ^ 0 ^ sxmo_type -M Ctrl o
			$icon_sav Save                   ^ 0 ^ sxmo_type -M Ctrl s
			$icon_pst Paste                  ^ 0 ^ sxmo_type -M Ctrl v
			$icon_del Delete                 ^ 0 ^ sxmo_type -k Delete
			$icon_win Select                 ^ 0 ^ sxmo_type -M Ctrl r
			$icon_modem_disabled Deselect    ^ 0 ^ sxmo_type -M Ctrl -M Shift a
			$icon_wn2 Crop                   ^ 0 ^ sxmo_type c
			$icon_flt Fill                   ^ 0 ^ sxmo_type f
			$icon_modem_connected Gradient   ^ 0 ^ sxmo_type g
			$icon_dof HSV Adjust             ^ 0 ^ sxmo_type -M Ctrl u
			$icon_cls Close Image        	 ^ 0 ^ sxmo_type -M Ctrl w
		"
		WINNAME=Krita
		;;

Note: somehow i was not able to make Scale Image to New Size Ctrl + Alt + I; Resize Canvas and Enter working.



Copy content of SMS

(e.g. to copy into translator)

Search to block containing:

grep -qi -w "sms\|missed

and just above

$icon_aru Scroll up '


you add:

 $icon_cpy Copy        ^ 0 ^ sxmo_type -M Shift -M Ctrl c  

vim vs. nano vs. micro

change the standard to write sms..

export EDITOR="micro"

in

.config/sxmo/profile


Terminal Font

If you use a lot of terminal tools and dont like the ugly oldschool font, just replace it with a nicer monospace font.

 
sudo apk add font-roboto-mono

search for available mono fonts with:

 fc-list | grep mono

edit foot.ini file to one of the new fonts:

micro ~/.config/foot/foot.ini

edit the fontline:

font=RobotoMono:size=11

Block callers

WIP

block annoying numbers in:

/usr/bin/sxmo_modem.sh

around line 130 is something called $SXMO_BLOCKFILE

so you can create a

 ~/.config/sxmo/block.tsv 

file containing the numbers to be blocked and it should work, right?

and here you find a basic call writeup.

VPN

There is an issue in ModemManger which will not route your GSM traffic through VPN, so VPN is only working over Wifi, carefully read the linked issue and test its solution. Meanwhile my sim slot is broken, so i can not test this anymore..

Since OpenVPN via nmcli is super annoying buggy with usernames and passwords, we just use OpenVPN from the terminal instead:

Install OpenVPN support:

sudo apk add openvpn openresolv

if you trust protonvpn, install the dns leak fix:

sudo wget "https://raw.githubusercontent.com/ProtonVPN/scripts/master/update-resolv-conf.sh" -O "/etc/openvpn/update-resolv-conf"

sudo chmod +x "/etc/openvpn/update-resolv-conf"

Start vpn with configuration file:

sudo openvpn <config.ovpn>

visit https://ip.me/ and check your virtual location.

In Iran settings from here worked quite well... make a script to fill in user/pass:

#!/bin/sh
VPN_USER=vpnbook
VPN_PASSWORD=e83zu76
CONFIG_FILE=~/Downloads/vpn/vpnbook-us178-tcp80.ovpn

sudo sh -c "openvpn --config '"$CONFIG_FILE"' --auth-user-pass <(echo -e "$VPN_USER"'\n''"$VPN_PASSWORD"''\n')"

exit

Hotspot

There is a bug or sourcehutthat you can not connect to hotspot of your pmos device with a modern device. The workaround is to create the hotspot from commandline and disable pmf or fix the /usr/bin/sxmo_networks.sh script with adding this on around line 219:

notify_sucess "Adding hotspot wifi" \
                nmcli device wifi hotspot ifname wlan0 con-name "Hotspot $SSID" \
                ssid "$SSID" channel "$channel" band bg password "$key"
                nmcli con down "Hotspot $SSID"
                nmcli c modify "Hotspot $SSID" 802-11-wireless-security.pmf 1
                nmcli c modify "Hotspot $SSID" wifi-sec.pmf disable
                nmcli con up "Hotspot $SSID"

Captive Login Page

When connecting to an internet with a captive login page, but its not shown, type in Firefox addressbar:

neverssl.com

GPS

If there is a SIM card inserted: Enable Modem GPS

mmcli -m any --location-enable-gps-nmea

mmcli -m any --location-enable-gps-raw 

mmcli -m any --location-get 


make GPS available to apps:

/usr/libexec/geoclue-2.0/demos/agent

Quickly check your location:

/usr/libexec/geoclue-2.0/demos/where-am-i


sxmo userscript to launch pure-maps and osmin with gps & geoclue you find here.

Pure-Maps You need pure-maps and osmscout-server

After install execute osmscout-server-gui and download some maps. You need to get API-keys with registering on all the map provider service,it takes a moment, but is easy. When all done you can run pure-maps with the launcher-script. For offline navigation, first launch osmscout-server, wait a few seconds, then launch pure-maps. To find drinking water, dont use the search window, use Nearby venues from the menu.

Read Location

This section gives some notes on how to read various location data from terminal to be used in a sript.

when gnss-share is running, you can listen to it:

sudo socat - UNIX-CONNECT:/var/run/gnss-share.sock

there is a bunch of output, interesting is the $GPGGA line, which contains:

$GPGGA,<UTC Time>,<Latitude>,<North/South>,<Longitude>,<East/West>,<Fix Quality>,<Number of Satellites>,<Horizontal Dilution>,<Altitude>,<Altitude Units>,<Geoidal Separation>,<Geoidal Unit>,<Age of Differential GPS Data>,<Differential Reference Station ID>*<checksum>

the 6th value is the fix quality:

       0 = Fix not available
       1 = GPS fix (SPS) 2D-fix
       2 = Differential GPS fix (DGPS) 3D-fix
       3 = PPS fix
       4 = Real Time Kinematic (RTK)
       5 = Float RTK
       6 = estimated (dead reckoning) fix
       7 = Manual input mode
       8 = Simulati on mode

so we could continuously check if we already have a fix with:

doas socat - UNIX-CONNECT:/var/run/gnss-share.sock | grep --line-buffered '\$GPGGA' | awk -F',' '{print $7}'

Since I'd like to display on my screen with conky if we have a gps fix or not, we need to write a rule so this info is accessible without sudo rights, if you know how, please text me!

If there is no SIM card inserted or/and modem deactivated mmcli will not work.

In this case:

ModemManager

Get GPS Location without sim... keep in mind that there are more gps mods/configs todo, see below:

git clone https://gitlab.freedesktop.org/mobile-broadband/ModemManager.git
cd ModemManager


meson setup build \
--prefix=/usr \
--sysconfdir=/etc \
-Dbash_completion=false \
-Dsystemd_suspend_resume=false  \
-Dsystemd_journal=false \
-Dpowerd_suspend_resume=false \
--buildtype=release \
-Dsystemdsystemunitdir=no

ninja -C build

sudo ninja -C build install

stuck with: need 'mbim-glib' ['>= 1.31.2'] found '1.30.0'

so we need to build this too...

sudo apk add gobject-introspection-dev help2man dbus-dev libgudev-dev polkit-dev libqmi-dev 

git clone https://gitlab.freedesktop.org/mobile-broadband/libmbim.git
cd libmbim

meson setup build --prefix=/usr -Dbash_completion=false

ninja -C build

sudo ninja -C build install

and also qmi-glib to 1.34.0:

git clone https://gitlab.com/linux-mobile-broadband/libqmi.git
cd libqmi

meson setup build --prefix=/usr -Dbash_completion=false

ninja -C build

sudo ninja -C build install

Location without Sim

we need modemmanger v1.23.4 or newer to get this working (see above). Then:

sudo apk add gnss-share gnss-share-geoclue
sudo rc-service gnss-share start

In /etc/geoclue/geoclue.conf set:

# Enable Modem-GPS source
enable=false

and in /etc/gnss-share.conf set:

device_driver="mm"

to check install and run the 'Satellite' app via flathub:

sudo flatpak install flathub page.codeberg.tpikonen.satellite

flatpak run --env=GTK_THEME=Adwaita:dark page.codeberg.tpikonen.satellite


Notes:

should we add the service to boot and rewrite geoclue.conf to /var/run/gnss-share.sock instead of gps-share.sock

https://gitlab.postmarketos.org/postmarketOS/gnss-share/-/merge_requests/15

https://gitlab.postmarketos.org/postmarketOS/gnss-share/-/merge_requests/17

Thanks to tpikonen for all the help!

Compass

wip

For me, compass is not working yet in puremaps and osmin... or lets say it only works when I am moving.

to check if hardware compass is recogniced:

sudo -u geoclue monitor-sensor --compass

Naybe you need to add your user first to the geoclue group 🤷

If you get data when you now turn your phone, compass is there. Great. Now we need to somehow provide this info to geoclue..

make sure compass is true in:

/etc/geoclue/geoclue.conf

see this issue to help solving the problem..


In ```/usr/share/dbus-1/system.d/net.hadess.SensorProxy.conf`: ```` rewritw deny to allow


thanks to tpikonen!

Pure-Maps Style Tuning

WIP

Pure-maps does not show city names in the default offline mode. To change this, edit

/usr/share/osmscout-server/styles/mapboxgl/styles/osmbright.json


change under "id": "place-city"

"minzoom": 1,
"maxzoom": 18,

this will show the city names in zoomlevel 14.49 to 18

we still dont see it at lower levels, which i might find out one day hopefully...


note: select offline, type= default

the issue seems to be caused while importing the tiles we also need to import other zoom levels (after talking with rinigus on matrix).

check here whats going on:

https://github.com/rinigus/osmscout-server/blob/master/scripts/import/mapbox/run_planetiler.sh

https://github.com/onthegomap/planetiler


when solved, document in puremaps forum and github!


Osmscout-Server

By default, there is a 100km limit set in bicycle routing. You can change this limitation very easy:

In osmscout-server-gui, go to settings, choose Valhalla and set your limits. Now that very large limits may lead to crashes if you don't have enough ram.

thanks to rinigus!

Osmin Style Tuning

WIP

we edit the cycle stylesheet to always show drinking waterspots

lets edit:

/usr/share/osmin/resources/stylesheets/cycle.oss

add

  [TYPE amenity_drinking_water] {
     NODE.ICON { name: drinking_water; }
     AREA.ICON { name: drinking_water; }
   }

we also need to make the symbol bigger and visible on all scaling layers...


Build Osmin

To get a recent version of osmin with all the actual improvements and bug fixes, you have to build it yourself, here is how to:

Dependencies:

sudo apk add git cmake clang g++ build-base qt5-qtbase qt5-qtbase-x11 qt5-qtsvg-dev qt5-qtmultimedia-dev openmp-dev qt5-qtquickcontrols2-dev qt5-qtsensors-dev qt5-qtremoteobjects-dev qt5-qtlocation-dev

Building:

git clone https://github.com/janbar/osmin.git

cd osmin
git submodule init
git submodule update --force
mkdir build

cmake -B build -DBUILD_DEVICE_MOBILE=ON -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ .

cmake --build build/ -j$(nproc)

sudo cmake --build build/ --target install

Podman / Docker Installation

sudo apk add podman

sudo rc-update add cgroups

#remove folder so it will be created with the right permission on first run:
sudo rm -rf $HOME/.local/share/containers/storage

sudo touch /etc/subuid
sudo touch /etc/subgid

sudo usermod --add-subuids 100000-165535 --add-subgids 100000-165535 $(whoami)

-- reboot or logout/login  --

Offline Translation

Offline Translator LibreTranslate, was not able to make them run because of fucking censorshit (guys, please fix the vpn-gsm issue), however it works:

git clone https://github.com/LibreTranslate/LibreTranslate.git

cd LibreTranslate

# replace docker commands with podman:
sed -i 's/docker/podman/g' run.sh

sudo chmod +x run.sh

./run.sh --update --load-only en,de,fr,tr

# limit languages:
# the --update is a flag to update the language packs
#for other languauges see here: https://libretranslate.com/?source=tr&target=en&q=


Be aware that this will suck quite a bunch of data (i just emptied my data plan with this...)

After starting, visit with a browser:

http://0.0.0.0:5000

or use this script, change the url to http://localhost:5000/translate to easy query from terminal.

create a handle to start from apps menu hook:

write_line_app podman "$icon_edt LibreTranslate" "sxmo_terminal.sh ~/LibreTranslate/run.sh"

the podman entry is a bit of a hack, otherwise we have to add a variable to check which containers are installed, which is just too slow.

Offline Translation with LLM

wip

Since LibreTranslate does not do a very good job, we'd love to try Helsinki-NLP models or madlad for better translation.

Sadly PostmarketOS is build on Alpine which misses great stuff like pyTorch, glibc etc. this makes it pain in the ass to test out all the new llm translation stuff, so far i could not find a model which would run on llama.cpp.

I found no way so far to run the helsinki-nlp-translation-models to have a decent translator (there is a pytorch docker image).

Maybe distrobox or something then load a slim-bullseye image ... or leave it and switch to kupfer.

Offline Speech-to-Text

In 2024 they destroied the free internet and it turned out that the new online is offline, similar as it was with computers back in the 90ies, they ran without internet...

https://github.com/ideasman42/nerd-dictation

Install with:

sudo apk add sox
sudo apk add py3-srt --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing
sudo apk add py3-vosk-api
git clone https://github.com/ideasman42/nerd-dictation.git
cd nerd-dictation
wget https://alphacephei.com/kaldi/models/vosk-model-small-en-us-0.15.zip
unzip vosk-model-small-en-us-0.15.zip
mv vosk-model-small-en-us-0.15 model
mkdir -p ~/.config/nerd-dictation
mv ./model ~/.config/nerd-dictation/
cp ~/sxmop6/configs/nerd-dictation.py
 ~/.config/nerd-dictation/


We need dotool to type stuff:

sudo apk add dotool
sudo udevadm control --reload && sudo udevadm trigger

Set the buttom microphone as default input (this may vary depending of your hardware and os version on stable it was hw:0,3 check with arecord -l

export AUDIODRIVER=alsa
AUDIODEV='hw:0,1'

To run:

./nerd-dictation begin --simulate-input-tool=DOTOOL --input=SOX

# Start speaking..

./nerd-dictation end

Get the launcher script here


copy [1] configuration file to enable punctuation to:

 ~/.config/nerd-dictation/nerd-dictation.py

to type 'enter' instead of writing it, add something to the config file.

To do:

  • add 'Enter' word as keystroke (~/.config/nerd-dictation/nerd-dictation.py or see examples on github)

Modify the keyboard to have a button (see below)

Offline Text-to-Speech

sudo apk add piper-tts
sudo apk add py3-piper-tts

Note: i had to manually remove piper in /usr/lib/python3.18/... and then reinstall via apk to get it running without complains


Download voices in the needed language here and locate them in structured folders:

mkdir -p ~/piper/models/en

Now test a realtime example:

echo 'This is running on postmarktOS.' | \
/usr/bin/piper --model $HOME/piper/models/en/en_US-lessac-medium.onnx --config $HOME/piper/models/en/en_en_US_lessac_medium_en_US-lessac-medium.onnx.json --output-raw | aplay -r 22050 -f S16_LE -t raw -


Note:

I made a launcher to read out loud what ocr_roi sees.

Next is to pipe other outputs to read out load, but dont know how yet.

Keyboard Modifications

git clone https://github.com/jjsullivan5196/wvkbd
sudo apk add wayland-dev pango-dev libxkbcommon-dev

cd wvkbd
micro layout.mobintl.h

go to // Emojis and make your modifications

 🚴 0x1F6B4
 🤓 0x1F913
 🤷‍ 0x1F937
 🚀 0x1F680
 🍷 0x1F377  
 🍺 0x1F37A  
 🔥 0x1F525
 🚲 0x1F6B2
 🌡️ 0x1F321
 🏕️ 0x1F3D5
 🫶 0x1FAF6


or just pull my custom file.

If you want 'Ctrl' to be latched when once pressed, edit keyboard.c and comment around line 284

 //       unlatch_ctrl = (kb->mods & Ctrl) == Ctrl;

finally compile:

make
sudo make install

voila, all done.

To add new buttons to trigger stuff, we have to work with key combos and then define them in ~/.config/sxmo/sway

For the moment its not possible to trigger scripts directly or make longer than two-key combos, which might hopefully change once.


Lets do it like this:

In layout.mobintl.h search for:

{"Special", "Special", 1.5, Layout, 0, &layouts[Special]

replace or add a new line:

 {"󰍽", "󰍽", 1.0, Code, KEY_7, 0, Super},
  {"󰍬", "󰍬", 1.0, Code, KEY_8, 0, Super},

Note: the first two 󰍬 symbol ate the mouse, the others the mic cat /usr/share/sxmo/default_hooks/sxmo_hook_icons.sh | grep mic

make and install as written above.

Now we need to change the entry in ~/.config/sxmo/sway to trigger the nerd dictation toggle script, scroll down to:

# Workspaces:

   bindsym $mod+7 workspace number 7
   bindsym $mod+8 workspace number 8

and rewrite them to:


bindsym $mod+7 exec ~/sxmo-userscripts/launchers/touchpademulator_launcher.sh 

bindsym $mod+8 exec ~/sxmo-userscripts/launchers/dictation_launcher.sh

restart sway.

get the dictation launcher script, the touchpad launcher in the sxmop6 repo.

Note:

should we create a whole line of tools, including screenshot, ocr_roi, qr reader? i think this would be nice!

Make sure you build and install TouchpadEmulator as written below:

Touchpad Simulator

Sometimes its nice to have a mousepointer to handle desktop apps or for precision work.

As written above, we can then trigger this via keyboard! This section is about installing the patched TouchpadEmulator (thx2 fdelamotte) in pmos/sxmo.

Note: click and drag works very sensitive, click and wait 2s, or double click then drag, maybe its a bug or a problem. You can debug with wev.

git clone https://gitlab.com/CalcProgrammer1/TouchpadEmulator.git
cd TouchpadEmulator
rm TouchpadEmulator.c
wget https://codeberg.org/magdesign/sxmop6/raw/branch/main/patches/TouchpadEmulator.c
sudo apk add dbus-dev dbus-glib-dev
make
sudo make install
sudo modprobe uinput
sudo chmod 777 /dev/uinput

You are good to go. I know its not very nice to give full rights to uinput, maybe you have a better way to do it.

Set default applications

e.g. Define which app displays images sudo nano ~/.config/mimeapps.list

edit:

image/png=loupe.desktop

image/jpg=loupe.desktop

make sure you create a desktopfile for loupe in:

nano ~/.local/share/applications/loupe.desktop

containing:

[Desktop Entry]
Type=Application
Terminal=false
Exec=/usr/bin/loupe
Name=loupe
MimeType=image/png;image/jpg


maybe there can also be some settings made in:

/usr/bin/sxmo_open.sh

Allow Flatpak / e.g. Fractal to access folder

sudo flatpak override org.gnome.Fractal --filesystem=/home/me/

or Flare

flatpak override de.schmidhuberj.Flare --filesystem=/home/me/

without this, you get an error when trying to save attachments.

Modify Homescreen

Change the position of the clock on Homescreen:

 ~/.config/sxmo/conky.conf 

see the various configs here.

to put it to the right buttom edge, we modify alignment = 'middle_middle',

to:

alignment = 'bottom_right',

Just for fun, you can also add the info of the free available diskspace and the powerlevel:

 
${alignc}${font Sxmo:size=12}${exec df -h | awk '/root/ { print "Free: " $4 }'}
${alignc}${font Sxmo:size=12}${exec echo "Power:"}${exec upower -d | grep -m1 'percentage:' | awk '{print $2}'}

Get my custom conky.conf which shows status of modem, battery, data usage, networkspeed...

Networks Menu

to add a Disable GSM function, edit: /usr/bin/sxmo_networks.sh add:

togglegsm() {
                        if nmcli radio wwan | grep -q "enabled"; then
                                sxmo_notify_user.sh "Disabling GSM"
                                nmcli radio wwan off 
                        else
                                sxmo_notify_user.sh "Enabling GSM"
                                nmcli radio wwan on
                        fi
}

below $icon_cfg Nmtui add following code to toggle the menu entry:

$(
        if nmcli radio wwan | grep -q "enabled"; then
                printf "%s GSM Disable\n" $icon_modem_disabled
        else
                printf "%s GSM Enable\n" $icon_modem_registered
        fi
)

and

                        *"Nmtui" )
                                sxmo_terminal.sh nmtui || continue # Killeable
                                ;;
                        *"GSM Disable"|*"GSM Enable" )
                                togglegsm
                                ;;

and to share our wifi credentials we make another entry just before Ifconfig EOF:

$([ -z "$WIFI_ENABLED" ] || printf "%s Show Credentials\n" "$icon_wif")

and below, after the *"Scan Wifi Networks" ) block, we add:

sxmo_terminal.sh -- bash -c "nmcli dev wifi show-password; read -p 'Press enter to close';" 

Screen Color Adjustment

This are just notes of an unfinished journey. I tried so far without luck:

wl-gammrelay, wl-gammarelay-rs, wlsunset, gammastep, wlr-randr

for example:

gammastep -O 5000K

Warning: Zero outputs support gamma adjustment.

Warning: 1/1 output(s) do not support gamma adjustment.

So lets dive deeper:

ls /sys/class/backlight/ae94000.dsi.0


actual_brightness
bl_power
brightness
device
max_brightness

power
scale
subsystem
type
uevent

nothing about color.

To turn the screen very dark we can do this an it works:

echo 8 > /sys/class/backlight/ae94000.dsi.0/brightness

but not color, rgb? rgba?

ah, maybe fbset:

fbset

mode "1080x2280-0"
#D: 0.000 MHZ, H: 0.000 kHZ. V:
0.000 Hz
geometry 1080 2280 1080 2280 32
timings 0 O 0 0 0 0 0
accel false
rgba 8/16,8/8,8/0,0/0

ok, first time i read something about color, but what now, maybe create custom profiles in /etc/fb.modes and try to load them..

or go deeper into i2c, really?

sudo ddcutil environment

sudo ddcutil detect

https://moverest.xyz/blog/control-display-with-ddc-ci/

Kde Plasma mobile has working nightlight on the same device, but i dont know yet how they do it.

After all this, why not just hack a .png screen overlay to get a nightmode?

 swayimg -g $myresolution --config="general.transparency=none" $overlay2 


It works, but we need to put it on top without blocking touch input, then you can have this really stupid workaround 😂

swayimg does not support event forwarding


How to achieve this? Maybe swaymsg -t anything fullscreen input surface 0

see pics.

It seems that we have to use wlroots,create an input surface of 0 so it jumps to the next layer, sadly i have zero knowledge of C code and the bash commands are very limited...

https://manpages.debian.org/bullseye/sway/sway.5.en.html

https://manpages.debian.org/bullseye/sway/sway-input.5.en.html

https://wayland.app/protocols/wayland#wl_surface:request:set_input_region


Clight

wip

# dependencies

sudo apk add popt-dev gsl-dev libconfig-dev 
# you must use the release package!
wget https://github.com/FedeDP/libmodule/archive/refs/tags/5.0.1.zip
unzip 5.0.1.zip
cd libmodule-5.0.1

mkdir build
cd build
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib ../
make
sudo make install

# Clight
git clone https://github.com/FedeDP/Clight.git
cd Clight
mkdir build
cd build
cmake \
    -G "Unix Makefiles" \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DCMAKE_BUILD_TYPE="Release" \
    ..
make

see issue

Customize Gestures

Copy the standard lisgd configuration file to make custom edits:

cp /usr/share/sxmo/default_hooks/sxmo_hook_lisgdstart.sh ~/.config/sxmo/hooks/sxmo_hook_lisgdstart.sh

Now you can start modifying gestures on your custom copy (adding short swipes somehow helps predicting medium swipes better)

add the short swipe gestures with editing:

nano ~/.config/sxmo/hooks/sxmo_hook_lisgdstart.sh

and add:

-g "1,RL,*,S,setsid -f sxmo_hook_inputhandler.sh shortoneleft" \ 
-g "1,LR,*,S,setsid -f sxmo_hook_inputhandler.sh shortoneright" \

keep in mind that the order where you write it, matters!

To define a gesture only when a specific program is running, search for your hardware specific sxmo_hook_inputhandler.sh:

which sxmo_hook_inputhandler.sh

and when found, copy it to your user config:

cp /usr/share/sxmo/default_hooks/oneplus,enchilada/sxmo_hook_inputhandler.sh ~/.config/sxmo/hooks/sxmo_hook_inputhandler.sh

In this example we add a custom firefox prev/next swipe gesture handler:

nano ~/.config/sxmo/hooks/sxmo_hook_inputhandler.sh

just below this lines:

#special context-sensitive handling
case "$WMCLASS" in

Add this:

case "$WMCLASS" in
        *"firefox-esr"*)
                case "$ACTION" in
                        "mediumoneright")
                                sxmo_type.sh -M Alt -P Right -p Right -m Alt
                                exit 0
                                ;;
                        "mediumoneleft")
                                sxmo_type.sh -M Alt -P Left -p Left -m Alt
                                exit 0
                                ;;
                esac
                ;;

The swipes actually works best when in the address bar, but you should for sure tweak your Firefox to get rid of tabs, see below in this wiki.


Notes:

If afterwards something does not work, like menu opening or whatever, you made a typo somewhere, when you are an idiot like me, who has no computer and is doing the changes directly on phone, there might be typos....


Corner Swipes

Now we know the the concept.

Lets change the button left corner to show the power status and remaining time of our battery:

For this, again in sxmo_hook_inputhandler.sh we look for the line:

"bottomleftcorner"

lets comment: sxmo_state.sh set lock

and write instead: ~/.config/sxmo/userscripts/powerlevel.sh

before and after the else

and we also want to access the powerlevel without unlocking the phone, so just above:

esac
        #we're locked, don't process the rest of the script
        exit 0

we add:

                       "bottomleftcorner")
                        ~/.config/sxmo/userscripts/powerlevel.sh
                        exit
                        ;;


reboot.

Customize Hardware Buttons for your App

When not already there, copy inputhandler to user.

cp /usr/share/sxmo/default_hooks/sxmo_hook_inputhandler.sh ~/.config/sxmo/hooks/sxmo_hook_inputhandler.sh

Now you can start modifying what the volume and power buttons shall do when a specific programm is running.

Note that it can also handle headless running scripts and is not bound to names of sway windows.

In this example we look for my-script.sh which, when running, should be killed with the volume up key:

nano ~/.config/sxmo/hooks/sxmo_hook_inputhandler.sh


I have no exact idea whats going on here, so i search for

 "volup_one") 

and go to the result which looks ok'ish to me below #standard handling , after ~line 338 something and add the kill command to:


"volup_one")
		kill $(pgrep my_script) #kill my tool, comments are important!
		sxmo_appmenu.sh
		exit
		;;

This should be it.

How to add more button functions

There is this nice powerlevel.sh script which gives me information about the powerlevel. It would be nice to have fast access to it. So we would like to push the Power Button four times (since all other pushes are useful used).

we already know

nano ~/.config/sxmo/hooks/sxmo_hook_inputhandler.sh

and we know the section #standard handling

"powerbutton_three")
		sxmo_terminal.sh
		exit 0
		;;

where we easy could change sxmo_terminal.sh to whatever we'd like.

Since we want to trigger on 4 pushes, we create a new entry containing:

"powerbutton_four")
		/home/me/.config/sxmo/userscripts/powerlevel.sh 
		exit 0
		;;

But we also need to get the information that the knob is pushed 4 times.

So we have to edit:

nano .config/sxmo/bonsai_tree.json

wow, what a file, looks like an art drawing, however, since I am editing all the satuff you see and read here on one of my phones, this is a really difficult one... lets add below we:

{
                "type": "event",
                "event_name": "power_released",
                "transitions": [
                  {
                    "type": "exec",
                    "command": [
                      "setsid",
                      "-f",
                      "sxmo_hook_inputhandler.sh",
                      "powerbutton_three"
                    ]
                  }
                ]
              }


              {
                "type": "event",
                "event_name": "power_released",
                "transitions": [
                  {
                    "type": "exec",
                    "command": [
                      "setsid",
                      "-f",
                      "sxmo_hook_inputhandler.sh",
                      "powerbutton_three"
                    ]
                  }
                ]
              },
              
              {
                "type": "event",
                "event_name": "power_released",
                "transitions": [
                  {
                    "type": "exec",
                    "command": [
                      "setsid",
                      "-f",
                      "sxmo_hook_inputhandler.sh",
                      "powerbutton_four"
                    ]
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  },

Then restart bonsaid with

superctl restart bonsaid

If it throws no error, you did good in counting brackets...

https://gist.github.com/magdesign/085344b504409839e791378dbb5aa792


Here we realize it way too hard to hit it 4 times, but i leave the write up as reference

How you can do it the bad way

Go to /dev/input/by-path/ check each entry with cat and pushing on some buttons:

cat /dev/input/by-path/platform-gpio-keys-event

you will get weird output, but you get some output. yea! Since there are several events in /dev/input/by-path/ you can just count them from top to buttom to know eachs number for the next step. Mine was the 3rd.

So this time we check

 cat /dev/input/event3 

or whichever will react to your button presses.

As soon as you found it, you can listen to it in my_script.sh as simple as:

while true; do
if inotifywait -e modify /dev/input/event3: then
echo "its pressed, lets execute something"
fi
break
done

insted of just an echo, you could kill your script with:

kill $(pgrep my_script.sh)

Firefox Tweaks

Mobile friendlier layout

first we need to get bash support:

sudo apk add bash

then we remove the standard solution:

sudo apk del mobile-config-firefox 

then we grab user0`s script from codeberg, here. Make it executable and run it (make sure to select "Add Recommended Preferences"):

git clone https://codeberg.org/user0/Mobile-Friendly-Firefox.git
sudo chmod +x Mobile-Friendly-Firefox/install.sh
bash Mobile-Friendly-Firefox/install.sh

Disable warning when closing tabs:

micro ~/.mozilla/firefox/*.default-release/user.js

set it to false.

Remove Items from URL Bar

Long click onto the item and select remove.

Force Website Mobile

Some websites do not show in mobile version and are then hard to read. Press:

 ctrl + shift + m 

and select iphoneSE layout on top left.

Block Search Results

Get rid of reddit, pinterest etc.

Visit: https://letsblock.it/filters/search-results

generate the filterlist or use my list and copy it to your ublock MyFilter.

Search Engine

By default, mobile-config-firefox adds a policies entry to get rid of invasive stuff.

While this is a great idea it my cause some trouble for users living in non-free countries.

To enable google search engine, you can edit:

./etc/firefox/policies/policies.json

Be aware that, in a free country, it makes sense to avoid google.com as search engine!

Set Custom Search Engine

Use 4get and define your scraper:

1. enable to add a custom search engine with search in

about:config

look for

browser.urlbar.update2.engineAliasRefresh

and hit the + so it says true

2. go to settings and under search engine you find a new add button, click it and enter: https://4get.ch/web?s=%s&scraper=qwant&nsfw=yes

voila, you set yourself a great private and advertisement free search engine!

```fuck surveilance capitalism```, coz:

"I need privacy, not because my actions are questionable, because your judgement and intentions are!"

Delete SMS

This is WIP The whole magic must go into /usr/bin/sxmo_modemtext.sh

To find out a list who texted so far: $(sxmo_contacts.sh --texted)

They lay in .local/share/sxmo/modem/<sender>/sms.txt

Summary:

Create a list of all text messages with $(sxmo_contacts.sh --texted), display this list in a bmenu, when selected => promt: sure? | cancel => rm .local/share/sxmo/modem/

First try to understand the existing code, then write a a delete only script, finally implement into sxmo_modemtext.sh

Scripts

Remove annoying scripts like reddit, youtube etc., in:

/usr/share/sxmo/appscripts/

Battery Empty Warning

WIP

Send a warning and shutdown at the right time. see issue.

My solution is a custom hook, which works, but misses a function to tell 'yes i know, dont send me more warning prompts' and it does not work when in suspend mode.

There is also an charging issue which prevents to charge with a solar panel.

Audio Equalizer & Effects

Make sure you installed

sudo apk add easyeffects lsp-plugins lsp-plugins-lv2 calf

Start your audioplayer and launch easyeffects to make quality adjustments.

The layout has its challanges. Maybe we can send a gtk scaling command when opening.

Output and Recording volume can be adjusted with alsamixer

To test your microphone, visit https://mictests.com/ and record something.

Audio

since i do not understand pipewire audio, i start to dig and document here. a good base to start is its documentation: https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Config-PipeWire#configuration-file-pipewireconf

WIP

as in the time of writing, there is no option to select audio output through the earpiece. you have to run pavucontrol go to Configuration and select the Make a phone call profile. Then we are able to play music for maybe a minute before it crashes/freezes. By analyzing all configurations the only difference between all sinks and the earpiece: in unused state all sinks are SUSPENDED, but the earpiece is IDLE.

You can check with:

pactl list short sinks

there is also a very nice tool for a node based view of audio in-/outputs:

qpwgraph

what i try to do is to play music over the speaker and switch this while playing to the earpiece. its the first step into debugging why calls dont really work. I think the error lies in loading this profiles in runtime. so far i could not figure out why we switch profiles instead of having all in/outputs in one profile and switch the stuff with a mixer. with this approach we could also switch music from loudspeaker to earpiece when wanted and i guess evwrything would stay more stable.. so lets dig where to write such a basic configuration file... wip


For a nice understanding of the audio routing:

 wpctl status

in sxmo the stuff gets switched with /usr/share/sxmo/default_hooks/sxmo_hook_call_audio.sh enable and /usr/bin/sxmo_modemaudio.sh over dbus.

NFC

WIP

As written here, NFC is working on OP6/OP6T devices.

sudo apk add dtc
cd /boot/dtbs/qcom
sudo dtc sdm845-oneplus-enchilada.dtb -o sdm845-oneplus-enchilada.dts
patch < NFC.patch
sudo dtc sdm845-oneplus-enchilada.dts -o sdm845-oneplus-enchilada.dtb
sudo reboot

Get NFC.patch.

Thanks to bienmster

Kernel Downgrade

You just made an update, now the phone boots into a black screen. First get a dump with holding the volume up button and connect it via usb to a computer. It should mount as external usb drive and provide useful logs to debug.

To downgrade to an older kernel version, get one here

If you are stuck on boot with Boot partition not found do whats described in step 9.

When you are lucky, you can just pmbootstrap flasher flash_kernel and you are ready to go, but if you meanwhile upgraded pmbootstrap. you need to:


1. pmbootstrap init

2. make all the needed choices (in this example we use an op6)

3. pmbootstrap install --fde

4. copy your working kernel apk to the chroot dir: sudo cp /path/of/linux-postmarketos-qcom-sdm845-6.9.0-r0.330773b0.apk ~/.local/var/pmbootstrap/chroot_rootfs_oneplus-enchilada/

5. pmbootstrap chroot -r

6. add the kernel package: apk add --allow-untrusted linux-postmarketos-qcom-sdm845-6.9.0-r0.330773b0.apk

7. exit

8. pmbootstrap export

9. now you need to fix the bootimage uuuid with abootimg tool:

sudo ./abootimg -u /tmp/postmarketOS-export/boot.img -c "cmdline = console=ttyMSM0,115200 pmos_rootfsopts=defaults"

10. finally flash the boot: fastboot flash boot /tmp/postmarketOS-export/boot.img

11. your phone may only boot once! to fix this, reinstall the kernel from a terminal on the phone sudo apk fix linux-postmarketos-qcom-sdm845 --reinstall maybe linked to your local apk with --allow-untrusted

thanks to craftyguy[m] and caleb

Compile Kernel

Clone the kernel for op6 into ~/Downloads folder:

git clone https://gitlab.com/sdm845-mainline/linux.git

then cd into the cloned folder and install dependencies

cd linux

sudo chmod +x /home/me/Downloads/pmbootstrap/helpers/envsetup.sh

source ~/Downloads/pmbootstrap/helpers/envkernel.sh --gcc6

if needed, revert a commit, e.g.:

git revert 5158db91 --no-edit

btw. to undo the git revert, the easiest way is:

git show --stat HEAD
git reset --hard HEAD~1
git status

now build the kernel with:

make sdm845.config
make -j$(nproc)

package the kernel:

pmbootstrap build --envkernel  linux-postmarketos-qcom-sdm845

dont worry about the built file filename, it is the new kernel, e.g.

aarch64/linux-postmarketos-qcom-sdm845-6.9.0_p20240908133139-r0.apk

install it via:

pmbootstrap flasher flash_kernel

to get rid of the custom kernel build, i found no easy way yet:

pmbootstrap shutdown
rm -f ~/.config/pmbootstrap.cfg
rm -f ~/.config/pmbootstrap_v3.cfg
sudo rm -rf ~/.local/var/pmbootstrap/

Modify Bootsplash

This does not support animated svg files yet...

replace pmos-logo-text.svg with new content in

/usr/share/pbsplash/

now just force reinstall the kernel and you have your custom splash!

To add animated svg support, modify pbsplash which seems to be triggered when mkinitfs is executed: /usr/bin/pbsplash this texts the kernel version and adds logo and the jumping dots.

There must be something in- or excluded in pbsplash/src/pbsplash.c

I dont want to break my system with another update and like my custom splash, I leave this up to you...

Install Stock Android 9.0.8

Using edl mode

Especially when you have errors, wrong partitions, broken gps or broken wifi, it makes sense to bring the OnePlus 6 back to a factory state with this method, be aware that it might take some time and nerves. Sometimes you need to repeat steps, but this method works. There is still a lot of stuff going on behind the scenes we dont know and cant understand.


Install following tools first:

- If you are not a Linux user, run bkerler`s liveCD image instead.

- Don`t use any fancy usb cable with blinking led`s and super highspeed charging capabilities.


For OnePlus6, download fulldowngrade_wipe_MSM_17819_181025_2315_user_MP1_release.zip (its on your search engine).

Unpack and decrypt payload:

 payload-dumper-go payload.bin

Now is time to start the first edl command written further down. It will wait for a device, filling the terminal with dots ..... then bring your phone into edl mode:

  1. Turn off phone
  2. Hold volume up + volume down
  3. Plugin usb cable (you should feel a vibration)
  4. The edl command which wrote some dots in terminal, now starts to execute 

(on your computer, while the phone screen stays black and only a white led next to the earpiece is shown)

  5. Write all necessary files with the edl tool:


./edl w boot_a boot.img
./edl w boot_b boot.img

./edl w dtbo_a dtbo.img
./edl w dtbo_b dtbo.img

./edl w abl_a abl.img
./edl w abl_b abl.img

./edl w aop_a aop.img
./edl w aop_b aop.img

./edl w bluetooth_a bluetooth.img
./edl w bluetooth_b bluetooth.img

./edl w cmnlib_a cmnlib.img
./edl w cmnlib_b cmnlib.img

./edl w cmnlib64_a cmnlib64.img
./edl w cmnlib64_b cmnlib64.img

./edl w devcfg_a devcfg.img
./edl w devcfg_b devcfg.img

./edl w dsp_a dsp.img
./edl w dsp_b dsp.img

./edl w fw_4j1ed_a fw_4j1ed.img
./edl w fw_4j1ed_b fw_4j1ed.img

./edl w fw_4u1ea_a fw_4u1ea.img
./edl w fw_4u1ea_b fw_4u1ea.img

./edl w hyp_a hyp.img
./edl w hyp_b hyp.img

./edl w keymaster_a keymaster.img
./edl w keymaster_b keymaster.img

./edl w LOGO_a LOGO.img
./edl w LOGO_b LOGO.img

./edl w modem_a modem.img
./edl w modem_b modem.img

./edl w oem_stanvbk oem_stanvbk.img

./edl w qupfw_a qupfw.img
./edl w qupfw_b qupfw.img

./edl w storsec_a storsec.img
./edl w storsec_b storsec.img

./edl w system_a system.img
./edl w system_b system.img

./edl w tz_a tz.img
./edl w tz_b tz.img

./edl w vbmeta_a vbmeta.img
./edl w vbmeta_b vbmeta.img

./edl w vendor_a vendor.img
./edl w vendor_b vendor.img

./edl w xbl_a xbl.img
./edl w xbl_b xbl.img

./edl w xbl_config_a xbl_config.img
./edl w xbl_config_b xbl_config.img

./edl reset

  6. Boot again into fastboot mode, from here boot into recovery, erase/wipe all data and reboot. This will take approx.10 minutes to boot!

After rebooting the phone into Android: enable wifi, bluetooth, location.

  7. Flash PostmarketOS with pmbootstrap
  8. fastboot erase dtbo


Notes:

- If you have a bootloop, just run first edl command, try pressing all buttons on phone and plugin usb cable repetitively until edl catches the phone, then proceed.

- Trying to downgrade android with edl can also result in a kind of dead phone (no response, just black, very hard to get edl mode again). I had this on a 256GB version the trick here is time consuming but it works:

first edl OnePlus6Oxygen_22.J.62_OTA_0620_all_2111252336_287bcb1636d743d3, then boot into fastboot and install twrp:


fastboot flash boot TWRP-3.6.2_11-OP6xT.img

then boot into twrp

fastbootboot boot TWRP-3.6.2_11-OP6xT.img

and erase all

(worst case you can mess with OrangeFox, loaded via twrp or an other recovery. This will also give you hardware info like screen brand. if your pmos install used fulldisk encryption the data partition may be gone and causing trouble.. first reflash pmos without encryption and the go on.)

and push the zip:

adb push fulldowngrade_wipe_MSM_17819_181025_2315_user_MP1_release.zip /sdcard

then in twrp select install and install the zip

boot, this will take a while but you are in android 9.0.2, next get OnePlus6Oxygen_22_OTA_033_all_1908012012_0b41e6554cc7409a.zip copy it to the phone and install it from the software installer menu. Then switch to fastboot set_active b and do the same. Finally you did it, you have Android 9.0.8 on your OP6 to be ready to flash PostmarketOS. Please drop me a line if this helped you :-)

- If you think your phone is bricked, there is a 99,9% chance that it is not bricked! Push the power button very long to turn it off, then push all buttons and plugin the usb cable, try this a hundred times, sometimes restart edl, switch to different usb slots on your computer, it will bring it once into edl mode.... just keep on plugin/out and remember to take a tee break before you loose your nerves... if i can do it, you can do it!

- I installed LineageOS, Android, Ubports, Droidian, Mobian, PostmarketOS, bricked the partitions, had a dead phone, had boot loops, somehow i always brought it back to life (its just annoying and time consuming).

Icon WARNING: If you see a 'crash dump' screen, plug the phone again to your computer and run edl without any commands. Provide the logs here.

Boot Warning

To you get rid of

"Your device is corrupt. It can't be trusted and may not work properly"

boot warning, simply adb shell into the phone and:

reboot "dm-verity enforcing"


Reformating / Partitiontable

JUST NOTES

For worst case scenarios or when you somehow lost GB of storage.

use fdisk /dev/sda

Table of a 128GB OP:

Disk /dev/sda: 116.11 GiB, 124671492096 bytes, 30437376 sectors
Disk model: KLUDG4U1EA-B0C1 
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 8192 bytes / 8192 bytes
Disklabel type: gpt
Disk identifier: 5A170C25-3FE4-866E-85E9-7154538C9DD1

Device       Start      End  Sectors  Size Type
/dev/sda1        6        7        2    8K unknown
/dev/sda2        8     8199     8192   32M unknown
/dev/sda3     8200     8455      256    1M unknown
/dev/sda4     8456     8711      256    1M unknown
/dev/sda5     8712     8839      128  512K unknown
/dev/sda6     8840     8967      128  512K unknown
/dev/sda7     8968    74503    65536  256M unknown
/dev/sda8    74504    77063     2560   10M unknown
/dev/sda9    77064    79623     2560   10M unknown
/dev/sda10   79624    81647     2024  7.9M unknown
/dev/sda11   81648    85695     4048 15.8M unknown
/dev/sda12   85696    85823      128  512K unknown
/dev/sda13   85824   817983   732160  2.8G unknown
/dev/sda14  817984  1550143   732160  2.8G unknown
/dev/sda15 1550144  1575743    25600  100M unknown
/dev/sda16 1575744  1601343    25600  100M unknown
/dev/sda17 1601344 30437370 28836027  110G unknown

Table of a 256GB OP:

it died before i could get it 🤷

Get the GPT Partition Tables

Download the OPX_UnBrick_Mini_By_Naman_Bhalla from xdadevelopers, in there you will find the needed gpt_main0.bin

If edl is still working:

./edl qfil rawprogram0.xml patch0.xml . and hopefully its fixed.

if you need to restore all partitions, grab the pygpt repo. Use it to create the partition table (run it with python2 !!!(

1. extract partition table

gpt_reader.py gpt_main0.bin > partition.xml

now you have the table as partition.xml and we need a tool to create them now as rawprogram0.xml and patch0.xml files which then can be pushed to the phone.

2. find the needed tools here.....

 GPTParserTool -x partition.xml 

now flash with qdl

qdl

Installation:

sudo pacman -S libxml2 
git clone https://git.codelinaro.org/clo/yocto-mirrors/github/linux-msm/qdl.git
cd qdl
make

Usage, just guessing:

./qdl --debug --storage ufs prog_firehose_ddr.elf rawprogram0.xml patch0.xml 

above seems to work


or maybe something like that:

./qdl  --debug --storage emmc --include 8974_msimage.mbn prog_emmc_firehose_8974.mbn rawprogram0.xml patch0.xml

external screen

copied from matrix channel:


This can be achieved with the 6T/6: see this issue/discussion: https://gitlab.com/postmarketOS/pmaports/-/issues/2295 You need to manually switch to Host mode (see the OP6 wiki) (instead of the automatic switching for OTG that others mentioned earlier) You also need to enable certain kernel options: forspecifically DRM_UDL: https://wiki.postmarketos.org/wiki/Displaylink Use the links above to see if you can get the HP adapter mentioned off eBay. Any DL-1x5 or DL-1x0 firmware models (wavlink, pluggable, diamond, HP, sabrent, siig all have models that are compatible)

To do List

  • Stop conky when screen is off with

kill -stop, and kill -cont. Can be added to sxmo_hook_screenoff.sh check how many cpu conky is using and think about stoping it as soon as desktop is hidden with any window.

ACTIVE_WORKSPACE=$(swaymsg -t get_workspaces | jq -r '.[] | select(.focused) | .name')

WINDOWS_COUNT=$(swaymsg -t get_tree | jq -r --arg workspace "$ACTIVE_WORKSPACE" '(.nodes[] | select(.type == "workspace" and .name == $workspace) | .nodes) | length')

if [ "$WINDOWS_COUNT" -gt 0 ]; then
    echo "There are $WINDOWS_COUNT window(s) open in the active workspace ($ACTIVE_WORKSPACE)."
else
    echo "No windows are open in the active workspace ($ACTIVE_WORKSPACE)."
fi


  • Add Dures PAM to unl0kr/screenlock, see for various reasons: Login as 'clean' user, start audio or screen recording, delete sensitive data or encrypt hd and destroy the key... mostly for freedom of speech reasons, e.g. for journalists, anarchists, climate activists...
  • fix the various headphone, speaker icons on sxmobar to be less cluttered and more logical (hooks/sxmo_hook_statusbar.sh)
  • test and push NFC further find info at buttom of this page
  • f2fs filesystem. pmbootstrap --filesystem f2fs
  • how to simulate that all my traffic is social media traffic? https/2 tls dns, to be able to use internet which only allows whatsapp and facebook (crapshit).
  • auto open firefox when wifi network requires a login
  • second keyboard with minimal config or new layout when this is fixed.
  • find a solution/hack to fake an usb cable connect/unconnect command to work around this.
  • modify the youtube script or write a new one to download audios: yt-dlp -f 251 -x $URL
  • how to use hydra to get around annoying hotel captive portals wich only last for a certain amount of time
  • get wifi passwords on the go..

dependencies:

sudo apk add scapy scapy-pyc py3-qt5 aircrack-ng reaver-wps-fork-t6x
git clone https://github.com/savio-code/fern-wifi-cracker.git

sudo -E python execute.py

op6 wifi driver does not support monitor mode yet, so we have to wait for otg support to use a wifi dongle..🤷


  • how to change imei without win computer and egsm or gsmtool.

should be similar as on pinephone:

# Create alias in `/root/.bashrc`.

    alias show-imei="echo 'AT+EGMR=0,7' | atinout - /dev/EG25.AT /dev/stdout"

    function _set_imei() {
        IMEI=$1
        echo "AT+EGMR=1,7,\"$IMEI\"" | atinout - /dev/EG25.AT /dev/stdout
    }
    # Vanity, I prefer - to _ for cmds ;)
    alias set-imei=_set_imei

Download: [https://github.com/narodnik/immi this] and simply run
`./imeichanger.py` to get another imei

Essential sxmo wiki sites

https://wiki.postmarketos.org/wiki/Sxmo:Oneplus6

https://wiki.postmarketos.org/wiki/User:Fdelamotte/dogfooding

https://wiki.postmarketos.org/wiki/sxmo/Tips_and_Tricks

Essential Packages

Default sxmo apps which are defined in mimetypes and are missing on default pmos install:

zathura nsxiv playerctl pciutils-libs

and for the sensors:

iio-sensor-proxy iio-sensor-proxy-openrc libssc

Terminal Apps

https://github.com/JustPretender/discovery-rs

Mobilized Dillo Browser

Download the tarball here. Install the needed dependencies

sudo apk add file-dev fltk fltk-dev

unpack, and then: ./config, make, make install. This is quite a cool, lightweight, bullshit-free browser.


Following is just a note to myself:

micro gnome-calculator loupe gnome-keyring rsync nano bash-completion networkmanager-openvpn bash vnstat zxing tesseract-ocr tesseract-ocr-data-eng wl-clipboard imagemagick wf-recorder calcurse git git-email numberstation pure-maps gnome-passwordsafe flatpak syncthing amberol dino podman tor lyrebird foliate fractal gcc alpine-sdk wayland-dev pango-dev libxkbcommon-dev krita flare

Flatpaks

I hate flatpaks, they eat all my data and diskspace. Its like a truck delivering an envelope...

flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo

Signal without waydroid

  • install flare & signal-cli
  • solve signalcaptchas.org/registratio... and copy "open signal" link
  • signal-cli -u +yourphonenumber register --captcha pastecaptchalink
  • signal-cli -u +yourphonenumber verify thecodesentbysms
  • open flare, link to device, without qrcode, copy link
  • signal-cli -u +yournumber addDevice "the_link" ( ""needed)

thanks to lolgzs via masto


Nostr = Gossip

sudo apk add ffmeg-dev clang19-libclang

git clone https://github.com/mikedilger/gossip.git

cd gossip
sudo ./build.sh

./target/release/gossip

Internet Alternatives

The regular www is not fun anymore, despite its way too data hungry, it its full of trackers, advertisements, disinformation, censorshit and is controlled by big capitalist companies, governments and isp's. Its time to search for alternatives to gain back our liberty and freedom of speech as we had when the internet was in its early days. Remember that the good guys could also be the bad guys.

Tor

Since there is no Tor-Browser in PostmarketOS

sudo apk add tor

sudo cp /etc/tor/torrc.sample /etc/tor/torrc

sudo service tor start

check if it is running with: sudo netstat -tunlp | grep tor

in Firefox Network Settings Select:

 Manual proxy configuration
 SOCKS Host 127.0.0.1  Port 9050

Tick the Proxy DNS when using SOCKS v5

For autostart Tor on boot:

sudo rc-update add tor default

This however, will not work in a country which Censors Tor connections, e.g. Iran, China...

You need to get obfs4proxy, its package name is lyrebird and you have to build it yourself.

get it with:

sudo apk add lyrebird --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing

Since you might not be able to access the official repo take my pre-built package, make lyrebird executable and copy it to /usr/bin/lyrebird try quickly if you can run it, if yes, it will throw an error like: lyrebird - must be run as a managed transport

Next make sure /etc/tor/torrc contains:

Log notice file /var/log/tor/notices.log
DataDirectory /var/lib/tor
ClientTransportPlugin obfs4 exec /usr/bin/lyrebird

then start or restart tor:

sudo rc-service tor start 

watch the log file while it tries to circumvent censorship:

sudo tail -f /var/log/tor/notices.log 

try in your configured browser. GOOD LUCK!

Yggdrasil

https://yggdrasil-network.github.io/

https://github.com/neilalexander/yggmail

sudo apk add yggdrasil

sudo micro /etc/yggdrasil.conf

# under 'Peers:' add a some from here: https://publicpeers.neilalexander.dev/

sudo rc-service yggdrasil start

open a webbrowser and visit one of the yggdrasil links found here.

hooray...

Gemini

Is an interesting protocol, especially for low bandwidth connections. Use geooard for simple reading stuff:

sudo apk add geopard

Visit:

gemini://magdesign.flounder.online/index.gmi


For more advanced interactions like posting stuff onto boards, you need an identity/certificate, for this its best to use ncgopher.

Build it with rust, its straight forward, then copy to /usr/bin/ and create a launcher entry in sxmo_hook_apps.sh with an adjusted font size to fit on mobile screen:

sxmo_terminal.sh --font=monospace:size=8 ncgopher 

Reticulum

Communication beyond the internet

https://github.com/liamcottle/reticulum-meshchat/

Install instructions:

sudo apk add py3-aiohttp \
py3-cx_freeze \
py3-peewee \
py3-websockets \
py3-pip \
py3-pyserial \
npm 

pip install rns --break-system-packages
pip install lxmf --break-system-packages

git clone https://github.com/liamcottle/reticulum-meshchat.git

cd reticulum-meshchat

git fetch
git pull

npm install --omit=dev
npm run build-frontend

mkdir storage

python ./meshchat.py  --generate-identity-file ~/reticulum-meshchat/storage/identity

python meshchat.py  --identity-file ~/reticulum-meshchat/storage/identity

If you skip the identity generation, everytime you launch you will get a new identity...

Now you are able to access meshchat via browser on localhost:8000

In the webinterface click on interfaces, edit the Default Interface, select TCPClientInterface and add the testserver dublin.connect.reticulum.network:4965

Restart reticulum to get server settings activated.

Send me a message to LXMF address:

911bcdbc51844e626a97f3cfda46058b


Toggle script there is a nice launcher in my codeberg repo.

Lokinet

https://github.com/oxen-io/lokinet