From 0e4dcd2790a8ddd16d9850d88ef762ba1dab7416 Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Sun, 4 Apr 2021 16:32:45 +0100 Subject: [PATCH 1/7] Fixes alsa default config --- alsa/.config/alsa/README.md | 3 - alsa/.config/alsa/default_alsa_sound.conf | 246 ++++++++++++---------- 2 files changed, 133 insertions(+), 116 deletions(-) delete mode 100644 alsa/.config/alsa/README.md diff --git a/alsa/.config/alsa/README.md b/alsa/.config/alsa/README.md deleted file mode 100644 index eb6aaae5..00000000 --- a/alsa/.config/alsa/README.md +++ /dev/null @@ -1,3 +0,0 @@ -This file was ~~stolen~~ borrowed from sxmo - - diff --git a/alsa/.config/alsa/default_alsa_sound.conf b/alsa/.config/alsa/default_alsa_sound.conf index a272d160..17461307 100644 --- a/alsa/.config/alsa/default_alsa_sound.conf +++ b/alsa/.config/alsa/default_alsa_sound.conf @@ -1,9 +1,29 @@ state.PinePhone { control.1 { + iface CARD + name 'Headphone Jack' + value false + comment { + access read + type BOOLEAN + count 1 + } + } + control.2 { + iface CARD + name 'Headset Microphone Jack' + value false + comment { + access read + type BOOLEAN + count 1 + } + } + control.3 { iface MIXER name 'AIF1 AD0 Capture Volume' - value.0 165 - value.1 165 + value.0 160 + value.1 160 comment { access 'read write' type INTEGER @@ -11,15 +31,15 @@ state.PinePhone { range '0 - 192' dbmin -9999999 dbmax 2400 - dbvalue.0 375 - dbvalue.1 375 + dbvalue.0 0 + dbvalue.1 0 } } - control.2 { + control.4 { iface MIXER name 'AIF1 DA0 Playback Volume' - value.0 149 - value.1 149 + value.0 160 + value.1 160 comment { access 'read write' type INTEGER @@ -27,15 +47,15 @@ state.PinePhone { range '0 - 192' dbmin -9999999 dbmax 2400 - dbvalue.0 -825 - dbvalue.1 -825 + dbvalue.0 0 + dbvalue.1 0 } } - control.3 { + control.5 { iface MIXER name 'AIF2 ADC Capture Volume' - value.0 168 - value.1 168 + value.0 160 + value.1 160 comment { access 'read write' type INTEGER @@ -43,15 +63,15 @@ state.PinePhone { range '0 - 192' dbmin -9999999 dbmax 2400 - dbvalue.0 600 - dbvalue.1 600 + dbvalue.0 0 + dbvalue.1 0 } } - control.4 { + control.6 { iface MIXER name 'AIF2 DAC Playback Volume' - value.0 0 - value.1 0 + value.0 160 + value.1 160 comment { access 'read write' type INTEGER @@ -59,15 +79,15 @@ state.PinePhone { range '0 - 192' dbmin -9999999 dbmax 2400 - dbvalue.0 -9999999 - dbvalue.1 -9999999 + dbvalue.0 0 + dbvalue.1 0 } } - control.5 { + control.7 { iface MIXER name 'ADC Capture Volume' - value.0 179 - value.1 179 + value.0 160 + value.1 160 comment { access 'read write' type INTEGER @@ -75,15 +95,15 @@ state.PinePhone { range '0 - 192' dbmin -9999999 dbmax 2400 - dbvalue.0 1425 - dbvalue.1 1425 + dbvalue.0 0 + dbvalue.1 0 } } - control.6 { + control.8 { iface MIXER name 'DAC Playback Volume' - value.0 169 - value.1 169 + value.0 160 + value.1 160 comment { access 'read write' type INTEGER @@ -91,14 +111,14 @@ state.PinePhone { range '0 - 192' dbmin -9999999 dbmax 2400 - dbvalue.0 675 - dbvalue.1 675 + dbvalue.0 0 + dbvalue.1 0 } } - control.7 { + control.9 { iface MIXER name 'Headphone Playback Volume' - value 29 + value 63 comment { access 'read write' type INTEGER @@ -106,13 +126,13 @@ state.PinePhone { range '0 - 63' dbmin -9999999 dbmax 0 - dbvalue.0 -3400 + dbvalue.0 0 } } - control.8 { + control.10 { iface MIXER name 'Mic1 Playback Volume' - value 0 + value 3 comment { access 'read write' type INTEGER @@ -120,13 +140,13 @@ state.PinePhone { range '0 - 7' dbmin -450 dbmax 600 - dbvalue.0 -450 + dbvalue.0 0 } } - control.9 { + control.11 { iface MIXER name 'Mic1 Boost Volume' - value 0 + value 4 comment { access 'read write' type INTEGER @@ -134,13 +154,13 @@ state.PinePhone { range '0 - 7' dbmin 0 dbmax 4200 - dbvalue.0 0 + dbvalue.0 3300 } } - control.10 { + control.12 { iface MIXER name 'Mic2 Playback Volume' - value 0 + value 3 comment { access 'read write' type INTEGER @@ -148,13 +168,13 @@ state.PinePhone { range '0 - 7' dbmin -450 dbmax 600 - dbvalue.0 -450 + dbvalue.0 0 } } - control.11 { + control.13 { iface MIXER name 'Mic2 Boost Volume' - value 0 + value 4 comment { access 'read write' type INTEGER @@ -162,10 +182,10 @@ state.PinePhone { range '0 - 7' dbmin 0 dbmax 4200 - dbvalue.0 0 + dbvalue.0 3300 } } - control.12 { + control.14 { iface MIXER name 'ADC Gain Capture Volume' value 3 @@ -179,10 +199,10 @@ state.PinePhone { dbvalue.0 0 } } - control.13 { + control.15 { iface MIXER name 'Line In Playback Volume' - value 0 + value 3 comment { access 'read write' type INTEGER @@ -190,13 +210,13 @@ state.PinePhone { range '0 - 7' dbmin -450 dbmax 600 - dbvalue.0 -450 + dbvalue.0 0 } } - control.14 { + control.16 { iface MIXER name 'Line Out Playback Volume' - value 0 + value 31 comment { access 'read write' type INTEGER @@ -204,13 +224,13 @@ state.PinePhone { range '0 - 31' dbmin -9999999 dbmax 0 - dbvalue.0 -9999999 + dbvalue.0 0 } } - control.15 { + control.17 { iface MIXER name 'Earpiece Playback Volume' - value 0 + value 31 comment { access 'read write' type INTEGER @@ -218,14 +238,14 @@ state.PinePhone { range '0 - 31' dbmin -9999999 dbmax 0 - dbvalue.0 -9999999 + dbvalue.0 0 } } - control.16 { + control.18 { iface MIXER name 'AIF1 AD0 Stereo Capture Route' - value.0 'Mix Mono' - value.1 'Mix Mono' + value.0 Stereo + value.1 Stereo comment { access 'read write' type ENUMERATED @@ -236,11 +256,11 @@ state.PinePhone { item.3 'Mix Mono' } } - control.17 { + control.19 { iface MIXER name 'AIF2 ADC Stereo Capture Route' - value.0 Stereo - value.1 Stereo + value.0 'Mix Mono' + value.1 'Mix Mono' comment { access 'read write' type ENUMERATED @@ -251,20 +271,20 @@ state.PinePhone { item.3 'Mix Mono' } } - control.18 { + control.20 { iface MIXER name 'AIF3 ADC Source Capture Route' - value 'AIF2 Right' + value None comment { access 'read write' type ENUMERATED count 1 item.0 None - item.1 'AIF2 Left' - item.2 'AIF2 Right' + item.1 'AIF2 ADCL' + item.2 'AIF2 ADCR' } } - control.19 { + control.21 { iface MIXER name 'AIF1 Slot 0 Digital ADC Capture Switch' value.0 false @@ -275,21 +295,21 @@ state.PinePhone { count 2 } } - control.20 { + control.22 { iface MIXER name 'AIF2 Digital ADC Capture Switch' value.0 false - value.1 false + value.1 true comment { access 'read write' type BOOLEAN count 2 } } - control.21 { + control.23 { iface MIXER name 'AIF1 Data Digital ADC Capture Switch' - value.0 false + value.0 true value.1 false comment { access 'read write' @@ -297,7 +317,7 @@ state.PinePhone { count 2 } } - control.22 { + control.24 { iface MIXER name 'AIF2 Inv Digital ADC Capture Switch' value.0 false @@ -308,18 +328,18 @@ state.PinePhone { count 2 } } - control.23 { + control.25 { iface MIXER name 'AIF2 ADC Mixer AIF1 DA0 Capture Switch' value.0 false - value.1 false + value.1 true comment { access 'read write' type BOOLEAN count 2 } } - control.24 { + control.26 { iface MIXER name 'AIF2 ADC Mixer AIF2 DAC Rev Capture Switch' value.0 false @@ -330,10 +350,10 @@ state.PinePhone { count 2 } } - control.25 { + control.27 { iface MIXER name 'AIF2 ADC Mixer ADC Capture Switch' - value.0 false + value.0 true value.1 false comment { access 'read write' @@ -341,20 +361,20 @@ state.PinePhone { count 2 } } - control.26 { + control.28 { iface MIXER name 'AIF2 DAC Source Playback Route' - value None + value AIF2 comment { access 'read write' type ENUMERATED count 1 - item.0 None - item.1 'AIF2 Left' - item.2 'AIF2 Right' + item.0 AIF2 + item.1 AIF3+2 + item.2 AIF2+3 } } - control.27 { + control.29 { iface MIXER name 'AIF1 DA0 Stereo Playback Route' value.0 Stereo @@ -369,11 +389,11 @@ state.PinePhone { item.3 'Mix Mono' } } - control.28 { + control.30 { iface MIXER name 'AIF2 DAC Stereo Playback Route' - value.0 Stereo - value.1 Stereo + value.0 'Sum Mono' + value.1 'Sum Mono' comment { access 'read write' type ENUMERATED @@ -384,29 +404,29 @@ state.PinePhone { item.3 'Mix Mono' } } - control.29 { + control.31 { iface MIXER name 'AIF1 Slot 0 Digital DAC Playback Switch' value.0 true - value.1 true + value.1 false comment { access 'read write' type BOOLEAN count 2 } } - control.30 { + control.32 { iface MIXER name 'AIF2 Digital DAC Playback Switch' value.0 false - value.1 false + value.1 true comment { access 'read write' type BOOLEAN count 2 } } - control.31 { + control.33 { iface MIXER name 'ADC Digital DAC Playback Switch' value.0 false @@ -417,7 +437,7 @@ state.PinePhone { count 2 } } - control.32 { + control.34 { iface MIXER name 'Headphone Source Playback Route' value.0 DAC @@ -430,7 +450,7 @@ state.PinePhone { item.1 Mixer } } - control.33 { + control.35 { iface MIXER name 'Headphone Playback Switch' value.0 true @@ -441,10 +461,10 @@ state.PinePhone { count 2 } } - control.34 { + control.36 { iface MIXER name 'Line Out Source Playback Route' - value.0 'Mono Differential' + value.0 Stereo value.1 Stereo comment { access 'read write' @@ -454,18 +474,18 @@ state.PinePhone { item.1 'Mono Differential' } } - control.35 { + control.37 { iface MIXER name 'Line Out Playback Switch' - value.0 false - value.1 false + value.0 true + value.1 true comment { access 'read write' type BOOLEAN count 2 } } - control.36 { + control.38 { iface MIXER name 'Earpiece Source Playback Route' value DACR @@ -479,17 +499,17 @@ state.PinePhone { item.3 'Left Mixer' } } - control.37 { + control.39 { iface MIXER name 'Earpiece Playback Switch' - value false + value true comment { access 'read write' type BOOLEAN count 1 } } - control.38 { + control.40 { iface MIXER name 'Mic1 Playback Switch' value.0 false @@ -500,7 +520,7 @@ state.PinePhone { count 2 } } - control.39 { + control.41 { iface MIXER name 'Mic2 Playback Switch' value.0 false @@ -511,18 +531,18 @@ state.PinePhone { count 2 } } - control.40 { + control.42 { iface MIXER name 'Line In Playback Switch' - value.0 false - value.1 false + value.0 true + value.1 true comment { access 'read write' type BOOLEAN count 2 } } - control.41 { + control.43 { iface MIXER name 'DAC Playback Switch' value.0 true @@ -533,7 +553,7 @@ state.PinePhone { count 2 } } - control.42 { + control.44 { iface MIXER name 'DAC Reversed Playback Switch' value.0 false @@ -544,18 +564,18 @@ state.PinePhone { count 2 } } - control.43 { + control.45 { iface MIXER name 'Mic1 Capture Switch' - value.0 false - value.1 false + value.0 true + value.1 true comment { access 'read write' type BOOLEAN count 2 } } - control.44 { + control.46 { iface MIXER name 'Mic2 Capture Switch' value.0 false @@ -566,7 +586,7 @@ state.PinePhone { count 2 } } - control.45 { + control.47 { iface MIXER name 'Line In Capture Switch' value.0 false @@ -577,7 +597,7 @@ state.PinePhone { count 2 } } - control.46 { + control.48 { iface MIXER name 'Mixer Capture Switch' value.0 false @@ -588,7 +608,7 @@ state.PinePhone { count 2 } } - control.47 { + control.49 { iface MIXER name 'Mixer Reversed Capture Switch' value.0 false From f1dd615869199d72f7a219efc6576f426a22656c Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Sun, 4 Apr 2021 17:30:49 +0100 Subject: [PATCH 2/7] Adds missed calls list to phone menu --- bin/.bin/dmenu/menu-phone | 25 ++++++++++++++++++++++++- bin/.bin/dmenu/trofi | 2 +- bin/.bin/modem/checkCall | 2 +- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/bin/.bin/dmenu/menu-phone b/bin/.bin/dmenu/menu-phone index d302b8e7..c784406b 100755 --- a/bin/.bin/dmenu/menu-phone +++ b/bin/.bin/dmenu/menu-phone @@ -1,9 +1,31 @@ #!/usr/bin/env bash +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +source "$DIR/../modem/common" + +viewMissedCalls(){ + local choice="$( ( + #cat "$CALL_DIR/missed-calls" | awk -F '\t' '{"date +%Y-%m-%d %H:%M:%S -d @" $1 |& getline $1; print $2 "" $1 ""}' + cat "$CALL_DIR/missed-calls" | awk -F '\t' '{"date -d @" $1 " \"+%Y-%m-%d %H:%M:%S\"" |& getline $1; print $2 " " $1 ""}' + echo "Clear" + )| trofi -markup-rows )" + case "$choice" in + "Clear") rm "$CALL_DIR/missed-calls" ;; + *) + local number="$(echo "$choice" | cut -d ' ' -f 3)" + makeCall "$number" + ;; + esac +} + options="End All Calls Check for Calls Check for Texts -Dialer" +$( [ -f "$CALL_DIR/missed-calls" ] && echo "Missed Calls" ) +Dialer +Back" + +options="$(echo "$options" | sed '/^$/d')" while true ; do choice="$(echo "$options" | trofi)" @@ -14,6 +36,7 @@ while true ; do break ;; "Check for Calls") checkCall ;; "Check for Texts") checkSMS ;; + "Missed Calls") viewMissedCalls; break ;; "Dialer") (dialer &); break ;; "Back") break;; esac diff --git a/bin/.bin/dmenu/trofi b/bin/.bin/dmenu/trofi index 04ffa097..70f605ba 100755 --- a/bin/.bin/dmenu/trofi +++ b/bin/.bin/dmenu/trofi @@ -9,4 +9,4 @@ lines="$(echo "$input" | wc -l )" [ "$lines" -gt 15 ] && lines=15 -echo "$input" | rofi -dmenu -me-accept-entry '!MousePrimary' -theme "themes/touch-dmenu.rasi" -lines "$lines" +echo "$input" | rofi -dmenu -me-accept-entry '!MousePrimary' -theme "themes/touch-dmenu.rasi" -lines "$lines" "$@" diff --git a/bin/.bin/modem/checkCall b/bin/.bin/modem/checkCall index 50ce0d1d..56dfb5fe 100755 --- a/bin/.bin/modem/checkCall +++ b/bin/.bin/modem/checkCall @@ -220,7 +220,7 @@ checkFinished(){ # it hasn't been answerd yet. # Treat as a missed call if ps aux | grep -E '\Wrofi' | grep -q "call-from-$contact"; then - echo "Missed call from $contact" >> "$CALL_DIR/missed-calls" + echo -e "$(date '+%s')\t$contact\t$number" >> "$CALL_DIR/missed-calls" pkill mpv mmcli -m "$modem" --voice-delete-call "$id" ps aux | grep -E '\Wrofi' | grep "call-from-$contact" | From 5b05bb9c2c366ce95fdb4fbd08ac1ad54d79950e Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Mon, 5 Apr 2021 10:23:39 +0100 Subject: [PATCH 3/7] Changes the sms log file so that new messages can be counted The log now contains @READ@ where @ is a null byte where new and old messages diverge. This means that new sms's can be more easily counted This, as well as a count for missed calls, has been added to the phoneStatus notification --- bin/.bin/modem/checkSMS | 2 ++ bin/.bin/notifications/phoneStatus | 25 +++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/bin/.bin/modem/checkSMS b/bin/.bin/modem/checkSMS index dcb48cbf..4412807e 100755 --- a/bin/.bin/modem/checkSMS +++ b/bin/.bin/modem/checkSMS @@ -61,6 +61,8 @@ echo "$ids" | while read -r id; do log="$SMS_DIR/$number/sms.log" + [ ! -f "$log" ] && printf '\00READ\00' >> "$log" + # Store the message in the log file echo "RECIEVED" echo "SENDER: $number" >> $log diff --git a/bin/.bin/notifications/phoneStatus b/bin/.bin/notifications/phoneStatus index 1dc8d2ec..97037fed 100755 --- a/bin/.bin/notifications/phoneStatus +++ b/bin/.bin/notifications/phoneStatus @@ -1,10 +1,31 @@ #!/usr/bin/env bash +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +source "$DIR/../modem/common" + battery="$(cat /sys/class/power_supply/axp20x-battery/capacity)" batteryStatus="$(cat /sys/class/power_supply/axp20x-battery/status)" [ "$batteryStatus" = "Charging" ] && batteryIcon="🔌" || batteryIcon="🔋" - +missedCallsNo="$(cat "$CALL_DIR/missed-calls" | wc -l )" time="$(date "+%H:%M")" -notify-send "$(hostname)" "$batteryIcon ${battery}%\nTime $time" +newTexts=0 +for i in "$SMS_DIR"/*/sms.log; do + echo "$i" + count="$(sed -n '/\x0READ\x0/,$ p' "$i" | sed '1d' | + sed -n 's/\x0/-/p' | wc -l)" + echo "$count" + newTexts=$(( newTexts + count )) +done + + + +notification=" +$batteryIcon ${battery}% +Time $time +$( [ "$missedCallsNo" -gt 0 ] && echo "$missedCallsNo Missed Calls" ) +$( [ "$newTexts" -gt 0 ] && echo "$newTexts New Texts" )" + +notification="$( echo "$notification" | sed '/^$/d' )" +notify-send "$(hostname)" "$notification" From eca9af4fcf4bb3ac73b4806572c3841b6539e54f Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Tue, 20 Apr 2021 14:51:02 +0100 Subject: [PATCH 4/7] Fixes missed calls menu Selecting a missed call will now call it correctly if the contact is in the address book --- bin/.bin/dmenu/menu-phone | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/.bin/dmenu/menu-phone b/bin/.bin/dmenu/menu-phone index c784406b..7aef6ef7 100755 --- a/bin/.bin/dmenu/menu-phone +++ b/bin/.bin/dmenu/menu-phone @@ -6,13 +6,13 @@ source "$DIR/../modem/common" viewMissedCalls(){ local choice="$( ( #cat "$CALL_DIR/missed-calls" | awk -F '\t' '{"date +%Y-%m-%d %H:%M:%S -d @" $1 |& getline $1; print $2 "" $1 ""}' - cat "$CALL_DIR/missed-calls" | awk -F '\t' '{"date -d @" $1 " \"+%Y-%m-%d %H:%M:%S\"" |& getline $1; print $2 " " $1 ""}' + cat "$CALL_DIR/missed-calls" | awk -F '\t' '{"date -d @" $1 " \"+%Y-%m-%d %H:%M:%S\"" |& getline $1; print $2 " " $1 ""$3""}' echo "Clear" )| trofi -markup-rows )" case "$choice" in "Clear") rm "$CALL_DIR/missed-calls" ;; *) - local number="$(echo "$choice" | cut -d ' ' -f 3)" + local number="$(echo "$choice" | cut -d '>' -f 4 | cut -d '<' -f 1)" makeCall "$number" ;; esac From 631837681a38c450b7b5ec466ce2997c5e627e3f Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Tue, 20 Apr 2021 14:52:27 +0100 Subject: [PATCH 5/7] Make call will now default to +44 if the number starts with a 0 --- bin/.bin/modem/makeCall | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/.bin/modem/makeCall b/bin/.bin/modem/makeCall index 14971da1..1c4462d1 100755 --- a/bin/.bin/modem/makeCall +++ b/bin/.bin/modem/makeCall @@ -27,7 +27,9 @@ while [[ $1 = -?* ]]; do shift done -number="$1" +number="$(echo "$1" | sed 's/^0/+44/')" + + [ -z "$number" ] && die "No Number Specified" From 056611b01400041e8c65164ffb5e61593ad1db94 Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Tue, 20 Apr 2021 14:52:54 +0100 Subject: [PATCH 6/7] SMS messages should now print properly to files with wierd chars --- bin/.bin/modem/checkSMS | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/.bin/modem/checkSMS b/bin/.bin/modem/checkSMS index 4412807e..7ca7d5dc 100755 --- a/bin/.bin/modem/checkSMS +++ b/bin/.bin/modem/checkSMS @@ -65,11 +65,11 @@ echo "$ids" | while read -r id; do # Store the message in the log file echo "RECIEVED" - echo "SENDER: $number" >> $log - echo "TIME: $(date -d "$time")" >> $log - echo "----" >> $log - echo -e "$text" >> $log - printf '\00\n' >> $log + echo "SENDER: $number" >> "$log" + echo "TIME: $(date -d "$time")" >> "$log" + echo "----" >> "$log" + echo -e "$text" >> "$log" + printf '\00\n' >> "$log" mmcli -m "$modem" --messaging-delete-sms="$id" done From 88e3fb3121ef4903a9c673fb0c65c5e3eb3cf9ab Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Tue, 20 Apr 2021 14:54:11 +0100 Subject: [PATCH 7/7] Adds ip addresses to phone status notification --- bin/.bin/notifications/phoneStatus | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/.bin/notifications/phoneStatus b/bin/.bin/notifications/phoneStatus index 97037fed..a698f5b4 100755 --- a/bin/.bin/notifications/phoneStatus +++ b/bin/.bin/notifications/phoneStatus @@ -23,8 +23,10 @@ done notification=" $batteryIcon ${battery}% Time $time +$( ip r | grep -v "default" | awk '{print $3 ": " $9}') $( [ "$missedCallsNo" -gt 0 ] && echo "$missedCallsNo Missed Calls" ) -$( [ "$newTexts" -gt 0 ] && echo "$newTexts New Texts" )" +$( [ "$newTexts" -gt 0 ] && echo "$newTexts New Texts" ) +" notification="$( echo "$notification" | sed '/^$/d' )" notify-send "$(hostname)" "$notification"