├── README.md ├── mms.sh └── test-and-connect-modem.sh /README.md: -------------------------------------------------------------------------------- 1 | # PinePhone 2 | This repo contains my notes for using the [PinePhone](https://www.pine64.org/pinephone/). It includes some steps for setting up [Arch Linux](https://github.com/dreemurrs-embedded/Pine64-Arch) the way I like it, and some workarounds to compensate for things that aren't quite working yet on the [PinePhone](https://www.pine64.org/pinephone/) out of the box. These notes are mainly for me, but they're up here incase they may be useful to anyone else :) 3 | 4 | 5 | ![neofetch_pinephone](https://user-images.githubusercontent.com/8961705/133648326-79f331c2-b74b-4833-bcfa-caf28118d444.png) 6 | 7 | I've been using my [PinePhone](https://www.pine64.org/pinephone/) as my daily driver since July 1st, 2021. 8 | 9 | 10 | ## Installation 11 | [Dreemurrs's](https://github.com/dreemurrs-embedded) script for installing Arch on the PinePhone/PineTab with full disk encryption works perfectly. It can be found here -> [archarm-mobile-fde-installer](https://github.com/dreemurrs-embedded/archarm-mobile-fde-installer). 12 | 13 | ## Initial Setup 14 | 15 | ### Done with phone in hand. 16 | 1. Get things updated with `sudo pacman -Syu`. 17 | 2. Enable ssh `sudo systemctl start sshd.service`, only do this at home while you've got password auth enabled (especially with password `123456`). 18 | 19 | ### Done via SSH. 20 | 0. SSH in to do the rest of this so that it's not all phone screen typing nonsense. 21 | 1. Change password for alarm user (keep numeric so pin works) `passwd`. Then `su root` and `passwd` to change the root password...then exit. 22 | 2. Make ssh directory `mkdir ~/.ssh`. 23 | 3. Install some usefull stuff via `sudo pacman -S wget vim` 24 | 4. Download keys for key auth `wget https://github.com/d0n601.keys -O ~/.ssh/authorized_keys`. 25 | 5. Exit the session and ssh in again with no password to verify functionality. 26 | 6. Disable password authentication to ssh via `sudo vim /etc/ssh/sshd_config`, and setting `PasswordAuthentication no`. 27 | 28 | ### Install GUI File Browser 29 | 1. `sudo pacman -S nemo` 30 | 31 | ### Install Gnome Podcasts 32 | 1. `sudo pacman -S gnome-podcasts` 33 | 34 | ### Install and Enable Cronie 35 | 1. `sudo pacman -S cronie` 36 | 2. `sudo systemctl enable cronie.service` 37 | 38 | ### Install and Configure zsh 39 | 0. Install zsh and git via `sudo pacman -S zsh git`. 40 | 1. Install [ohmyzsh](https://github.com/ohmyzsh/ohmyzsh) via `sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"`. 41 | 2. Set my favorite theme via `ZSH_THEME="duellj"` in `~/.zshrc`. 42 | 3. Clone [zsh-autosuggestions](https://github.com/zsh-users/zsh-autosuggestions) plugin `git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions` 43 | 4. Set very convenient auto suggestion plugin via `plugins=(git zsh-autosuggestions)` in `~/.zshrc`. 44 | 5. **Bonus:** `sudo pacman -S cowfortune` and add `cowfortune` to the bottom of `~/.zshrc`. 45 | 46 | ### Gnome Icons 47 | I used Manjaro with Posh for a while before switching to Arch, and I missed the look of the default Manjaro setup. 48 | 1. Clone the repo `git clone https://github.com/Ste74/papirus-maia-icon-theme.git`. 49 | 2. Make the directory icon `sudo mkdir /usr/share/icons/Papirus-Dark-Maia`. 50 | 3. Copy all the files from the dark theme over `sudo cp -R ./papirus-maia-icon-theme/Papirus-Dark-Maia/* /usr/share/icons/Papirus-Dark-Maia`. 51 | 4. Set the icons `gsettings set org.gnome.desktop.interface icon-theme "Papirus-Dark-Maia"`. 52 | 5. Reboot. 53 | 54 | 55 | ### Bluetooth Audio 56 | Some headphones worked, some didn't. I found the steps below allowed me to pair the nicer set of headphones I've got that weren't working before. 57 | 1. Install Pulas Audio Bluetooth `sudo pacman -S pulseaudio-bluetooth`. 58 | 2. Add `Enable=Source,Sink,Media,Socket` to `[General]` section of `/etc/bluetooth/main.conf`. 59 | 3. Then `pulseaudio -k`. 60 | 61 | 62 | ### Wifi Hot HotSpot 63 | `sudo nmcli device wifi hotspot ifname wlan0 con-name Hotspot ssid YOURKOOLSSID password APASSWORDHERE` 64 | 65 | 66 | ## Workarounds 67 | This sections is for temporary workarounds for things that aren't quite working on the PinePhone as of writing this. Hopefully this section will dwindle away to `null` in the future. 68 | 69 | 70 | ### Desktop Apps 71 | While there aren't many applications with a GUI built for mobile devices, it's helpful to use desktop apps in "scale-to-fit" mode (if your eyesight is good enough). 72 | 73 | 1. `gsettings set sm.puri.phoc scale-to-fit true` 74 | 75 | 76 | ### Protonmail Bridge 77 | 1. Clone repo here via `git clone https://github.com/ProtonMail/proton-bridge.git` 78 | 2. Install dependencies `sudo pacman -S gcc libsecret go`. 79 | 80 | 81 | ### Alarm Clock 82 | Right now the alarm clock won't wake the phone from deep sleep, which means it will not work as an alarm clock. Currently Posh users can install the [birdie](https://github.com/Dejvino/birdie) app instead, which works excellent. I [forked](https://github.com/d0n601/birdie) it to change the alarm sound to the more familar Ubuntu Touch alarm I'm used to, and to increase the snooze time significantly ;) 83 | 84 | 1. Install dependencies if you've not done so already via `sudo pacman -S python-pip make gcc`. 85 | 2. Clone the original, or in this case my fork, via `git clone https://github.com/d0n601/birdie`. 86 | 3. Move into the directory `cd birdie`. 87 | 4. Install the dependencies via `pip3 install -r requirements.txt`. 88 | 89 | 90 | ### Modem Losing Connection 91 | The modem will drop connection from time to time. Instead of having to pay attention to it, make a cronjob and script to reset it if it's dropped off. 92 | 1. Create script called `test-and-connect-modem.sh`. 93 | ```bash 94 | #!/bin/bash 95 | FILE=/dev/ttyUSB2 96 | 97 | if ! test -c "$FILE"; then 98 | systemctl restart eg25-manager 99 | fi 100 | ``` 101 | 2. Set privileges and ownership of script `sudo chown root:root test-and-connect-modem.sh 102 | && sudo chmod 700 test-and-connect-modem.sh`. 103 | 3. Enable cron to run every minute via `sudo crontab -e` and add `* * * * * /home/alarm/test-and-connect-modem.sh`. 104 | 105 | 106 | ### MMS 107 | Sending and recieving MMS now works simply by enabling the settings in Chatty and having `mmsd-tng` installed [source](https://github.com/dreemurrs-embedded/Pine64-Arch/wiki/MMS). 108 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /mms.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #Purpose: Download then try to extract data from MMS messages 3 | #Depends: curl, recoverjpeg, pulseaudio, libnotify-bin, sox 4 | 5 | #Proxy URL / Port 6 | #This is the mms apn settings from you service provider 7 | #You can probably find them in /us:wqr/share/mobile-broadband-provider-info/apns-conf.xml 8 | PROXYURL="proxy.mobile.att.net" 9 | PROXYPORT="80" 10 | 11 | #Where to store the mms files 12 | MMS_STORE_DIR="/home/alarm/mms" 13 | MMS_WORK_DIR="$MMS_STORE_DIR/temp" 14 | DOWNLOAD_LIST="$MMS_WORK_DIR/download.list" 15 | 16 | #Alert/notification sound file (must be playable with the "play" command) 17 | SOUND_FILE="/usr/share/sounds/librem5/stereo/message-new-instant.oga" 18 | 19 | MODEM_NUM=`mmcli -L|awk '{print $1}'|awk -F '/' '{print $6}'`; 20 | #Interface as found in ip addr (must be connected with data to the service provider network) 21 | INTERFACE="wwan0"; 22 | 23 | #Date Format for the saved files. 24 | DATE=$(date +%d-%m-%y_%H-%M) 25 | 26 | echo "checking and making dirs" 27 | if [ ! -d $MMS_STORE_DIR ]; then mkdir -p $MMS_STORE_DIR; fi 28 | if [ ! -d $MMS_WORK_DIR ]; then mkdir -p $MMS_WORK_DIR; fi 29 | 30 | function get_modem_messages() { 31 | for SMSNUM in $(mmcli -m $MODEM_NUM --messaging-list-sms |grep "received" | cut -f 6 -d '/' | awk '{print $1}') 32 | do 33 | mmcli -m $MODEM_NUM -s $SMSNUM --create-file-with-data=$MMS_WORK_DIR/$SMSNUM.sms 34 | mmcli -m $MODEM_NUM --messaging-delete-sms $SMSNUM; 35 | done 36 | } 37 | 38 | function build_download_list() { 39 | if [ -f $DOWNLOAD_LIST ]; then rm $DOWNLOAD_LIST; fi 40 | for file in $(ls $MMS_WORK_DIR/*.sms) 41 | do 42 | FROM=$(cat -v $file |sed "s/\^C/\n/ig" |sed "s/\^@/\n/ig"|grep -E "\+[0-9]{9}" |head -1 ) 43 | FROM=${FROM%/*} 44 | DOWNLOAD=$(cat -v $file |sed "s/\^C/\n/ig" |sed "s/\^@//ig"|grep "htt.*/"|head -1) 45 | FILENAME=$(basename -s .sms "$file") 46 | echo "$FILENAME|$FROM|$DOWNLOAD" >> $DOWNLOAD_LIST 47 | done 48 | #rm "$MMS_WORK_DIR/*.sms" 49 | mkdir -p $MMS_WORK_DIR/$DATE 50 | mv $MMS_WORK_DIR/*.sms $MMS_WORK_DIR/$DATE 51 | } 52 | 53 | function download_messages() { 54 | for message in $(cat $DOWNLOAD_LIST) 55 | do 56 | DOWNLOAD=${message#*|*|} 57 | FILENAME=${message%|*|*} 58 | echo "$FILENAME" 59 | FROM=${message#*|} 60 | FROM=${FROM%|*} 61 | export FROM 62 | curl --interface $INTERFACE --proxy $PROXYURL:$PROXYPORT "$DOWNLOAD" -o $MMS_WORK_DIR/$FILENAME.mms 63 | mkdir -p $MMS_STORE_DIR/$FILENAME_$DATE/ 64 | echo "FROM: $FROM" > $MMS_STORE_DIR/$FILENAME_$DATE/$FILENAME.info 65 | TO=$(cat -v $MMS_WORK_DIR/$FILENAME.mms |sed "s/.*\^@.[0-9]//ig"|sed "s/\^W/\n/ig"|sed "s/\/.*//ig"|grep -E "\+[0-9]{9}.*"|tr "\n" " ") 66 | echo "TO: $TO" >> $MMS_STORE_DIR/$FILENAME_$DATE/$FILENAME.info 67 | echo "MESSAGE:" >> $MMS_STORE_DIR/$FILENAME_$DATE/$FILENAME.info 68 | echo $(cat -v $MMS_WORK_DIR/$FILENAME.mms |tail -1 |grep "text"|sed "s/.*.txt\^@//ig") >> $MMS_STORE_DIR/$FILENAME_$DATE/$FILENAME.info 69 | recoverjpeg -b1 $MMS_WORK_DIR/$FILENAME.mms -o $MMS_STORE_DIR/$FILENAME_$DATE -f $FILENAME.jpg 70 | 71 | done 72 | #rm "$MMS_WORK_DIR/*.mms" 73 | mv $MMS_WORK_DIR/*.mms $MMS_WORK_DIR/$DATE 74 | chown -R alarm:alarm $MMS_WORK_DIR 75 | } 76 | 77 | 78 | IP=$(ip a show dev wwan0 | grep "inet" | head -n 1) 79 | if [ -z "$IP" ] ; then 80 | echo "I have no cellular IP address! Please connect to mobile data" 81 | runuser -l alarm -c '/usr/bin/notify-send "I have no cellular IP address! Please connect to mobile data"' 82 | runuser -l alarm -c '/usr/bin/paplay $SOUND_FILE &> /dev/null' 83 | exit 84 | else 85 | echo "getting messages from modem" 86 | get_modem_messages 87 | echo "checking for messages" 88 | file_check=`ls -1 $MMS_WORK_DIR/*.sms 2>/dev/null | wc -l` 89 | if [ $file_check != 0 ]; then 90 | echo "making download list" 91 | build_download_list; 92 | echo "Downloading mms messages and extracting data" 93 | download_messages; 94 | runuser -l alarm -c "/usr/bin/notify-send 'MMS Downloaded from $FROM'" 95 | runuser -l alarm -c "/usr/bin/paplay $SOUND_FILE" 96 | fi 97 | fi 98 | -------------------------------------------------------------------------------- /test-and-connect-modem.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | FILE=/dev/ttyUSB2 3 | 4 | if ! test -c "$FILE"; then 5 | systemctl restart eg25-manager 6 | fi 7 | --------------------------------------------------------------------------------