Sxmo/Tips and Tricks: Difference between revisions
Line 169: | Line 169: | ||
Something like this: | Something like this: | ||
<code>nmcli c add con-name "modem" type gsm ifname " | <code>nmcli c add con-name "modem" type gsm ifname "cdc-wdm0" apn "internet.t-d1.de" </code>. | ||
Please replace `wwan0qmi0` by your device, and `internet.t-d1.de` by ur apn | Please replace `wwan0qmi0` by your device, and `internet.t-d1.de` by ur apn | ||
source: https:// | source: https://wiki.postmarketos.org/index.php?title=Modem | ||
=== How to launch programms on startup? === | === How to launch programms on startup? === |
Revision as of 14:47, 7 January 2022
Here is a growing list of tips, tricks and configuration snippets for using Sxmo.
This pages is intended to focus mostly on "non-core" issues, such as running apps and everyday usability. The core configuration issues should end up in sxmo doc, as discussed on https://todo.sr.ht/~mil/sxmo-tickets/275
Calls, SMS, Modem
Sometimes Modem gets stuck
Sometimes the modem gets irresponsive*, stops receiving/sending calls, even when toggled. Rebooting sometimes doesn't change this situation as it seems the modem then needs a hard reset.
It seems it may happen when device gets out of battery, and/or when attempting to activate the modem when under 10% battery...
Preferred solution: restart eg25-manager*, then modemmanager
for instance running *as root*
rc-service eg25-manager restart
and
rc-service modemmanager stop; sxmo_modemmonitortoggle.sh
- (make sure to check it didn't fail via i.e. rc-status, if it did, restart it again, and only then modemmanager)
Note that such reset/restart functionality is already in sxmo, however, they don't work as reliable as they should (2021-09-04)
You can check dmesg for the modem registering once again if your attempt was successful. If it was not successful, check for a failure of either daemons and retry, or move on to the next method.
Reliable solution: reboot.
Sometimes SMS dont get sent/received
It may be a problem with MMS getting "stuck" in the pile, not being processed, and blocking further processing of SMS.
- Try restarting the modem manager script:
sudo rc-service modemmanager restart
- Wait a bit afterwards.
- Try rebooting. Sometimes the SMS just appears right before the system reboots. (why?)
- If there is a stuck MMS (how to check?), manually use Modem Manager to delete the incriminating mms:
mmcli --modem any --messaging-list-sms
mmcli --modem 0 --sms 0
mmcli --modem 0 --messaging-delete-sms=##
mmcli --modem 0 -r
- The identifying number of the modem may vary, being incremented upon toggles and sometimes reboots. you probably also can use:
--modem any
One solution involves mmsd-ng: What?
How to send an SMS via command line (or ssh)
cat mysupersmsfile | sxmo_modemsendsms.sh +33123123123 -
How to call from the command line
Example:
sxmo_modeldial.sh 08003301000
How to change SIM pin
From 1234 to 1010:
mmcli -i any --pin=1234 --change-pin=1010
Disabling:
mmcli -i any --pin=1010 --disable-pin
How to send USSD
Try something like:
mmcli -m any --3gpp-ussd-initiate="*100#"
How to send AT command
Directly
- If desired monitor output as root:
cat /dev/ttyUSB2
- In another terminal, send the command, in this example to check the ADSP firmware version:
echo -ne "AT+QGMR\r" >/dev/ttyUSB2
Through modem manager
- Restart modem manager in debug mode:
sudo /sbin/rc-service modemmanager stop
sudo /usr/sbin/ModemManager --debug
- In another terminal, send the command, in this example to check the ADSP firmware version:
mmcli -m any --command="AT+QGMR"
- Stop modem manager in debug mode, then run:
sudo /sbin/rc-service modemmanager start
Retrieving signal strength information
See https://wiki.postmarketos.org/wiki/Modem#ModemManager
Create contacts.tsv for Sxmo from Android data
This assumes you have developer mode enabled on your phone and usb debugging using adb.
I messed around with different API calls, I store the contacts locally on the device, what worked for me to get the full set of phone numbers was:
adb shell content query --uri content://com.android.contacts/data --projection display_name:data1:data3:data4 | grep '[0-9]\{10\}' | grep -v gprofile > raw_contacts
`create_contact_tsv.py` depends on python package `phonenumbers`, please install it.
then run on the terminal
python3 create_contacts_tsv.py raw_contacts | sort | uniq > contacts.tsv
For completeness, entire content of the python file `create_contact_tsv.py`
import csv, sys, phonenumbers as p;
with open(sys.argv[1], 'r') as file:
reader = csv.reader(file)
for row in reader:
name = row[0][str(row[0]).find("=") + 1:]
for match in p.PhoneNumberMatcher(str(row), None):
number = p.format_number(match.number, p.PhoneNumberFormat.E164)
print(number + "\t" + name)
Create contacts.tsv for Sxmo from a vcard export ( vcf export from nextcloud for example )
We can convert an export in vcard format of a contact list to a file sxmo can work with with the following commands:
git clone https://github.com/gled-rs/cvf2csv.git && cd cvf2csv && pip install phonenumbers
Put the vcard export you downloaded in the same directory as the convert.py script, name it contacts.vcf Look at README.md if you want to change the default behaviour of the convert script.
python convert.py && cp contacts.csv ~/.config/sxmo/contacts.tsv
General configuration
How to easily change the size of the text, system-wide?
Change the value in: /usr/share/sxmo/appcfg/xresources_xft.xr (try 160!)
Xft.dpi: 192
(chaning it in ~/.Xresources
works as well)
if you remove the dpi line there you can set dpi on the fly via
xrandr --dpi x
How to activate data
Something like this:
nmcli c add con-name "modem" type gsm ifname "cdc-wdm0" apn "internet.t-d1.de"
.
Please replace `wwan0qmi0` by your device, and `internet.t-d1.de` by ur apn
source: https://wiki.postmarketos.org/index.php?title=Modem
How to launch programms on startup?
The easy way is to edit the following file (you can also edit it via the config > edit configuration entry):
vi .config/sxmo/xinit
and add your programms somewhere. Warning: they have to execute quickly and/or not stay in foreground, or the window manager won't start (don't forget to add "&" at the end)
mount /tmp/ in RAM, to save write cycles on storage device
add the following in /etc/fstab
tmpfs /tmp tmpfs rw,nodev 0 0
Help with adding cronjobs
You can edit your crontab via
crontab -e
This website https://crontab.guru/ has proven useful in making cronjobs.
If using mnc, make sure that commands run via sxmo_rtcwake.sh.
Example:
55-59/2 7 * * 1-5 sxmo_rtcwake.sh /home/user/script
How to customize the colours/fonts of the interface?
xorg/dwm
Get example in the alpine blooms theme by Tetrakist, as entries to add in /home/user/.Xresources
wayland/sway
- .config/sxmo/sway
- bemenu parameters through BEMENU_OPTS env variable. for instance in .profile:
export BEMENU_OPTS="--fn 'FiraMono Nerd Font 13' --tf '$MYCOLOR' --tb '#00000090' --nb '#00000090' --nf '$MYCOLOR' --hb '$MYCOLOR' --hf '#000000' --sb '$MYCOLOR' --sf '$MYCOLOR' --scb '#000000' --scf '$MYCOLOR' "
- mako config in .config/mako/config
Some notifications stay stuck on the screen!
pkill dunst
- launch nmtui (a rotated screen is usually better)
- add a new connection, type "ethernet" for interface "usb0", in ipv4 settings chose "shared".
- you may want to uncheck "automatically connect", so you can manually activate it later, when you need it, in the "networks" dmenu.
- activate that connection.
voilà!
Applications specific
Pure-maps sort of works (using OpenTopo or Sputnik tiles), as well as Marble (QT/KDE, heavy...). Unsure yet how to make the GPS work for both of these, but it has reported being feasible...
Apparently a good start to enable GPS should be:
sudo /etc/gpsd/device-hook "" ACTIVATE
See https://wiki.postmarketos.org/wiki/Applications_by_category#Geography for geography applications.
QT app (vlc-qt, etc.) doesnt fit the screen!
try adding the following in your .config/sxmo/xinit
export QT_AUTO_SCREEN_SCALE_FACTOR=1
export QT_SCALE_FACTOR=0.7
(change the factor until it suits your need)
Extra features, advanced tweaking
A Wayland version of Sxmo, really??
Many dreamt of it, it seems to be in the pipes, under heavy/advanced development!
To try it out **at your own risk**, according to some well-informed participants in the project:
git clone https://git.sr.ht/~mil/sxmo-build
cd sxmo-build
./sxmo_build_all.sh --wayland
In case of a problem, try to completely remove your build dir and run the build script again (sxmo_build_all.sh).
Adding Apps to the List
Create a file at ~/.config/sxmo/hooks/apps.
mkdir ~/.config/sxmo
mkdir ~/.config/sxmo/hooks
touch ~/.config/sxmo/hooks/apps
Make the new file executable.
chmod +x ~/.config/sxmo/hooks/apps
Using your favorite editor, copy the app list from
/usr/bin/sxmo_appmenu.sh
Entries in the new file should look like this:
(command -v firefox >/dev/null && echo "$icon_ffx Firefox ^ 0 ^ firefox")
or like this if you want to skip verification:
(echo "$icon_ffx Firefox ^ 0 ^ firefox")