* Re: pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
@ 2021-01-29 3:10 ` ericonr
2021-01-29 4:08 ` jjsullivan5196
` (28 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: ericonr @ 2021-01-29 3:10 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 169 bytes --]
New comment by ericonr on void-packages repository
https://github.com/void-linux/void-packages/pull/25084#issuecomment-769544199
Comment:
What else is necessary here?
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
2021-01-29 3:10 ` ericonr
@ 2021-01-29 4:08 ` jjsullivan5196
2021-02-05 10:17 ` [PR PATCH] [Updated] " jjsullivan5196
` (27 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2021-01-29 4:08 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 486 bytes --]
New comment by jjsullivan5196 on void-packages repository
https://github.com/void-linux/void-packages/pull/25084#issuecomment-769561469
Comment:
@ericonr This will probably be blocked until me or someone else updates the pinephone kernel, since some changes have been made to the codec driver and its controls. After that I think all that's needed is to source some new ucm configurations. I don't want to say I'll get it done soon, but I don't think this should take much more work.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR PATCH] [Updated] pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
2021-01-29 3:10 ` ericonr
2021-01-29 4:08 ` jjsullivan5196
@ 2021-02-05 10:17 ` jjsullivan5196
2021-02-05 10:19 ` jjsullivan5196
` (26 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2021-02-05 10:17 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 3560 bytes --]
There is an updated pull request by jjsullivan5196 against master on the void-packages repository
https://github.com/jjsullivan5196/void-packages pinephone-qol
https://github.com/void-linux/void-packages/pull/25084
pinephone: add support for modem setup and audio routing.
This pull adds the necessary components for 4G modem usage, with the following use-cases in mind:
- Configure audio setup to and from modem
- Make and receive calls
- Send and read SMS
- Use mobile broadband/cellular data
- Wake-on-Modem (for calls and texts)
For now I've tested this with ModemManager+NetworkManager, but this also provides the groundwork for environments that use `ofono` (or just plain AT commands with `atinout` or `screen`, if you feel clever :^) )
To get started, you first need to run `pinephone-modem-setup` once as root to do the initial modem configuration. (chances are postmarketOS already did this if you booted the phone once, but this might need to be done again incase of potential data loss)
Some use-cases might require further configuration of software (eg specific to NetworkManager) but the setup script should do most of the needed work. Make sure modem is powered up by running `echo 1 > /sys/class/modem-power/modem-power/device/powered_blocking` Some examples of usage that I've tested below:
Read sms with `mmcli`
```sh
$ mmcli -s '/org/freedesktop/ModemManager1/SMS/2'
-----------------------------------
Content | number: '+5555555555'
| text: 'Test'
-----------------------------------
Properties | PDU type: 'deliver'
| state: 'received'
| storage: 'me'
| smsc: '+919810051829'
| timestamp: '160808142935+05'
```
Sample script for answering calls, using ModemManager dbus interface. Audio is setup thru `alsaucm`
```sh
#!/bin/bash
MM_IFACE="org.freedesktop.ModemManager1"
MATCH_CALLS="type='signal',sender='${MM_IFACE}',interface='${MM_IFACE}.Modem.Voice',member='CallAdded'"
do_accept() {
while read TYPE TIME SENDER HEADER
do
if [[ "$HEADER" = *"Modem.Voice"* ]]; then
read TYPE _P OBJ
OBJ=$(echo "${OBJ}" | tr -d '"')
echo "Pickup ${OBJ}"
alsaucm \
open PinePhone \
set _verb 'Voice Call' \
set _enadev 'Mic' \
set _enadev 'Earpiece'
dbus-send \
--system \
--dest="${MM_IFACE}" \
--print-reply \
"${OBJ}" \
"${MM_IFACE}.Call.Accept"
else
read
fi
done
}
dbus-monitor --system "${MATCH_CALLS}" | do_accept
```
Add a NetworkManager connection for LTE (sub `<operator_apn>` for your carrier's data APN)
```sh
$ nmcli c add type gsm ifname '*' con-name LTE apn <operator_apn>
```
For Wake-on-Modem: I tested by doing `loginctl suspend` from a sway session, then calling the phone. It wakes up within 2 rings.
fwiw: these examples are only good for making sure the hardware/software interface works. More work still needs to be done to get some telephony front-end software in the repo, like #24538 Sxmo also should work out-of-the box with the NetworkManager+ModemManager pair https://git.sr.ht/~mil/sxmo-docs
For any concerns about the `COPYING` file, the [original author approves](https://matrix.to/#/!ToPtLQdvveNEbXcHqE:fam-ribbers.com/$YEfAo9NI3WPApA1QbhmQrhwizjmlYXnLkMjby4PU7z4?via=matrix.org&via=feneas.org&via=kde.org).
A patch file from https://github.com/void-linux/void-packages/pull/25084.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-pinephone-qol-25084.patch --]
[-- Type: text/x-diff, Size: 13918 bytes --]
From 0d22968acd2e0321afd768099bdc03064ec2a517 Mon Sep 17 00:00:00 2001
From: John Sullivan <jsullivan@csumb.edu>
Date: Fri, 25 Sep 2020 00:44:17 -0700
Subject: [PATCH 1/2] New package: atinout-0.9.1
---
srcpkgs/atinout/template | 14 ++++++++++++++
1 file changed, 14 insertions(+)
create mode 100644 srcpkgs/atinout/template
diff --git a/srcpkgs/atinout/template b/srcpkgs/atinout/template
new file mode 100644
index 00000000000..e292bf9c9c7
--- /dev/null
+++ b/srcpkgs/atinout/template
@@ -0,0 +1,14 @@
+# Template file for 'atinout'
+pkgname=atinout
+version=0.9.1
+revision=1
+build_style=gnu-makefile
+short_desc="Send AT commands to modem and print responses"
+maintainer="John Sullivan <jsullivan@csumb.edu>"
+license="GPL-3.0-or-later"
+homepage="http://atinout.sourceforge.net"
+distfiles="${SOURCEFORGE_SITE}/project/${pkgname}/v${version}/${pkgname}-${version}.tar.gz"
+checksum=4d15c8288aca414e11cd304686b172696104c5e42bf776300311c005634854a2
+
+# Disable -Werror (GCC9+ turns switch fallthrough into error)
+CFLAGS="-W -Wall -Wextra -DVERSION=\\\"${version}\\\" -g"
From 528b2f099d199a148f65b5f93808418c775dd5d7 Mon Sep 17 00:00:00 2001
From: John Sullivan <jsullivan@csumb.edu>
Date: Fri, 25 Sep 2020 01:48:43 -0700
Subject: [PATCH 2/2] pinephone-base: add support for modem setup and audio
routing.
---
.../files/00-alsa-pinephone-dshare.conf | 14 ++
srcpkgs/pinephone-base/files/COPYING | 15 ++
.../files/pinephone-modem-setup | 26 ++++
srcpkgs/pinephone-base/files/ucm/HiFi.conf | 140 +++++++++++++++++
.../pinephone-base/files/ucm/PinePhone.conf | 11 ++
.../pinephone-base/files/ucm/VoiceCall.conf | 145 ++++++++++++++++++
srcpkgs/pinephone-base/template | 13 +-
7 files changed, 361 insertions(+), 3 deletions(-)
create mode 100644 srcpkgs/pinephone-base/files/00-alsa-pinephone-dshare.conf
create mode 100644 srcpkgs/pinephone-base/files/COPYING
create mode 100755 srcpkgs/pinephone-base/files/pinephone-modem-setup
create mode 100644 srcpkgs/pinephone-base/files/ucm/HiFi.conf
create mode 100644 srcpkgs/pinephone-base/files/ucm/PinePhone.conf
create mode 100644 srcpkgs/pinephone-base/files/ucm/VoiceCall.conf
diff --git a/srcpkgs/pinephone-base/files/00-alsa-pinephone-dshare.conf b/srcpkgs/pinephone-base/files/00-alsa-pinephone-dshare.conf
new file mode 100644
index 00000000000..0bb107be419
--- /dev/null
+++ b/srcpkgs/pinephone-base/files/00-alsa-pinephone-dshare.conf
@@ -0,0 +1,14 @@
+pcm_slave.sl2 {
+ pcm "hw:0,0"
+ rate 88200
+}
+
+pcm.!default {
+ type plug
+ slave.pcm {
+ type dshare
+ ipc_key 1023984
+ slave sl2
+ bindings [ 0 1 ]
+ }
+}
diff --git a/srcpkgs/pinephone-base/files/COPYING b/srcpkgs/pinephone-base/files/COPYING
new file mode 100644
index 00000000000..1bf3fc55f9b
--- /dev/null
+++ b/srcpkgs/pinephone-base/files/COPYING
@@ -0,0 +1,15 @@
+The following list of files are copyright of postmarketOS, and are used with
+some modifications under the terms of the MIT license
+https://opensource.org/licenses/MIT
+
+90-modem-eg25.rules
+pinephone-modem-setup
+00-alsa-pinephone-dshare.conf
+ucm/PinePhone.conf
+ucm/HiFi.conf
+ucm/VoiceCall.conf
+
+---
+
+see for sources:
+https://gitlab.com/postmarketOS/pmaports/-/tree/master/device/main/device-pine64-pinephone
\ No newline at end of file
diff --git a/srcpkgs/pinephone-base/files/pinephone-modem-setup b/srcpkgs/pinephone-base/files/pinephone-modem-setup
new file mode 100755
index 00000000000..a734cb17069
--- /dev/null
+++ b/srcpkgs/pinephone-base/files/pinephone-modem-setup
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+DEV=${DEV:-$1}
+
+log() {
+ echo "$@" | logger -t "void:modem-setup"
+}
+
+QMBNCFG_CONFIG="1"
+
+# Read current config
+QMBNCFG_ACTUAL_CONFIG=$(echo 'AT+QMBNCFG="AutoSel"' | atinout - $DEV -)
+
+if echo $QMBNCFG_ACTUAL_CONFIG | grep -q $QMBNCFG_CONFIG
+then
+ log "Modem already configured"
+ exit 0
+fi
+
+# Configure VoLTE auto selecting profile
+RET=$(echo "AT+QMBNCFG=\"AutoSel\",$QMBNCFG_CONFIG" | atinout - $DEV -)
+if ! echo $RET | grep -q OK
+then
+ log "Failed to enable VoLTE profile auto selecting: $RET"
+ exit 1
+fi
diff --git a/srcpkgs/pinephone-base/files/ucm/HiFi.conf b/srcpkgs/pinephone-base/files/ucm/HiFi.conf
new file mode 100644
index 00000000000..e50942ce284
--- /dev/null
+++ b/srcpkgs/pinephone-base/files/ucm/HiFi.conf
@@ -0,0 +1,140 @@
+SectionVerb {
+ EnableSequence [
+ cset "name='Headphone Playback Switch' off"
+ cset "name='Headphone Source Playback Route' DAC"
+ cset "name='Line In Playback Switch' off"
+ cset "name='Line Out Playback Switch' off"
+ cset "name='Line Out Source Playback Route' Mono Differential"
+ cset "name='Mic1 Playback Switch' off"
+ cset "name='Mic2 Playback Switch' off"
+ cset "name='AIF1 DA0 Playback Volume' 160"
+ cset "name='AIF3 ADC Source Capture Route' None"
+ cset "name='AIF2 DAC Source Playback Route' None"
+ cset "name='DAC Playback Switch' on"
+ cset "name='DAC Playback Volume' 160"
+ cset "name='ADC Digital DAC Playback Switch' off"
+ cset "name='AIF1 Slot 0 Digital DAC Playback Switch' on"
+ cset "name='AIF2 Digital DAC Playback Switch' off"
+ cset "name='DAC Reversed Playback Switch' off"
+ cset "name='Earpiece Playback Switch' off"
+ cset "name='Earpiece Source Playback Route' DACL"
+
+ cset "name='Line In Capture Switch' off"
+ cset "name='Mic1 Capture Switch' off"
+ cset "name='Mic1 Boost Volume' 7"
+ cset "name='Mic2 Capture Switch' off"
+ cset "name='Mic2 Boost Volume' 7"
+ cset "name='Mixer Capture Switch' off"
+ cset "name='Mixer Reversed Capture Switch' off"
+ cset "name='ADC Capture Volume' 160"
+ cset "name='ADC Gain Capture Volume' 7"
+ cset "name='AIF1 AD0 Capture Volume' 160"
+ cset "name='AIF1 Data Digital ADC Capture Switch' on"
+ cset "name='AIF2 ADC Mixer ADC Capture Switch' off"
+ cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off"
+ cset "name='AIF2 ADC Mixer AIF2 DAC Rev Capture Switch' off"
+ cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off"
+ cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off"
+ ]
+
+ DisableSequence [
+ ]
+
+ Value {
+ }
+}
+
+SectionDevice."Speaker" {
+ Comment "Internal speaker"
+ EnableSequence [
+ cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono"
+ cset "name='Line Out Playback Switch' on"
+ cset "name='Line Out Playback Volume' 100%"
+ ]
+
+ DisableSequence [
+ cset "name='Line Out Playback Switch' off"
+ ]
+
+ Value {
+ PlaybackVolume "Line Out Playback Volume"
+ PlaybackSwitch "Line Out Playback Switch"
+ PlaybackChannels 2
+ PlaybackPriority 300
+ PlaybackPCM "hw:${CardId},0"
+ }
+}
+SectionDevice."Earpiece" {
+ Comment "Internal Earpiece"
+ EnableSequence [
+ cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono"
+ cset "name='Earpiece Playback Switch' on"
+ cset "name='Earpiece Playback Volume' 100%"
+ ]
+
+ DisableSequence [
+ cset "name='Earpiece Playback Switch' off"
+ ]
+
+ Value {
+ PlaybackVolume "Earpiece Playback Volume"
+ PlaybackSwitch "Earpiece Playback Switch"
+ PlaybackChannels 2
+ PlaybackPriority 200
+ PlaybackPCM "hw:${CardId},0"
+ }
+}
+SectionDevice."Mic" {
+ Comment "Internal Microphone"
+ ConflictingDevice [
+ "Headset"
+ ]
+ EnableSequence [
+ cset "name='Mic1 Capture Switch' on"
+ ]
+ DisableSequence [
+ cset "name='Mic1 Capture Switch' off"
+ ]
+ Value {
+ CapturePriority 500
+ CapturePCM "hw:${CardId},0"
+ CaptureChannels 2
+ }
+}
+SectionDevice."Headset" {
+ Comment "Headset Microphone"
+ ConflictingDevice [
+ "Mic"
+ ]
+ EnableSequence [
+ cset "name='Mic2 Capture Switch' on"
+ ]
+ DisableSequence [
+ cset "name='Mic2 Capture Switch' off"
+ ]
+ Value {
+ CapturePriority 100
+ CapturePCM "hw:${CardId},0"
+ CaptureChannels 2
+ }
+}
+SectionDevice."Headphones" {
+ Comment "Headset"
+ EnableSequence [
+ cset "name='AIF1 DA0 Stereo Playback Route' Stereo"
+ cset "name='Headphone Playback Switch' on"
+ cset "name='Headphone Playback Volume' 40%"
+ ]
+
+ DisableSequence [
+ cset "name='Headphone Playback Switch' off"
+ ]
+
+ Value {
+ PlaybackVolume "Headphone Playback Volume"
+ PlaybackSwitch "Headphone Playback Switch"
+ PlaybackChannels 2
+ PlaybackPriority 100
+ PlaybackPCM "hw:${CardId},0"
+ }
+}
diff --git a/srcpkgs/pinephone-base/files/ucm/PinePhone.conf b/srcpkgs/pinephone-base/files/ucm/PinePhone.conf
new file mode 100644
index 00000000000..9a8ea12b28a
--- /dev/null
+++ b/srcpkgs/pinephone-base/files/ucm/PinePhone.conf
@@ -0,0 +1,11 @@
+Syntax 2
+
+SectionUseCase."HiFi" {
+ File "HiFi.conf"
+ Comment "Play HiFi quality music"
+}
+
+SectionUseCase."Voice Call" {
+ File "VoiceCall.conf"
+ Comment "Make a phone call"
+}
diff --git a/srcpkgs/pinephone-base/files/ucm/VoiceCall.conf b/srcpkgs/pinephone-base/files/ucm/VoiceCall.conf
new file mode 100644
index 00000000000..dedbcaaabfd
--- /dev/null
+++ b/srcpkgs/pinephone-base/files/ucm/VoiceCall.conf
@@ -0,0 +1,145 @@
+SectionVerb {
+ EnableSequence [
+ cset "name='Headphone Playback Switch' off"
+ cset "name='Headphone Source Playback Route' DAC"
+ cset "name='Line In Playback Switch' off"
+ cset "name='Line Out Playback Switch' off"
+ cset "name='Line Out Source Playback Route' Mono Differential"
+ cset "name='Mic1 Playback Switch' off"
+ cset "name='Mic2 Playback Switch' off"
+ cset "name='AIF1 DA0 Playback Volume' 160"
+ cset "name='AIF2 DAC Playback Volume' 160"
+ cset "name='AIF3 ADC Source Capture Route' None"
+ cset "name='AIF2 DAC Source Playback Route' None"
+ cset "name='DAC Playback Switch' on"
+ cset "name='DAC Playback Volume' 160"
+ cset "name='ADC Digital DAC Playback Switch' off"
+ cset "name='AIF1 Slot 0 Digital DAC Playback Switch' on"
+ cset "name='AIF2 Digital DAC Playback Switch' on"
+ cset "name='DAC Reversed Playback Switch' off"
+ cset "name='Earpiece Playback Switch' off"
+ cset "name='Earpiece Source Playback Route' DACL"
+
+ cset "name='Line In Capture Switch' off"
+ cset "name='Mic1 Capture Switch' off"
+ cset "name='Mic1 Boost Volume' 0"
+ cset "name='Mic1 Playback Volume' 7"
+ cset "name='Mic2 Capture Switch' off"
+ cset "name='Mic2 Boost Volume' 0"
+ cset "name='Mic2 Playback Volume' 7"
+ cset "name='Mixer Capture Switch' off"
+ cset "name='Mixer Reversed Capture Switch' off"
+ cset "name='ADC Capture Volume' 160"
+ cset "name='ADC Gain Capture Volume' 7"
+ cset "name='AIF1 AD0 Capture Volume' 160"
+ cset "name='AIF1 Data Digital ADC Capture Switch' on"
+ cset "name='AIF2 ADC Capture Volume' 160"
+ cset "name='AIF2 ADC Mixer ADC Capture Switch' on"
+ cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off"
+ cset "name='AIF2 ADC Mixer AIF2 DAC Rev Capture Switch' off"
+ cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off"
+ cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off"
+ ]
+
+ DisableSequence [
+ ]
+
+ Value {
+ PlaybackRate 8000
+ }
+}
+
+SectionDevice."Speaker" {
+ Comment "Internal speaker"
+ EnableSequence [
+ cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono"
+ cset "name='Line Out Playback Switch' on"
+ cset "name='Line Out Playback Volume' 100%"
+ ]
+
+ DisableSequence [
+ cset "name='Line Out Playback Switch' off"
+ ]
+
+ Value {
+ PlaybackVolume "Line Out Playback Volume"
+ PlaybackSwitch "Line Out Playback Switch"
+ PlaybackChannels 2
+ PlaybackPriority 300
+ PlaybackPCM "hw:${CardId},0"
+ }
+}
+SectionDevice."Earpiece" {
+ Comment "Internal Earpiece"
+ EnableSequence [
+ cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono"
+ cset "name='Earpiece Playback Switch' on"
+ cset "name='Earpiece Playback Volume' 100%"
+ ]
+
+ DisableSequence [
+ cset "name='Earpiece Playback Switch' off"
+ ]
+
+ Value {
+ PlaybackVolume "Earpiece Playback Volume"
+ PlaybackSwitch "Earpiece Playback Switch"
+ PlaybackChannels 2
+ PlaybackPriority 500
+ PlaybackPCM "hw:${CardId},0"
+ }
+}
+SectionDevice."Mic" {
+ Comment "Internal Microphone"
+ ConflictingDevice [
+ "Headset"
+ ]
+ EnableSequence [
+ cset "name='Mic1 Capture Switch' on"
+ ]
+ DisableSequence [
+ cset "name='Mic1 Capture Switch' off"
+ ]
+ Value {
+ CapturePriority 200
+ CapturePCM "hw:${CardId},0"
+ CaptureChannels 2
+ }
+}
+SectionDevice."Headset" {
+ Comment "Headset Microphone"
+ ConflictingDevice [
+ "Mic"
+ ]
+ EnableSequence [
+ cset "name='Mic2 Capture Switch' on"
+ ]
+ DisableSequence [
+ cset "name='Mic2 Capture Switch' off"
+ ]
+ Value {
+ CapturePriority 100
+ CapturePCM "hw:${CardId},0"
+ CaptureChannels 2
+ }
+}
+SectionDevice."Headphones" {
+ Comment "Headset"
+ EnableSequence [
+ cset "name='AIF1 DA0 Stereo Playback Route' Stereo"
+ cset "name='Headphone Playback Switch' on"
+ cset "name='Headphone Playback Volume' 40%"
+ ]
+
+ DisableSequence [
+ cset "name='Headphone Playback Switch' off"
+ ]
+
+ Value {
+ PlaybackVolume "Headphone Playback Volume"
+ PlaybackSwitch "Headphone Playback Switch"
+ PlaybackChannels 2
+ PlaybackPriority 100
+ PlaybackPCM "hw:${CardId},0"
+ }
+}
diff --git a/srcpkgs/pinephone-base/template b/srcpkgs/pinephone-base/template
index 6c750a92bd5..3b7bdae1498 100644
--- a/srcpkgs/pinephone-base/template
+++ b/srcpkgs/pinephone-base/template
@@ -1,15 +1,22 @@
# Template file for 'pinephone-base'
pkgname=pinephone-base
-version=0.1
+version=0.2
revision=1
archs="aarch64*"
build_style=meta
-depends="pinephone-kernel pinephone-uboot"
+depends="pinephone-kernel pinephone-uboot alsa-ucm-conf"
short_desc="Void Linux PinePhone platform package"
maintainer="John Sullivan <jsullivan@csumb.edu>"
-license="Public Domain"
+license="MIT"
homepage="https://www.voidlinux.org"
do_install() {
vinstall "${FILESDIR}/90-modem-eg25.rules" 644 usr/lib/udev/rules.d
+ vinstall "${FILESDIR}/00-alsa-pinephone-dshare.conf" 644 etc/alsa/conf.d
+ vbin "${FILESDIR}/pinephone-modem-setup"
+
+ vmkdir usr/share/alsa/ucm2
+ vcopy "${FILESDIR}/ucm" usr/share/alsa/ucm2/PinePhone
+
+ vlicense "${FILESDIR}/COPYING"
}
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR PATCH] [Updated] pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
` (2 preceding siblings ...)
2021-02-05 10:17 ` [PR PATCH] [Updated] " jjsullivan5196
@ 2021-02-05 10:19 ` jjsullivan5196
2021-02-05 10:20 ` jjsullivan5196
` (25 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2021-02-05 10:19 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 3560 bytes --]
There is an updated pull request by jjsullivan5196 against master on the void-packages repository
https://github.com/jjsullivan5196/void-packages pinephone-qol
https://github.com/void-linux/void-packages/pull/25084
pinephone: add support for modem setup and audio routing.
This pull adds the necessary components for 4G modem usage, with the following use-cases in mind:
- Configure audio setup to and from modem
- Make and receive calls
- Send and read SMS
- Use mobile broadband/cellular data
- Wake-on-Modem (for calls and texts)
For now I've tested this with ModemManager+NetworkManager, but this also provides the groundwork for environments that use `ofono` (or just plain AT commands with `atinout` or `screen`, if you feel clever :^) )
To get started, you first need to run `pinephone-modem-setup` once as root to do the initial modem configuration. (chances are postmarketOS already did this if you booted the phone once, but this might need to be done again incase of potential data loss)
Some use-cases might require further configuration of software (eg specific to NetworkManager) but the setup script should do most of the needed work. Make sure modem is powered up by running `echo 1 > /sys/class/modem-power/modem-power/device/powered_blocking` Some examples of usage that I've tested below:
Read sms with `mmcli`
```sh
$ mmcli -s '/org/freedesktop/ModemManager1/SMS/2'
-----------------------------------
Content | number: '+5555555555'
| text: 'Test'
-----------------------------------
Properties | PDU type: 'deliver'
| state: 'received'
| storage: 'me'
| smsc: '+919810051829'
| timestamp: '160808142935+05'
```
Sample script for answering calls, using ModemManager dbus interface. Audio is setup thru `alsaucm`
```sh
#!/bin/bash
MM_IFACE="org.freedesktop.ModemManager1"
MATCH_CALLS="type='signal',sender='${MM_IFACE}',interface='${MM_IFACE}.Modem.Voice',member='CallAdded'"
do_accept() {
while read TYPE TIME SENDER HEADER
do
if [[ "$HEADER" = *"Modem.Voice"* ]]; then
read TYPE _P OBJ
OBJ=$(echo "${OBJ}" | tr -d '"')
echo "Pickup ${OBJ}"
alsaucm \
open PinePhone \
set _verb 'Voice Call' \
set _enadev 'Mic' \
set _enadev 'Earpiece'
dbus-send \
--system \
--dest="${MM_IFACE}" \
--print-reply \
"${OBJ}" \
"${MM_IFACE}.Call.Accept"
else
read
fi
done
}
dbus-monitor --system "${MATCH_CALLS}" | do_accept
```
Add a NetworkManager connection for LTE (sub `<operator_apn>` for your carrier's data APN)
```sh
$ nmcli c add type gsm ifname '*' con-name LTE apn <operator_apn>
```
For Wake-on-Modem: I tested by doing `loginctl suspend` from a sway session, then calling the phone. It wakes up within 2 rings.
fwiw: these examples are only good for making sure the hardware/software interface works. More work still needs to be done to get some telephony front-end software in the repo, like #24538 Sxmo also should work out-of-the box with the NetworkManager+ModemManager pair https://git.sr.ht/~mil/sxmo-docs
For any concerns about the `COPYING` file, the [original author approves](https://matrix.to/#/!ToPtLQdvveNEbXcHqE:fam-ribbers.com/$YEfAo9NI3WPApA1QbhmQrhwizjmlYXnLkMjby4PU7z4?via=matrix.org&via=feneas.org&via=kde.org).
A patch file from https://github.com/void-linux/void-packages/pull/25084.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-pinephone-qol-25084.patch --]
[-- Type: text/x-diff, Size: 13917 bytes --]
From 0d22968acd2e0321afd768099bdc03064ec2a517 Mon Sep 17 00:00:00 2001
From: John Sullivan <jsullivan@csumb.edu>
Date: Fri, 25 Sep 2020 00:44:17 -0700
Subject: [PATCH 1/2] New package: atinout-0.9.1
---
srcpkgs/atinout/template | 14 ++++++++++++++
1 file changed, 14 insertions(+)
create mode 100644 srcpkgs/atinout/template
diff --git a/srcpkgs/atinout/template b/srcpkgs/atinout/template
new file mode 100644
index 00000000000..e292bf9c9c7
--- /dev/null
+++ b/srcpkgs/atinout/template
@@ -0,0 +1,14 @@
+# Template file for 'atinout'
+pkgname=atinout
+version=0.9.1
+revision=1
+build_style=gnu-makefile
+short_desc="Send AT commands to modem and print responses"
+maintainer="John Sullivan <jsullivan@csumb.edu>"
+license="GPL-3.0-or-later"
+homepage="http://atinout.sourceforge.net"
+distfiles="${SOURCEFORGE_SITE}/project/${pkgname}/v${version}/${pkgname}-${version}.tar.gz"
+checksum=4d15c8288aca414e11cd304686b172696104c5e42bf776300311c005634854a2
+
+# Disable -Werror (GCC9+ turns switch fallthrough into error)
+CFLAGS="-W -Wall -Wextra -DVERSION=\\\"${version}\\\" -g"
From 5dc421d2a65557236ae4c3d2c6f337ee83c2bea0 Mon Sep 17 00:00:00 2001
From: John Sullivan <jsullivan@csumb.edu>
Date: Fri, 25 Sep 2020 01:48:43 -0700
Subject: [PATCH 2/2] pinephone-base: add support for modem setup and audio
routing.
---
.../files/00-alsa-pinephone-dshare.conf | 14 ++
srcpkgs/pinephone-base/files/COPYING | 15 ++
.../files/pinephone-modem-setup | 26 ++++
srcpkgs/pinephone-base/files/ucm/HiFi.conf | 140 +++++++++++++++++
.../pinephone-base/files/ucm/PinePhone.conf | 11 ++
.../pinephone-base/files/ucm/VoiceCall.conf | 145 ++++++++++++++++++
srcpkgs/pinephone-base/template | 13 +-
7 files changed, 361 insertions(+), 3 deletions(-)
create mode 100644 srcpkgs/pinephone-base/files/00-alsa-pinephone-dshare.conf
create mode 100644 srcpkgs/pinephone-base/files/COPYING
create mode 100755 srcpkgs/pinephone-base/files/pinephone-modem-setup
create mode 100644 srcpkgs/pinephone-base/files/ucm/HiFi.conf
create mode 100644 srcpkgs/pinephone-base/files/ucm/PinePhone.conf
create mode 100644 srcpkgs/pinephone-base/files/ucm/VoiceCall.conf
diff --git a/srcpkgs/pinephone-base/files/00-alsa-pinephone-dshare.conf b/srcpkgs/pinephone-base/files/00-alsa-pinephone-dshare.conf
new file mode 100644
index 00000000000..0bb107be419
--- /dev/null
+++ b/srcpkgs/pinephone-base/files/00-alsa-pinephone-dshare.conf
@@ -0,0 +1,14 @@
+pcm_slave.sl2 {
+ pcm "hw:0,0"
+ rate 88200
+}
+
+pcm.!default {
+ type plug
+ slave.pcm {
+ type dshare
+ ipc_key 1023984
+ slave sl2
+ bindings [ 0 1 ]
+ }
+}
diff --git a/srcpkgs/pinephone-base/files/COPYING b/srcpkgs/pinephone-base/files/COPYING
new file mode 100644
index 00000000000..1bf3fc55f9b
--- /dev/null
+++ b/srcpkgs/pinephone-base/files/COPYING
@@ -0,0 +1,15 @@
+The following list of files are copyright of postmarketOS, and are used with
+some modifications under the terms of the MIT license
+https://opensource.org/licenses/MIT
+
+90-modem-eg25.rules
+pinephone-modem-setup
+00-alsa-pinephone-dshare.conf
+ucm/PinePhone.conf
+ucm/HiFi.conf
+ucm/VoiceCall.conf
+
+---
+
+see for sources:
+https://gitlab.com/postmarketOS/pmaports/-/tree/master/device/main/device-pine64-pinephone
\ No newline at end of file
diff --git a/srcpkgs/pinephone-base/files/pinephone-modem-setup b/srcpkgs/pinephone-base/files/pinephone-modem-setup
new file mode 100755
index 00000000000..a734cb17069
--- /dev/null
+++ b/srcpkgs/pinephone-base/files/pinephone-modem-setup
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+DEV=${DEV:-$1}
+
+log() {
+ echo "$@" | logger -t "void:modem-setup"
+}
+
+QMBNCFG_CONFIG="1"
+
+# Read current config
+QMBNCFG_ACTUAL_CONFIG=$(echo 'AT+QMBNCFG="AutoSel"' | atinout - $DEV -)
+
+if echo $QMBNCFG_ACTUAL_CONFIG | grep -q $QMBNCFG_CONFIG
+then
+ log "Modem already configured"
+ exit 0
+fi
+
+# Configure VoLTE auto selecting profile
+RET=$(echo "AT+QMBNCFG=\"AutoSel\",$QMBNCFG_CONFIG" | atinout - $DEV -)
+if ! echo $RET | grep -q OK
+then
+ log "Failed to enable VoLTE profile auto selecting: $RET"
+ exit 1
+fi
diff --git a/srcpkgs/pinephone-base/files/ucm/HiFi.conf b/srcpkgs/pinephone-base/files/ucm/HiFi.conf
new file mode 100644
index 00000000000..e50942ce284
--- /dev/null
+++ b/srcpkgs/pinephone-base/files/ucm/HiFi.conf
@@ -0,0 +1,140 @@
+SectionVerb {
+ EnableSequence [
+ cset "name='Headphone Playback Switch' off"
+ cset "name='Headphone Source Playback Route' DAC"
+ cset "name='Line In Playback Switch' off"
+ cset "name='Line Out Playback Switch' off"
+ cset "name='Line Out Source Playback Route' Mono Differential"
+ cset "name='Mic1 Playback Switch' off"
+ cset "name='Mic2 Playback Switch' off"
+ cset "name='AIF1 DA0 Playback Volume' 160"
+ cset "name='AIF3 ADC Source Capture Route' None"
+ cset "name='AIF2 DAC Source Playback Route' None"
+ cset "name='DAC Playback Switch' on"
+ cset "name='DAC Playback Volume' 160"
+ cset "name='ADC Digital DAC Playback Switch' off"
+ cset "name='AIF1 Slot 0 Digital DAC Playback Switch' on"
+ cset "name='AIF2 Digital DAC Playback Switch' off"
+ cset "name='DAC Reversed Playback Switch' off"
+ cset "name='Earpiece Playback Switch' off"
+ cset "name='Earpiece Source Playback Route' DACL"
+
+ cset "name='Line In Capture Switch' off"
+ cset "name='Mic1 Capture Switch' off"
+ cset "name='Mic1 Boost Volume' 7"
+ cset "name='Mic2 Capture Switch' off"
+ cset "name='Mic2 Boost Volume' 7"
+ cset "name='Mixer Capture Switch' off"
+ cset "name='Mixer Reversed Capture Switch' off"
+ cset "name='ADC Capture Volume' 160"
+ cset "name='ADC Gain Capture Volume' 7"
+ cset "name='AIF1 AD0 Capture Volume' 160"
+ cset "name='AIF1 Data Digital ADC Capture Switch' on"
+ cset "name='AIF2 ADC Mixer ADC Capture Switch' off"
+ cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off"
+ cset "name='AIF2 ADC Mixer AIF2 DAC Rev Capture Switch' off"
+ cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off"
+ cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off"
+ ]
+
+ DisableSequence [
+ ]
+
+ Value {
+ }
+}
+
+SectionDevice."Speaker" {
+ Comment "Internal speaker"
+ EnableSequence [
+ cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono"
+ cset "name='Line Out Playback Switch' on"
+ cset "name='Line Out Playback Volume' 100%"
+ ]
+
+ DisableSequence [
+ cset "name='Line Out Playback Switch' off"
+ ]
+
+ Value {
+ PlaybackVolume "Line Out Playback Volume"
+ PlaybackSwitch "Line Out Playback Switch"
+ PlaybackChannels 2
+ PlaybackPriority 300
+ PlaybackPCM "hw:${CardId},0"
+ }
+}
+SectionDevice."Earpiece" {
+ Comment "Internal Earpiece"
+ EnableSequence [
+ cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono"
+ cset "name='Earpiece Playback Switch' on"
+ cset "name='Earpiece Playback Volume' 100%"
+ ]
+
+ DisableSequence [
+ cset "name='Earpiece Playback Switch' off"
+ ]
+
+ Value {
+ PlaybackVolume "Earpiece Playback Volume"
+ PlaybackSwitch "Earpiece Playback Switch"
+ PlaybackChannels 2
+ PlaybackPriority 200
+ PlaybackPCM "hw:${CardId},0"
+ }
+}
+SectionDevice."Mic" {
+ Comment "Internal Microphone"
+ ConflictingDevice [
+ "Headset"
+ ]
+ EnableSequence [
+ cset "name='Mic1 Capture Switch' on"
+ ]
+ DisableSequence [
+ cset "name='Mic1 Capture Switch' off"
+ ]
+ Value {
+ CapturePriority 500
+ CapturePCM "hw:${CardId},0"
+ CaptureChannels 2
+ }
+}
+SectionDevice."Headset" {
+ Comment "Headset Microphone"
+ ConflictingDevice [
+ "Mic"
+ ]
+ EnableSequence [
+ cset "name='Mic2 Capture Switch' on"
+ ]
+ DisableSequence [
+ cset "name='Mic2 Capture Switch' off"
+ ]
+ Value {
+ CapturePriority 100
+ CapturePCM "hw:${CardId},0"
+ CaptureChannels 2
+ }
+}
+SectionDevice."Headphones" {
+ Comment "Headset"
+ EnableSequence [
+ cset "name='AIF1 DA0 Stereo Playback Route' Stereo"
+ cset "name='Headphone Playback Switch' on"
+ cset "name='Headphone Playback Volume' 40%"
+ ]
+
+ DisableSequence [
+ cset "name='Headphone Playback Switch' off"
+ ]
+
+ Value {
+ PlaybackVolume "Headphone Playback Volume"
+ PlaybackSwitch "Headphone Playback Switch"
+ PlaybackChannels 2
+ PlaybackPriority 100
+ PlaybackPCM "hw:${CardId},0"
+ }
+}
diff --git a/srcpkgs/pinephone-base/files/ucm/PinePhone.conf b/srcpkgs/pinephone-base/files/ucm/PinePhone.conf
new file mode 100644
index 00000000000..9a8ea12b28a
--- /dev/null
+++ b/srcpkgs/pinephone-base/files/ucm/PinePhone.conf
@@ -0,0 +1,11 @@
+Syntax 2
+
+SectionUseCase."HiFi" {
+ File "HiFi.conf"
+ Comment "Play HiFi quality music"
+}
+
+SectionUseCase."Voice Call" {
+ File "VoiceCall.conf"
+ Comment "Make a phone call"
+}
diff --git a/srcpkgs/pinephone-base/files/ucm/VoiceCall.conf b/srcpkgs/pinephone-base/files/ucm/VoiceCall.conf
new file mode 100644
index 00000000000..dedbcaaabfd
--- /dev/null
+++ b/srcpkgs/pinephone-base/files/ucm/VoiceCall.conf
@@ -0,0 +1,145 @@
+SectionVerb {
+ EnableSequence [
+ cset "name='Headphone Playback Switch' off"
+ cset "name='Headphone Source Playback Route' DAC"
+ cset "name='Line In Playback Switch' off"
+ cset "name='Line Out Playback Switch' off"
+ cset "name='Line Out Source Playback Route' Mono Differential"
+ cset "name='Mic1 Playback Switch' off"
+ cset "name='Mic2 Playback Switch' off"
+ cset "name='AIF1 DA0 Playback Volume' 160"
+ cset "name='AIF2 DAC Playback Volume' 160"
+ cset "name='AIF3 ADC Source Capture Route' None"
+ cset "name='AIF2 DAC Source Playback Route' None"
+ cset "name='DAC Playback Switch' on"
+ cset "name='DAC Playback Volume' 160"
+ cset "name='ADC Digital DAC Playback Switch' off"
+ cset "name='AIF1 Slot 0 Digital DAC Playback Switch' on"
+ cset "name='AIF2 Digital DAC Playback Switch' on"
+ cset "name='DAC Reversed Playback Switch' off"
+ cset "name='Earpiece Playback Switch' off"
+ cset "name='Earpiece Source Playback Route' DACL"
+
+ cset "name='Line In Capture Switch' off"
+ cset "name='Mic1 Capture Switch' off"
+ cset "name='Mic1 Boost Volume' 0"
+ cset "name='Mic1 Playback Volume' 7"
+ cset "name='Mic2 Capture Switch' off"
+ cset "name='Mic2 Boost Volume' 0"
+ cset "name='Mic2 Playback Volume' 7"
+ cset "name='Mixer Capture Switch' off"
+ cset "name='Mixer Reversed Capture Switch' off"
+ cset "name='ADC Capture Volume' 160"
+ cset "name='ADC Gain Capture Volume' 7"
+ cset "name='AIF1 AD0 Capture Volume' 160"
+ cset "name='AIF1 Data Digital ADC Capture Switch' on"
+ cset "name='AIF2 ADC Capture Volume' 160"
+ cset "name='AIF2 ADC Mixer ADC Capture Switch' on"
+ cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off"
+ cset "name='AIF2 ADC Mixer AIF2 DAC Rev Capture Switch' off"
+ cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off"
+ cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off"
+ ]
+
+ DisableSequence [
+ ]
+
+ Value {
+ PlaybackRate 8000
+ }
+}
+
+SectionDevice."Speaker" {
+ Comment "Internal speaker"
+ EnableSequence [
+ cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono"
+ cset "name='Line Out Playback Switch' on"
+ cset "name='Line Out Playback Volume' 100%"
+ ]
+
+ DisableSequence [
+ cset "name='Line Out Playback Switch' off"
+ ]
+
+ Value {
+ PlaybackVolume "Line Out Playback Volume"
+ PlaybackSwitch "Line Out Playback Switch"
+ PlaybackChannels 2
+ PlaybackPriority 300
+ PlaybackPCM "hw:${CardId},0"
+ }
+}
+SectionDevice."Earpiece" {
+ Comment "Internal Earpiece"
+ EnableSequence [
+ cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono"
+ cset "name='Earpiece Playback Switch' on"
+ cset "name='Earpiece Playback Volume' 100%"
+ ]
+
+ DisableSequence [
+ cset "name='Earpiece Playback Switch' off"
+ ]
+
+ Value {
+ PlaybackVolume "Earpiece Playback Volume"
+ PlaybackSwitch "Earpiece Playback Switch"
+ PlaybackChannels 2
+ PlaybackPriority 500
+ PlaybackPCM "hw:${CardId},0"
+ }
+}
+SectionDevice."Mic" {
+ Comment "Internal Microphone"
+ ConflictingDevice [
+ "Headset"
+ ]
+ EnableSequence [
+ cset "name='Mic1 Capture Switch' on"
+ ]
+ DisableSequence [
+ cset "name='Mic1 Capture Switch' off"
+ ]
+ Value {
+ CapturePriority 200
+ CapturePCM "hw:${CardId},0"
+ CaptureChannels 2
+ }
+}
+SectionDevice."Headset" {
+ Comment "Headset Microphone"
+ ConflictingDevice [
+ "Mic"
+ ]
+ EnableSequence [
+ cset "name='Mic2 Capture Switch' on"
+ ]
+ DisableSequence [
+ cset "name='Mic2 Capture Switch' off"
+ ]
+ Value {
+ CapturePriority 100
+ CapturePCM "hw:${CardId},0"
+ CaptureChannels 2
+ }
+}
+SectionDevice."Headphones" {
+ Comment "Headset"
+ EnableSequence [
+ cset "name='AIF1 DA0 Stereo Playback Route' Stereo"
+ cset "name='Headphone Playback Switch' on"
+ cset "name='Headphone Playback Volume' 40%"
+ ]
+
+ DisableSequence [
+ cset "name='Headphone Playback Switch' off"
+ ]
+
+ Value {
+ PlaybackVolume "Headphone Playback Volume"
+ PlaybackSwitch "Headphone Playback Switch"
+ PlaybackChannels 2
+ PlaybackPriority 100
+ PlaybackPCM "hw:${CardId},0"
+ }
+}
diff --git a/srcpkgs/pinephone-base/template b/srcpkgs/pinephone-base/template
index 6c750a92bd5..dbe75b6daef 100644
--- a/srcpkgs/pinephone-base/template
+++ b/srcpkgs/pinephone-base/template
@@ -1,15 +1,22 @@
# Template file for 'pinephone-base'
pkgname=pinephone-base
-version=0.1
+version=0.2
revision=1
archs="aarch64*"
build_style=meta
-depends="pinephone-kernel pinephone-uboot"
+depends="pinephone-kernel pinephone-uboot alsa-ucm-conf"
short_desc="Void Linux PinePhone platform package"
maintainer="John Sullivan <jsullivan@csumb.edu>"
-license="Public Domain"
+license="MIT"
homepage="https://www.voidlinux.org"
do_install() {
vinstall "${FILESDIR}/90-modem-eg25.rules" 644 usr/lib/udev/rules.d
+ vinstall "${FILESDIR}/00-alsa-pinephone-dshare.conf" 644 etc/alsa/conf.d
+ vbin "${FILESDIR}/pinephone-modem-setup"
+
+ vmkdir usr/share/alsa/ucm2
+ vcopy "${FILESDIR}/ucm" usr/share/alsa/ucm2/PinePhone
+
+ vlicense "${FILESDIR}/COPYING"
}
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
` (3 preceding siblings ...)
2021-02-05 10:19 ` jjsullivan5196
@ 2021-02-05 10:20 ` jjsullivan5196
2021-02-05 10:22 ` jjsullivan5196
` (24 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2021-02-05 10:20 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 294 bytes --]
New comment by jjsullivan5196 on void-packages repository
https://github.com/void-linux/void-packages/pull/25084#issuecomment-773940775
Comment:
@ericonr I tested this PR again on 5.10.12 and everything is still working. I think this can be merged, if no other quality issues are in the way.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
` (4 preceding siblings ...)
2021-02-05 10:20 ` jjsullivan5196
@ 2021-02-05 10:22 ` jjsullivan5196
2021-02-06 5:00 ` [PR REVIEW] " the-maldridge
` (23 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2021-02-05 10:22 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 301 bytes --]
New comment by jjsullivan5196 on void-packages repository
https://github.com/void-linux/void-packages/pull/25084#issuecomment-773940775
Comment:
@ericonr I tested this PR again on kernel 5.10.12 and everything is still working. I think this can be merged, if no other quality issues are in the way.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR REVIEW] pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
` (5 preceding siblings ...)
2021-02-05 10:22 ` jjsullivan5196
@ 2021-02-06 5:00 ` the-maldridge
2021-02-06 5:13 ` jjsullivan5196
` (22 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: the-maldridge @ 2021-02-06 5:00 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 350 bytes --]
New review comment by the-maldridge on void-packages repository
https://github.com/void-linux/void-packages/pull/25084#discussion_r571359710
Comment:
Hmm why did this change? Usually the base-files metapackage should be public-domain. If there are other files that need to be included under other licenses, you can make another package for them.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR REVIEW] pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
` (6 preceding siblings ...)
2021-02-06 5:00 ` [PR REVIEW] " the-maldridge
@ 2021-02-06 5:13 ` jjsullivan5196
2021-02-06 5:15 ` the-maldridge
` (21 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2021-02-06 5:13 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 285 bytes --]
New review comment by jjsullivan5196 on void-packages repository
https://github.com/void-linux/void-packages/pull/25084#discussion_r571360860
Comment:
Yeah, there's some scripts/configs I borrowed from postmarketos. I'll put them in a separate package then, maybe `pinephone-utils`?
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR REVIEW] pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
` (7 preceding siblings ...)
2021-02-06 5:13 ` jjsullivan5196
@ 2021-02-06 5:15 ` the-maldridge
2021-02-06 5:19 ` ericonr
` (20 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: the-maldridge @ 2021-02-06 5:15 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 187 bytes --]
New review comment by the-maldridge on void-packages repository
https://github.com/void-linux/void-packages/pull/25084#discussion_r571361059
Comment:
Yeah that sounds like a good name.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR REVIEW] pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
` (8 preceding siblings ...)
2021-02-06 5:15 ` the-maldridge
@ 2021-02-06 5:19 ` ericonr
2021-02-06 5:32 ` [PR PATCH] [Updated] " jjsullivan5196
` (19 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: ericonr @ 2021-02-06 5:19 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 277 bytes --]
New review comment by ericonr on void-packages repository
https://github.com/void-linux/void-packages/pull/25084#discussion_r571361501
Comment:
Out of curiosity, could we have pmos as an upstream instead of vendoring the scripts in? (assuming you aren't changing them much).
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR PATCH] [Updated] pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
` (9 preceding siblings ...)
2021-02-06 5:19 ` ericonr
@ 2021-02-06 5:32 ` jjsullivan5196
2021-02-06 5:35 ` [PR REVIEW] " jjsullivan5196
` (18 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2021-02-06 5:32 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 3560 bytes --]
There is an updated pull request by jjsullivan5196 against master on the void-packages repository
https://github.com/jjsullivan5196/void-packages pinephone-qol
https://github.com/void-linux/void-packages/pull/25084
pinephone: add support for modem setup and audio routing.
This pull adds the necessary components for 4G modem usage, with the following use-cases in mind:
- Configure audio setup to and from modem
- Make and receive calls
- Send and read SMS
- Use mobile broadband/cellular data
- Wake-on-Modem (for calls and texts)
For now I've tested this with ModemManager+NetworkManager, but this also provides the groundwork for environments that use `ofono` (or just plain AT commands with `atinout` or `screen`, if you feel clever :^) )
To get started, you first need to run `pinephone-modem-setup` once as root to do the initial modem configuration. (chances are postmarketOS already did this if you booted the phone once, but this might need to be done again incase of potential data loss)
Some use-cases might require further configuration of software (eg specific to NetworkManager) but the setup script should do most of the needed work. Make sure modem is powered up by running `echo 1 > /sys/class/modem-power/modem-power/device/powered_blocking` Some examples of usage that I've tested below:
Read sms with `mmcli`
```sh
$ mmcli -s '/org/freedesktop/ModemManager1/SMS/2'
-----------------------------------
Content | number: '+5555555555'
| text: 'Test'
-----------------------------------
Properties | PDU type: 'deliver'
| state: 'received'
| storage: 'me'
| smsc: '+919810051829'
| timestamp: '160808142935+05'
```
Sample script for answering calls, using ModemManager dbus interface. Audio is setup thru `alsaucm`
```sh
#!/bin/bash
MM_IFACE="org.freedesktop.ModemManager1"
MATCH_CALLS="type='signal',sender='${MM_IFACE}',interface='${MM_IFACE}.Modem.Voice',member='CallAdded'"
do_accept() {
while read TYPE TIME SENDER HEADER
do
if [[ "$HEADER" = *"Modem.Voice"* ]]; then
read TYPE _P OBJ
OBJ=$(echo "${OBJ}" | tr -d '"')
echo "Pickup ${OBJ}"
alsaucm \
open PinePhone \
set _verb 'Voice Call' \
set _enadev 'Mic' \
set _enadev 'Earpiece'
dbus-send \
--system \
--dest="${MM_IFACE}" \
--print-reply \
"${OBJ}" \
"${MM_IFACE}.Call.Accept"
else
read
fi
done
}
dbus-monitor --system "${MATCH_CALLS}" | do_accept
```
Add a NetworkManager connection for LTE (sub `<operator_apn>` for your carrier's data APN)
```sh
$ nmcli c add type gsm ifname '*' con-name LTE apn <operator_apn>
```
For Wake-on-Modem: I tested by doing `loginctl suspend` from a sway session, then calling the phone. It wakes up within 2 rings.
fwiw: these examples are only good for making sure the hardware/software interface works. More work still needs to be done to get some telephony front-end software in the repo, like #24538 Sxmo also should work out-of-the box with the NetworkManager+ModemManager pair https://git.sr.ht/~mil/sxmo-docs
For any concerns about the `COPYING` file, the [original author approves](https://matrix.to/#/!ToPtLQdvveNEbXcHqE:fam-ribbers.com/$YEfAo9NI3WPApA1QbhmQrhwizjmlYXnLkMjby4PU7z4?via=matrix.org&via=feneas.org&via=kde.org).
A patch file from https://github.com/void-linux/void-packages/pull/25084.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-pinephone-qol-25084.patch --]
[-- Type: text/x-diff, Size: 16683 bytes --]
From 0d22968acd2e0321afd768099bdc03064ec2a517 Mon Sep 17 00:00:00 2001
From: John Sullivan <jsullivan@csumb.edu>
Date: Fri, 25 Sep 2020 00:44:17 -0700
Subject: [PATCH 1/3] New package: atinout-0.9.1
---
srcpkgs/atinout/template | 14 ++++++++++++++
1 file changed, 14 insertions(+)
create mode 100644 srcpkgs/atinout/template
diff --git a/srcpkgs/atinout/template b/srcpkgs/atinout/template
new file mode 100644
index 00000000000..e292bf9c9c7
--- /dev/null
+++ b/srcpkgs/atinout/template
@@ -0,0 +1,14 @@
+# Template file for 'atinout'
+pkgname=atinout
+version=0.9.1
+revision=1
+build_style=gnu-makefile
+short_desc="Send AT commands to modem and print responses"
+maintainer="John Sullivan <jsullivan@csumb.edu>"
+license="GPL-3.0-or-later"
+homepage="http://atinout.sourceforge.net"
+distfiles="${SOURCEFORGE_SITE}/project/${pkgname}/v${version}/${pkgname}-${version}.tar.gz"
+checksum=4d15c8288aca414e11cd304686b172696104c5e42bf776300311c005634854a2
+
+# Disable -Werror (GCC9+ turns switch fallthrough into error)
+CFLAGS="-W -Wall -Wextra -DVERSION=\\\"${version}\\\" -g"
From 19191da06664dbc5b56c8cfb41c174764b72b7b0 Mon Sep 17 00:00:00 2001
From: John Sullivan <jsullivan@csumb.edu>
Date: Fri, 5 Feb 2021 21:31:03 -0800
Subject: [PATCH 2/3] New package: pinephone-utils-0.1
---
.../files/00-alsa-pinephone-dshare.conf | 14 ++
.../pinephone-utils/files/90-modem-eg25.rules | 5 +
srcpkgs/pinephone-utils/files/COPYING | 15 ++
.../files/pinephone-modem-setup | 26 ++++
srcpkgs/pinephone-utils/files/ucm/HiFi.conf | 140 +++++++++++++++++
.../pinephone-utils/files/ucm/PinePhone.conf | 11 ++
.../pinephone-utils/files/ucm/VoiceCall.conf | 145 ++++++++++++++++++
srcpkgs/pinephone-utils/template | 21 +++
8 files changed, 377 insertions(+)
create mode 100644 srcpkgs/pinephone-utils/files/00-alsa-pinephone-dshare.conf
create mode 100644 srcpkgs/pinephone-utils/files/90-modem-eg25.rules
create mode 100644 srcpkgs/pinephone-utils/files/COPYING
create mode 100755 srcpkgs/pinephone-utils/files/pinephone-modem-setup
create mode 100644 srcpkgs/pinephone-utils/files/ucm/HiFi.conf
create mode 100644 srcpkgs/pinephone-utils/files/ucm/PinePhone.conf
create mode 100644 srcpkgs/pinephone-utils/files/ucm/VoiceCall.conf
create mode 100644 srcpkgs/pinephone-utils/template
diff --git a/srcpkgs/pinephone-utils/files/00-alsa-pinephone-dshare.conf b/srcpkgs/pinephone-utils/files/00-alsa-pinephone-dshare.conf
new file mode 100644
index 00000000000..0bb107be419
--- /dev/null
+++ b/srcpkgs/pinephone-utils/files/00-alsa-pinephone-dshare.conf
@@ -0,0 +1,14 @@
+pcm_slave.sl2 {
+ pcm "hw:0,0"
+ rate 88200
+}
+
+pcm.!default {
+ type plug
+ slave.pcm {
+ type dshare
+ ipc_key 1023984
+ slave sl2
+ bindings [ 0 1 ]
+ }
+}
diff --git a/srcpkgs/pinephone-utils/files/90-modem-eg25.rules b/srcpkgs/pinephone-utils/files/90-modem-eg25.rules
new file mode 100644
index 00000000000..cd0031422cb
--- /dev/null
+++ b/srcpkgs/pinephone-utils/files/90-modem-eg25.rules
@@ -0,0 +1,5 @@
+SUBSYSTEMS=="usb", ENV{.LOCAL_ifNum}="$attr{bInterfaceNumber}"
+
+SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="01", SYMLINK+="EG25.NMEA", MODE="0660"
+SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="02", SYMLINK+="EG25.AT", MODE="0660"
+SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="03", SYMLINK+="EG25.MODEM", MODE="0660"
diff --git a/srcpkgs/pinephone-utils/files/COPYING b/srcpkgs/pinephone-utils/files/COPYING
new file mode 100644
index 00000000000..1bf3fc55f9b
--- /dev/null
+++ b/srcpkgs/pinephone-utils/files/COPYING
@@ -0,0 +1,15 @@
+The following list of files are copyright of postmarketOS, and are used with
+some modifications under the terms of the MIT license
+https://opensource.org/licenses/MIT
+
+90-modem-eg25.rules
+pinephone-modem-setup
+00-alsa-pinephone-dshare.conf
+ucm/PinePhone.conf
+ucm/HiFi.conf
+ucm/VoiceCall.conf
+
+---
+
+see for sources:
+https://gitlab.com/postmarketOS/pmaports/-/tree/master/device/main/device-pine64-pinephone
\ No newline at end of file
diff --git a/srcpkgs/pinephone-utils/files/pinephone-modem-setup b/srcpkgs/pinephone-utils/files/pinephone-modem-setup
new file mode 100755
index 00000000000..a734cb17069
--- /dev/null
+++ b/srcpkgs/pinephone-utils/files/pinephone-modem-setup
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+DEV=${DEV:-$1}
+
+log() {
+ echo "$@" | logger -t "void:modem-setup"
+}
+
+QMBNCFG_CONFIG="1"
+
+# Read current config
+QMBNCFG_ACTUAL_CONFIG=$(echo 'AT+QMBNCFG="AutoSel"' | atinout - $DEV -)
+
+if echo $QMBNCFG_ACTUAL_CONFIG | grep -q $QMBNCFG_CONFIG
+then
+ log "Modem already configured"
+ exit 0
+fi
+
+# Configure VoLTE auto selecting profile
+RET=$(echo "AT+QMBNCFG=\"AutoSel\",$QMBNCFG_CONFIG" | atinout - $DEV -)
+if ! echo $RET | grep -q OK
+then
+ log "Failed to enable VoLTE profile auto selecting: $RET"
+ exit 1
+fi
diff --git a/srcpkgs/pinephone-utils/files/ucm/HiFi.conf b/srcpkgs/pinephone-utils/files/ucm/HiFi.conf
new file mode 100644
index 00000000000..e50942ce284
--- /dev/null
+++ b/srcpkgs/pinephone-utils/files/ucm/HiFi.conf
@@ -0,0 +1,140 @@
+SectionVerb {
+ EnableSequence [
+ cset "name='Headphone Playback Switch' off"
+ cset "name='Headphone Source Playback Route' DAC"
+ cset "name='Line In Playback Switch' off"
+ cset "name='Line Out Playback Switch' off"
+ cset "name='Line Out Source Playback Route' Mono Differential"
+ cset "name='Mic1 Playback Switch' off"
+ cset "name='Mic2 Playback Switch' off"
+ cset "name='AIF1 DA0 Playback Volume' 160"
+ cset "name='AIF3 ADC Source Capture Route' None"
+ cset "name='AIF2 DAC Source Playback Route' None"
+ cset "name='DAC Playback Switch' on"
+ cset "name='DAC Playback Volume' 160"
+ cset "name='ADC Digital DAC Playback Switch' off"
+ cset "name='AIF1 Slot 0 Digital DAC Playback Switch' on"
+ cset "name='AIF2 Digital DAC Playback Switch' off"
+ cset "name='DAC Reversed Playback Switch' off"
+ cset "name='Earpiece Playback Switch' off"
+ cset "name='Earpiece Source Playback Route' DACL"
+
+ cset "name='Line In Capture Switch' off"
+ cset "name='Mic1 Capture Switch' off"
+ cset "name='Mic1 Boost Volume' 7"
+ cset "name='Mic2 Capture Switch' off"
+ cset "name='Mic2 Boost Volume' 7"
+ cset "name='Mixer Capture Switch' off"
+ cset "name='Mixer Reversed Capture Switch' off"
+ cset "name='ADC Capture Volume' 160"
+ cset "name='ADC Gain Capture Volume' 7"
+ cset "name='AIF1 AD0 Capture Volume' 160"
+ cset "name='AIF1 Data Digital ADC Capture Switch' on"
+ cset "name='AIF2 ADC Mixer ADC Capture Switch' off"
+ cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off"
+ cset "name='AIF2 ADC Mixer AIF2 DAC Rev Capture Switch' off"
+ cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off"
+ cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off"
+ ]
+
+ DisableSequence [
+ ]
+
+ Value {
+ }
+}
+
+SectionDevice."Speaker" {
+ Comment "Internal speaker"
+ EnableSequence [
+ cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono"
+ cset "name='Line Out Playback Switch' on"
+ cset "name='Line Out Playback Volume' 100%"
+ ]
+
+ DisableSequence [
+ cset "name='Line Out Playback Switch' off"
+ ]
+
+ Value {
+ PlaybackVolume "Line Out Playback Volume"
+ PlaybackSwitch "Line Out Playback Switch"
+ PlaybackChannels 2
+ PlaybackPriority 300
+ PlaybackPCM "hw:${CardId},0"
+ }
+}
+SectionDevice."Earpiece" {
+ Comment "Internal Earpiece"
+ EnableSequence [
+ cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono"
+ cset "name='Earpiece Playback Switch' on"
+ cset "name='Earpiece Playback Volume' 100%"
+ ]
+
+ DisableSequence [
+ cset "name='Earpiece Playback Switch' off"
+ ]
+
+ Value {
+ PlaybackVolume "Earpiece Playback Volume"
+ PlaybackSwitch "Earpiece Playback Switch"
+ PlaybackChannels 2
+ PlaybackPriority 200
+ PlaybackPCM "hw:${CardId},0"
+ }
+}
+SectionDevice."Mic" {
+ Comment "Internal Microphone"
+ ConflictingDevice [
+ "Headset"
+ ]
+ EnableSequence [
+ cset "name='Mic1 Capture Switch' on"
+ ]
+ DisableSequence [
+ cset "name='Mic1 Capture Switch' off"
+ ]
+ Value {
+ CapturePriority 500
+ CapturePCM "hw:${CardId},0"
+ CaptureChannels 2
+ }
+}
+SectionDevice."Headset" {
+ Comment "Headset Microphone"
+ ConflictingDevice [
+ "Mic"
+ ]
+ EnableSequence [
+ cset "name='Mic2 Capture Switch' on"
+ ]
+ DisableSequence [
+ cset "name='Mic2 Capture Switch' off"
+ ]
+ Value {
+ CapturePriority 100
+ CapturePCM "hw:${CardId},0"
+ CaptureChannels 2
+ }
+}
+SectionDevice."Headphones" {
+ Comment "Headset"
+ EnableSequence [
+ cset "name='AIF1 DA0 Stereo Playback Route' Stereo"
+ cset "name='Headphone Playback Switch' on"
+ cset "name='Headphone Playback Volume' 40%"
+ ]
+
+ DisableSequence [
+ cset "name='Headphone Playback Switch' off"
+ ]
+
+ Value {
+ PlaybackVolume "Headphone Playback Volume"
+ PlaybackSwitch "Headphone Playback Switch"
+ PlaybackChannels 2
+ PlaybackPriority 100
+ PlaybackPCM "hw:${CardId},0"
+ }
+}
diff --git a/srcpkgs/pinephone-utils/files/ucm/PinePhone.conf b/srcpkgs/pinephone-utils/files/ucm/PinePhone.conf
new file mode 100644
index 00000000000..9a8ea12b28a
--- /dev/null
+++ b/srcpkgs/pinephone-utils/files/ucm/PinePhone.conf
@@ -0,0 +1,11 @@
+Syntax 2
+
+SectionUseCase."HiFi" {
+ File "HiFi.conf"
+ Comment "Play HiFi quality music"
+}
+
+SectionUseCase."Voice Call" {
+ File "VoiceCall.conf"
+ Comment "Make a phone call"
+}
diff --git a/srcpkgs/pinephone-utils/files/ucm/VoiceCall.conf b/srcpkgs/pinephone-utils/files/ucm/VoiceCall.conf
new file mode 100644
index 00000000000..dedbcaaabfd
--- /dev/null
+++ b/srcpkgs/pinephone-utils/files/ucm/VoiceCall.conf
@@ -0,0 +1,145 @@
+SectionVerb {
+ EnableSequence [
+ cset "name='Headphone Playback Switch' off"
+ cset "name='Headphone Source Playback Route' DAC"
+ cset "name='Line In Playback Switch' off"
+ cset "name='Line Out Playback Switch' off"
+ cset "name='Line Out Source Playback Route' Mono Differential"
+ cset "name='Mic1 Playback Switch' off"
+ cset "name='Mic2 Playback Switch' off"
+ cset "name='AIF1 DA0 Playback Volume' 160"
+ cset "name='AIF2 DAC Playback Volume' 160"
+ cset "name='AIF3 ADC Source Capture Route' None"
+ cset "name='AIF2 DAC Source Playback Route' None"
+ cset "name='DAC Playback Switch' on"
+ cset "name='DAC Playback Volume' 160"
+ cset "name='ADC Digital DAC Playback Switch' off"
+ cset "name='AIF1 Slot 0 Digital DAC Playback Switch' on"
+ cset "name='AIF2 Digital DAC Playback Switch' on"
+ cset "name='DAC Reversed Playback Switch' off"
+ cset "name='Earpiece Playback Switch' off"
+ cset "name='Earpiece Source Playback Route' DACL"
+
+ cset "name='Line In Capture Switch' off"
+ cset "name='Mic1 Capture Switch' off"
+ cset "name='Mic1 Boost Volume' 0"
+ cset "name='Mic1 Playback Volume' 7"
+ cset "name='Mic2 Capture Switch' off"
+ cset "name='Mic2 Boost Volume' 0"
+ cset "name='Mic2 Playback Volume' 7"
+ cset "name='Mixer Capture Switch' off"
+ cset "name='Mixer Reversed Capture Switch' off"
+ cset "name='ADC Capture Volume' 160"
+ cset "name='ADC Gain Capture Volume' 7"
+ cset "name='AIF1 AD0 Capture Volume' 160"
+ cset "name='AIF1 Data Digital ADC Capture Switch' on"
+ cset "name='AIF2 ADC Capture Volume' 160"
+ cset "name='AIF2 ADC Mixer ADC Capture Switch' on"
+ cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off"
+ cset "name='AIF2 ADC Mixer AIF2 DAC Rev Capture Switch' off"
+ cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off"
+ cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off"
+ ]
+
+ DisableSequence [
+ ]
+
+ Value {
+ PlaybackRate 8000
+ }
+}
+
+SectionDevice."Speaker" {
+ Comment "Internal speaker"
+ EnableSequence [
+ cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono"
+ cset "name='Line Out Playback Switch' on"
+ cset "name='Line Out Playback Volume' 100%"
+ ]
+
+ DisableSequence [
+ cset "name='Line Out Playback Switch' off"
+ ]
+
+ Value {
+ PlaybackVolume "Line Out Playback Volume"
+ PlaybackSwitch "Line Out Playback Switch"
+ PlaybackChannels 2
+ PlaybackPriority 300
+ PlaybackPCM "hw:${CardId},0"
+ }
+}
+SectionDevice."Earpiece" {
+ Comment "Internal Earpiece"
+ EnableSequence [
+ cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono"
+ cset "name='Earpiece Playback Switch' on"
+ cset "name='Earpiece Playback Volume' 100%"
+ ]
+
+ DisableSequence [
+ cset "name='Earpiece Playback Switch' off"
+ ]
+
+ Value {
+ PlaybackVolume "Earpiece Playback Volume"
+ PlaybackSwitch "Earpiece Playback Switch"
+ PlaybackChannels 2
+ PlaybackPriority 500
+ PlaybackPCM "hw:${CardId},0"
+ }
+}
+SectionDevice."Mic" {
+ Comment "Internal Microphone"
+ ConflictingDevice [
+ "Headset"
+ ]
+ EnableSequence [
+ cset "name='Mic1 Capture Switch' on"
+ ]
+ DisableSequence [
+ cset "name='Mic1 Capture Switch' off"
+ ]
+ Value {
+ CapturePriority 200
+ CapturePCM "hw:${CardId},0"
+ CaptureChannels 2
+ }
+}
+SectionDevice."Headset" {
+ Comment "Headset Microphone"
+ ConflictingDevice [
+ "Mic"
+ ]
+ EnableSequence [
+ cset "name='Mic2 Capture Switch' on"
+ ]
+ DisableSequence [
+ cset "name='Mic2 Capture Switch' off"
+ ]
+ Value {
+ CapturePriority 100
+ CapturePCM "hw:${CardId},0"
+ CaptureChannels 2
+ }
+}
+SectionDevice."Headphones" {
+ Comment "Headset"
+ EnableSequence [
+ cset "name='AIF1 DA0 Stereo Playback Route' Stereo"
+ cset "name='Headphone Playback Switch' on"
+ cset "name='Headphone Playback Volume' 40%"
+ ]
+
+ DisableSequence [
+ cset "name='Headphone Playback Switch' off"
+ ]
+
+ Value {
+ PlaybackVolume "Headphone Playback Volume"
+ PlaybackSwitch "Headphone Playback Switch"
+ PlaybackChannels 2
+ PlaybackPriority 100
+ PlaybackPCM "hw:${CardId},0"
+ }
+}
diff --git a/srcpkgs/pinephone-utils/template b/srcpkgs/pinephone-utils/template
new file mode 100644
index 00000000000..fd456eca6b2
--- /dev/null
+++ b/srcpkgs/pinephone-utils/template
@@ -0,0 +1,21 @@
+# Template file for 'pinephone-utils'
+pkgname=pinephone-utils
+version=0.1
+revision=1
+archs="aarch64*"
+depends="alsa-ucm-conf"
+short_desc="Scripts/configs for managing pinephone hardware"
+maintainer="John Sullivan <jsullivan@csumb.edu>"
+license="MIT"
+homepage="https://www.voidlinux.org"
+
+do_install() {
+ vinstall "${FILESDIR}/90-modem-eg25.rules" 644 usr/lib/udev/rules.d
+ vinstall "${FILESDIR}/00-alsa-pinephone-dshare.conf" 644 etc/alsa/conf.d
+ vbin "${FILESDIR}/pinephone-modem-setup"
+
+ vmkdir usr/share/alsa/ucm2
+ vcopy "${FILESDIR}/ucm" usr/share/alsa/ucm2/PinePhone
+
+ vlicense "${FILESDIR}/COPYING"
+}
From 98d9792cce769e62aac07d2bc67feed8ef17a919 Mon Sep 17 00:00:00 2001
From: John Sullivan <jsullivan@csumb.edu>
Date: Fri, 5 Feb 2021 21:32:10 -0800
Subject: [PATCH 3/3] pinephone-base: move udev rules to pinephone-utils
---
srcpkgs/pinephone-base/files/90-modem-eg25.rules | 5 -----
srcpkgs/pinephone-base/template | 8 ++------
2 files changed, 2 insertions(+), 11 deletions(-)
delete mode 100644 srcpkgs/pinephone-base/files/90-modem-eg25.rules
diff --git a/srcpkgs/pinephone-base/files/90-modem-eg25.rules b/srcpkgs/pinephone-base/files/90-modem-eg25.rules
deleted file mode 100644
index cd0031422cb..00000000000
--- a/srcpkgs/pinephone-base/files/90-modem-eg25.rules
+++ /dev/null
@@ -1,5 +0,0 @@
-SUBSYSTEMS=="usb", ENV{.LOCAL_ifNum}="$attr{bInterfaceNumber}"
-
-SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="01", SYMLINK+="EG25.NMEA", MODE="0660"
-SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="02", SYMLINK+="EG25.AT", MODE="0660"
-SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="03", SYMLINK+="EG25.MODEM", MODE="0660"
diff --git a/srcpkgs/pinephone-base/template b/srcpkgs/pinephone-base/template
index 6c750a92bd5..a4741e24cb7 100644
--- a/srcpkgs/pinephone-base/template
+++ b/srcpkgs/pinephone-base/template
@@ -1,15 +1,11 @@
# Template file for 'pinephone-base'
pkgname=pinephone-base
-version=0.1
+version=0.2
revision=1
archs="aarch64*"
build_style=meta
-depends="pinephone-kernel pinephone-uboot"
+depends="pinephone-kernel pinephone-uboot pinephone-utils"
short_desc="Void Linux PinePhone platform package"
maintainer="John Sullivan <jsullivan@csumb.edu>"
license="Public Domain"
homepage="https://www.voidlinux.org"
-
-do_install() {
- vinstall "${FILESDIR}/90-modem-eg25.rules" 644 usr/lib/udev/rules.d
-}
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR REVIEW] pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
` (10 preceding siblings ...)
2021-02-06 5:32 ` [PR PATCH] [Updated] " jjsullivan5196
@ 2021-02-06 5:35 ` jjsullivan5196
2021-02-06 7:06 ` [PR PATCH] [Updated] " jjsullivan5196
` (17 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2021-02-06 5:35 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 345 bytes --]
New review comment by jjsullivan5196 on void-packages repository
https://github.com/void-linux/void-packages/pull/25084#discussion_r571362912
Comment:
That might be possible, the scripts are sourced from their source packages repo, so I'd need to split them out somehow. However, I think any changes I made can be re-done in a ~10 line patch.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR PATCH] [Updated] pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
` (11 preceding siblings ...)
2021-02-06 5:35 ` [PR REVIEW] " jjsullivan5196
@ 2021-02-06 7:06 ` jjsullivan5196
2021-02-06 7:09 ` jjsullivan5196
` (16 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2021-02-06 7:06 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 3560 bytes --]
There is an updated pull request by jjsullivan5196 against master on the void-packages repository
https://github.com/jjsullivan5196/void-packages pinephone-qol
https://github.com/void-linux/void-packages/pull/25084
pinephone: add support for modem setup and audio routing.
This pull adds the necessary components for 4G modem usage, with the following use-cases in mind:
- Configure audio setup to and from modem
- Make and receive calls
- Send and read SMS
- Use mobile broadband/cellular data
- Wake-on-Modem (for calls and texts)
For now I've tested this with ModemManager+NetworkManager, but this also provides the groundwork for environments that use `ofono` (or just plain AT commands with `atinout` or `screen`, if you feel clever :^) )
To get started, you first need to run `pinephone-modem-setup` once as root to do the initial modem configuration. (chances are postmarketOS already did this if you booted the phone once, but this might need to be done again incase of potential data loss)
Some use-cases might require further configuration of software (eg specific to NetworkManager) but the setup script should do most of the needed work. Make sure modem is powered up by running `echo 1 > /sys/class/modem-power/modem-power/device/powered_blocking` Some examples of usage that I've tested below:
Read sms with `mmcli`
```sh
$ mmcli -s '/org/freedesktop/ModemManager1/SMS/2'
-----------------------------------
Content | number: '+5555555555'
| text: 'Test'
-----------------------------------
Properties | PDU type: 'deliver'
| state: 'received'
| storage: 'me'
| smsc: '+919810051829'
| timestamp: '160808142935+05'
```
Sample script for answering calls, using ModemManager dbus interface. Audio is setup thru `alsaucm`
```sh
#!/bin/bash
MM_IFACE="org.freedesktop.ModemManager1"
MATCH_CALLS="type='signal',sender='${MM_IFACE}',interface='${MM_IFACE}.Modem.Voice',member='CallAdded'"
do_accept() {
while read TYPE TIME SENDER HEADER
do
if [[ "$HEADER" = *"Modem.Voice"* ]]; then
read TYPE _P OBJ
OBJ=$(echo "${OBJ}" | tr -d '"')
echo "Pickup ${OBJ}"
alsaucm \
open PinePhone \
set _verb 'Voice Call' \
set _enadev 'Mic' \
set _enadev 'Earpiece'
dbus-send \
--system \
--dest="${MM_IFACE}" \
--print-reply \
"${OBJ}" \
"${MM_IFACE}.Call.Accept"
else
read
fi
done
}
dbus-monitor --system "${MATCH_CALLS}" | do_accept
```
Add a NetworkManager connection for LTE (sub `<operator_apn>` for your carrier's data APN)
```sh
$ nmcli c add type gsm ifname '*' con-name LTE apn <operator_apn>
```
For Wake-on-Modem: I tested by doing `loginctl suspend` from a sway session, then calling the phone. It wakes up within 2 rings.
fwiw: these examples are only good for making sure the hardware/software interface works. More work still needs to be done to get some telephony front-end software in the repo, like #24538 Sxmo also should work out-of-the box with the NetworkManager+ModemManager pair https://git.sr.ht/~mil/sxmo-docs
For any concerns about the `COPYING` file, the [original author approves](https://matrix.to/#/!ToPtLQdvveNEbXcHqE:fam-ribbers.com/$YEfAo9NI3WPApA1QbhmQrhwizjmlYXnLkMjby4PU7z4?via=matrix.org&via=feneas.org&via=kde.org).
A patch file from https://github.com/void-linux/void-packages/pull/25084.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-pinephone-qol-25084.patch --]
[-- Type: text/x-diff, Size: 6171 bytes --]
From 0d22968acd2e0321afd768099bdc03064ec2a517 Mon Sep 17 00:00:00 2001
From: John Sullivan <jsullivan@csumb.edu>
Date: Fri, 25 Sep 2020 00:44:17 -0700
Subject: [PATCH 1/3] New package: atinout-0.9.1
---
srcpkgs/atinout/template | 14 ++++++++++++++
1 file changed, 14 insertions(+)
create mode 100644 srcpkgs/atinout/template
diff --git a/srcpkgs/atinout/template b/srcpkgs/atinout/template
new file mode 100644
index 00000000000..e292bf9c9c7
--- /dev/null
+++ b/srcpkgs/atinout/template
@@ -0,0 +1,14 @@
+# Template file for 'atinout'
+pkgname=atinout
+version=0.9.1
+revision=1
+build_style=gnu-makefile
+short_desc="Send AT commands to modem and print responses"
+maintainer="John Sullivan <jsullivan@csumb.edu>"
+license="GPL-3.0-or-later"
+homepage="http://atinout.sourceforge.net"
+distfiles="${SOURCEFORGE_SITE}/project/${pkgname}/v${version}/${pkgname}-${version}.tar.gz"
+checksum=4d15c8288aca414e11cd304686b172696104c5e42bf776300311c005634854a2
+
+# Disable -Werror (GCC9+ turns switch fallthrough into error)
+CFLAGS="-W -Wall -Wextra -DVERSION=\\\"${version}\\\" -g"
From 435dee9de8921b320fbd4a01248ace711e276af8 Mon Sep 17 00:00:00 2001
From: John Sullivan <jsullivan@csumb.edu>
Date: Fri, 5 Feb 2021 21:31:03 -0800
Subject: [PATCH 2/3] New package: pinephone-utils-0.1
---
.../patches/vendor/modem-rules.patch | 8 +++++
srcpkgs/pinephone-utils/template | 32 +++++++++++++++++++
2 files changed, 40 insertions(+)
create mode 100644 srcpkgs/pinephone-utils/patches/vendor/modem-rules.patch
create mode 100644 srcpkgs/pinephone-utils/template
diff --git a/srcpkgs/pinephone-utils/patches/vendor/modem-rules.patch b/srcpkgs/pinephone-utils/patches/vendor/modem-rules.patch
new file mode 100644
index 00000000000..2157c2184d0
--- /dev/null
+++ b/srcpkgs/pinephone-utils/patches/vendor/modem-rules.patch
@@ -0,0 +1,8 @@
+--- device/main/device-pine64-pinephone/90-modem-eg25.rules 2021-01-27 07:11:44.000000000 -0800
++++ srcpkgs/pinephone-utils/files/90-modem-eg25.rules 2020-09-25 01:37:55.390496779 -0700
+@@ -3,5 +3,3 @@
+ SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="01", SYMLINK+="EG25.NMEA", MODE="0660"
+ SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="02", SYMLINK+="EG25.AT", MODE="0660"
+ SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="03", SYMLINK+="EG25.MODEM", MODE="0660"
+-
+-ACTION=="add", SUBSYSTEM=="tty", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="02", RUN+="/usr/bin/pinephone_setup-modem '%E{DEVNAME}'"
diff --git a/srcpkgs/pinephone-utils/template b/srcpkgs/pinephone-utils/template
new file mode 100644
index 00000000000..d2059e54281
--- /dev/null
+++ b/srcpkgs/pinephone-utils/template
@@ -0,0 +1,32 @@
+# Template file for 'pinephone-utils'
+pkgname=pinephone-utils
+version=0.1
+revision=1
+archs="aarch64*"
+create_wrksrc=yes
+depends="alsa-ucm-conf"
+short_desc="Scripts/configs for managing pinephone hardware"
+maintainer="John Sullivan <jsullivan@csumb.edu>"
+license="MIT"
+homepage="https://postmarketos.org/"
+
+_commit_pmos=c48037d5ed307d865903ef3aecd302f1fa4417f8
+_pmos_device='device/main/device-pine64-pinephone'
+_pmos_checkout="pmaports-${_commit_pmos}-$(echo ${_pmos_device} | tr '/' '-')/${_pmos_device}"
+
+distfiles="https://gitlab.com/postmarketOS/pmaports/-/archive/${_commit_pmos}/pmaports-${_commit_pmos}.tar.gz?path=${_pmos_device}>pmos-scripts.tar.gz"
+checksum="d73200da438b6a5641ccd0e73f778cad07301c83b5bbf7286722c74a98675d2e"
+
+do_patch() {
+ patch "${_pmos_checkout}/90-modem-eg25.rules" -slNp1 -i "${PATCHESDIR}/vendor/modem-rules.patch"
+ sed -i 's/postmarketOS/void/' "${_pmos_checkout}/setup-modem.sh"
+}
+
+do_install() {
+ vinstall "${_pmos_checkout}/90-modem-eg25.rules" 644 usr/lib/udev/rules.d
+ vinstall "${_pmos_checkout}/00_alsa_pinephone_dshare.conf" 644 etc/alsa/conf.d "00-alsa-pinephone-dshare.conf"
+ vbin "${_pmos_checkout}/setup-modem.sh" "pinephone-setup-modem.sh"
+
+ vmkdir usr/share/alsa/ucm2
+ vcopy "${_pmos_checkout}/ucm" usr/share/alsa/ucm2/PinePhone
+}
From 0593f2eba4ca2a4bfdd2720a20eb098e1aaa3207 Mon Sep 17 00:00:00 2001
From: John Sullivan <jsullivan@csumb.edu>
Date: Fri, 5 Feb 2021 21:32:10 -0800
Subject: [PATCH 3/3] pinephone-base: get utilities from pinephone-utils
---
srcpkgs/pinephone-base/files/90-modem-eg25.rules | 5 -----
srcpkgs/pinephone-base/template | 8 ++------
2 files changed, 2 insertions(+), 11 deletions(-)
delete mode 100644 srcpkgs/pinephone-base/files/90-modem-eg25.rules
diff --git a/srcpkgs/pinephone-base/files/90-modem-eg25.rules b/srcpkgs/pinephone-base/files/90-modem-eg25.rules
deleted file mode 100644
index cd0031422cb..00000000000
--- a/srcpkgs/pinephone-base/files/90-modem-eg25.rules
+++ /dev/null
@@ -1,5 +0,0 @@
-SUBSYSTEMS=="usb", ENV{.LOCAL_ifNum}="$attr{bInterfaceNumber}"
-
-SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="01", SYMLINK+="EG25.NMEA", MODE="0660"
-SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="02", SYMLINK+="EG25.AT", MODE="0660"
-SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="03", SYMLINK+="EG25.MODEM", MODE="0660"
diff --git a/srcpkgs/pinephone-base/template b/srcpkgs/pinephone-base/template
index 6c750a92bd5..a4741e24cb7 100644
--- a/srcpkgs/pinephone-base/template
+++ b/srcpkgs/pinephone-base/template
@@ -1,15 +1,11 @@
# Template file for 'pinephone-base'
pkgname=pinephone-base
-version=0.1
+version=0.2
revision=1
archs="aarch64*"
build_style=meta
-depends="pinephone-kernel pinephone-uboot"
+depends="pinephone-kernel pinephone-uboot pinephone-utils"
short_desc="Void Linux PinePhone platform package"
maintainer="John Sullivan <jsullivan@csumb.edu>"
license="Public Domain"
homepage="https://www.voidlinux.org"
-
-do_install() {
- vinstall "${FILESDIR}/90-modem-eg25.rules" 644 usr/lib/udev/rules.d
-}
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR PATCH] [Updated] pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
` (12 preceding siblings ...)
2021-02-06 7:06 ` [PR PATCH] [Updated] " jjsullivan5196
@ 2021-02-06 7:09 ` jjsullivan5196
2021-02-06 7:15 ` jjsullivan5196
` (15 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2021-02-06 7:09 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 3560 bytes --]
There is an updated pull request by jjsullivan5196 against master on the void-packages repository
https://github.com/jjsullivan5196/void-packages pinephone-qol
https://github.com/void-linux/void-packages/pull/25084
pinephone: add support for modem setup and audio routing.
This pull adds the necessary components for 4G modem usage, with the following use-cases in mind:
- Configure audio setup to and from modem
- Make and receive calls
- Send and read SMS
- Use mobile broadband/cellular data
- Wake-on-Modem (for calls and texts)
For now I've tested this with ModemManager+NetworkManager, but this also provides the groundwork for environments that use `ofono` (or just plain AT commands with `atinout` or `screen`, if you feel clever :^) )
To get started, you first need to run `pinephone-modem-setup` once as root to do the initial modem configuration. (chances are postmarketOS already did this if you booted the phone once, but this might need to be done again incase of potential data loss)
Some use-cases might require further configuration of software (eg specific to NetworkManager) but the setup script should do most of the needed work. Make sure modem is powered up by running `echo 1 > /sys/class/modem-power/modem-power/device/powered_blocking` Some examples of usage that I've tested below:
Read sms with `mmcli`
```sh
$ mmcli -s '/org/freedesktop/ModemManager1/SMS/2'
-----------------------------------
Content | number: '+5555555555'
| text: 'Test'
-----------------------------------
Properties | PDU type: 'deliver'
| state: 'received'
| storage: 'me'
| smsc: '+919810051829'
| timestamp: '160808142935+05'
```
Sample script for answering calls, using ModemManager dbus interface. Audio is setup thru `alsaucm`
```sh
#!/bin/bash
MM_IFACE="org.freedesktop.ModemManager1"
MATCH_CALLS="type='signal',sender='${MM_IFACE}',interface='${MM_IFACE}.Modem.Voice',member='CallAdded'"
do_accept() {
while read TYPE TIME SENDER HEADER
do
if [[ "$HEADER" = *"Modem.Voice"* ]]; then
read TYPE _P OBJ
OBJ=$(echo "${OBJ}" | tr -d '"')
echo "Pickup ${OBJ}"
alsaucm \
open PinePhone \
set _verb 'Voice Call' \
set _enadev 'Mic' \
set _enadev 'Earpiece'
dbus-send \
--system \
--dest="${MM_IFACE}" \
--print-reply \
"${OBJ}" \
"${MM_IFACE}.Call.Accept"
else
read
fi
done
}
dbus-monitor --system "${MATCH_CALLS}" | do_accept
```
Add a NetworkManager connection for LTE (sub `<operator_apn>` for your carrier's data APN)
```sh
$ nmcli c add type gsm ifname '*' con-name LTE apn <operator_apn>
```
For Wake-on-Modem: I tested by doing `loginctl suspend` from a sway session, then calling the phone. It wakes up within 2 rings.
fwiw: these examples are only good for making sure the hardware/software interface works. More work still needs to be done to get some telephony front-end software in the repo, like #24538 Sxmo also should work out-of-the box with the NetworkManager+ModemManager pair https://git.sr.ht/~mil/sxmo-docs
For any concerns about the `COPYING` file, the [original author approves](https://matrix.to/#/!ToPtLQdvveNEbXcHqE:fam-ribbers.com/$YEfAo9NI3WPApA1QbhmQrhwizjmlYXnLkMjby4PU7z4?via=matrix.org&via=feneas.org&via=kde.org).
A patch file from https://github.com/void-linux/void-packages/pull/25084.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-pinephone-qol-25084.patch --]
[-- Type: text/x-diff, Size: 6168 bytes --]
From 0d22968acd2e0321afd768099bdc03064ec2a517 Mon Sep 17 00:00:00 2001
From: John Sullivan <jsullivan@csumb.edu>
Date: Fri, 25 Sep 2020 00:44:17 -0700
Subject: [PATCH 1/3] New package: atinout-0.9.1
---
srcpkgs/atinout/template | 14 ++++++++++++++
1 file changed, 14 insertions(+)
create mode 100644 srcpkgs/atinout/template
diff --git a/srcpkgs/atinout/template b/srcpkgs/atinout/template
new file mode 100644
index 00000000000..e292bf9c9c7
--- /dev/null
+++ b/srcpkgs/atinout/template
@@ -0,0 +1,14 @@
+# Template file for 'atinout'
+pkgname=atinout
+version=0.9.1
+revision=1
+build_style=gnu-makefile
+short_desc="Send AT commands to modem and print responses"
+maintainer="John Sullivan <jsullivan@csumb.edu>"
+license="GPL-3.0-or-later"
+homepage="http://atinout.sourceforge.net"
+distfiles="${SOURCEFORGE_SITE}/project/${pkgname}/v${version}/${pkgname}-${version}.tar.gz"
+checksum=4d15c8288aca414e11cd304686b172696104c5e42bf776300311c005634854a2
+
+# Disable -Werror (GCC9+ turns switch fallthrough into error)
+CFLAGS="-W -Wall -Wextra -DVERSION=\\\"${version}\\\" -g"
From 7e1625afeab8aae79e977a0d16a2a8b1c285db06 Mon Sep 17 00:00:00 2001
From: John Sullivan <jsullivan@csumb.edu>
Date: Fri, 5 Feb 2021 21:31:03 -0800
Subject: [PATCH 2/3] New package: pinephone-utils-0.1
---
.../patches/vendor/modem-rules.patch | 8 +++++
srcpkgs/pinephone-utils/template | 32 +++++++++++++++++++
2 files changed, 40 insertions(+)
create mode 100644 srcpkgs/pinephone-utils/patches/vendor/modem-rules.patch
create mode 100644 srcpkgs/pinephone-utils/template
diff --git a/srcpkgs/pinephone-utils/patches/vendor/modem-rules.patch b/srcpkgs/pinephone-utils/patches/vendor/modem-rules.patch
new file mode 100644
index 00000000000..2157c2184d0
--- /dev/null
+++ b/srcpkgs/pinephone-utils/patches/vendor/modem-rules.patch
@@ -0,0 +1,8 @@
+--- device/main/device-pine64-pinephone/90-modem-eg25.rules 2021-01-27 07:11:44.000000000 -0800
++++ srcpkgs/pinephone-utils/files/90-modem-eg25.rules 2020-09-25 01:37:55.390496779 -0700
+@@ -3,5 +3,3 @@
+ SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="01", SYMLINK+="EG25.NMEA", MODE="0660"
+ SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="02", SYMLINK+="EG25.AT", MODE="0660"
+ SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="03", SYMLINK+="EG25.MODEM", MODE="0660"
+-
+-ACTION=="add", SUBSYSTEM=="tty", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="02", RUN+="/usr/bin/pinephone_setup-modem '%E{DEVNAME}'"
diff --git a/srcpkgs/pinephone-utils/template b/srcpkgs/pinephone-utils/template
new file mode 100644
index 00000000000..1ac909de537
--- /dev/null
+++ b/srcpkgs/pinephone-utils/template
@@ -0,0 +1,32 @@
+# Template file for 'pinephone-utils'
+pkgname=pinephone-utils
+version=0.1
+revision=1
+archs="aarch64*"
+create_wrksrc=yes
+depends="alsa-ucm-conf"
+short_desc="Scripts/configs for managing pinephone hardware"
+maintainer="John Sullivan <jsullivan@csumb.edu>"
+license="MIT"
+homepage="https://postmarketos.org/"
+
+_commit_pmos=c48037d5ed307d865903ef3aecd302f1fa4417f8
+_pmos_device='device/main/device-pine64-pinephone'
+_pmos_checkout="pmaports-${_commit_pmos}-$(echo ${_pmos_device} | tr '/' '-')/${_pmos_device}"
+
+distfiles="https://gitlab.com/postmarketOS/pmaports/-/archive/${_commit_pmos}/pmaports-${_commit_pmos}.tar.gz?path=${_pmos_device}>pmos-scripts.tar.gz"
+checksum="d73200da438b6a5641ccd0e73f778cad07301c83b5bbf7286722c74a98675d2e"
+
+do_patch() {
+ patch "${_pmos_checkout}/90-modem-eg25.rules" -slNp1 -i "${PATCHESDIR}/vendor/modem-rules.patch"
+ sed -i 's/postmarketOS/void/' "${_pmos_checkout}/setup-modem.sh"
+}
+
+do_install() {
+ vinstall "${_pmos_checkout}/90-modem-eg25.rules" 644 usr/lib/udev/rules.d
+ vinstall "${_pmos_checkout}/00_alsa_pinephone_dshare.conf" 644 etc/alsa/conf.d "00-alsa-pinephone-dshare.conf"
+ vbin "${_pmos_checkout}/setup-modem.sh" "pinephone-modem-setup"
+
+ vmkdir usr/share/alsa/ucm2
+ vcopy "${_pmos_checkout}/ucm" usr/share/alsa/ucm2/PinePhone
+}
From e4640d6e17592a82eb1df1056000f8f693d3dc26 Mon Sep 17 00:00:00 2001
From: John Sullivan <jsullivan@csumb.edu>
Date: Fri, 5 Feb 2021 21:32:10 -0800
Subject: [PATCH 3/3] pinephone-base: get utilities from pinephone-utils
---
srcpkgs/pinephone-base/files/90-modem-eg25.rules | 5 -----
srcpkgs/pinephone-base/template | 8 ++------
2 files changed, 2 insertions(+), 11 deletions(-)
delete mode 100644 srcpkgs/pinephone-base/files/90-modem-eg25.rules
diff --git a/srcpkgs/pinephone-base/files/90-modem-eg25.rules b/srcpkgs/pinephone-base/files/90-modem-eg25.rules
deleted file mode 100644
index cd0031422cb..00000000000
--- a/srcpkgs/pinephone-base/files/90-modem-eg25.rules
+++ /dev/null
@@ -1,5 +0,0 @@
-SUBSYSTEMS=="usb", ENV{.LOCAL_ifNum}="$attr{bInterfaceNumber}"
-
-SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="01", SYMLINK+="EG25.NMEA", MODE="0660"
-SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="02", SYMLINK+="EG25.AT", MODE="0660"
-SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="03", SYMLINK+="EG25.MODEM", MODE="0660"
diff --git a/srcpkgs/pinephone-base/template b/srcpkgs/pinephone-base/template
index 6c750a92bd5..a4741e24cb7 100644
--- a/srcpkgs/pinephone-base/template
+++ b/srcpkgs/pinephone-base/template
@@ -1,15 +1,11 @@
# Template file for 'pinephone-base'
pkgname=pinephone-base
-version=0.1
+version=0.2
revision=1
archs="aarch64*"
build_style=meta
-depends="pinephone-kernel pinephone-uboot"
+depends="pinephone-kernel pinephone-uboot pinephone-utils"
short_desc="Void Linux PinePhone platform package"
maintainer="John Sullivan <jsullivan@csumb.edu>"
license="Public Domain"
homepage="https://www.voidlinux.org"
-
-do_install() {
- vinstall "${FILESDIR}/90-modem-eg25.rules" 644 usr/lib/udev/rules.d
-}
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR PATCH] [Updated] pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
` (13 preceding siblings ...)
2021-02-06 7:09 ` jjsullivan5196
@ 2021-02-06 7:15 ` jjsullivan5196
2021-02-06 7:21 ` jjsullivan5196
` (14 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2021-02-06 7:15 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 3560 bytes --]
There is an updated pull request by jjsullivan5196 against master on the void-packages repository
https://github.com/jjsullivan5196/void-packages pinephone-qol
https://github.com/void-linux/void-packages/pull/25084
pinephone: add support for modem setup and audio routing.
This pull adds the necessary components for 4G modem usage, with the following use-cases in mind:
- Configure audio setup to and from modem
- Make and receive calls
- Send and read SMS
- Use mobile broadband/cellular data
- Wake-on-Modem (for calls and texts)
For now I've tested this with ModemManager+NetworkManager, but this also provides the groundwork for environments that use `ofono` (or just plain AT commands with `atinout` or `screen`, if you feel clever :^) )
To get started, you first need to run `pinephone-modem-setup` once as root to do the initial modem configuration. (chances are postmarketOS already did this if you booted the phone once, but this might need to be done again incase of potential data loss)
Some use-cases might require further configuration of software (eg specific to NetworkManager) but the setup script should do most of the needed work. Make sure modem is powered up by running `echo 1 > /sys/class/modem-power/modem-power/device/powered_blocking` Some examples of usage that I've tested below:
Read sms with `mmcli`
```sh
$ mmcli -s '/org/freedesktop/ModemManager1/SMS/2'
-----------------------------------
Content | number: '+5555555555'
| text: 'Test'
-----------------------------------
Properties | PDU type: 'deliver'
| state: 'received'
| storage: 'me'
| smsc: '+919810051829'
| timestamp: '160808142935+05'
```
Sample script for answering calls, using ModemManager dbus interface. Audio is setup thru `alsaucm`
```sh
#!/bin/bash
MM_IFACE="org.freedesktop.ModemManager1"
MATCH_CALLS="type='signal',sender='${MM_IFACE}',interface='${MM_IFACE}.Modem.Voice',member='CallAdded'"
do_accept() {
while read TYPE TIME SENDER HEADER
do
if [[ "$HEADER" = *"Modem.Voice"* ]]; then
read TYPE _P OBJ
OBJ=$(echo "${OBJ}" | tr -d '"')
echo "Pickup ${OBJ}"
alsaucm \
open PinePhone \
set _verb 'Voice Call' \
set _enadev 'Mic' \
set _enadev 'Earpiece'
dbus-send \
--system \
--dest="${MM_IFACE}" \
--print-reply \
"${OBJ}" \
"${MM_IFACE}.Call.Accept"
else
read
fi
done
}
dbus-monitor --system "${MATCH_CALLS}" | do_accept
```
Add a NetworkManager connection for LTE (sub `<operator_apn>` for your carrier's data APN)
```sh
$ nmcli c add type gsm ifname '*' con-name LTE apn <operator_apn>
```
For Wake-on-Modem: I tested by doing `loginctl suspend` from a sway session, then calling the phone. It wakes up within 2 rings.
fwiw: these examples are only good for making sure the hardware/software interface works. More work still needs to be done to get some telephony front-end software in the repo, like #24538 Sxmo also should work out-of-the box with the NetworkManager+ModemManager pair https://git.sr.ht/~mil/sxmo-docs
For any concerns about the `COPYING` file, the [original author approves](https://matrix.to/#/!ToPtLQdvveNEbXcHqE:fam-ribbers.com/$YEfAo9NI3WPApA1QbhmQrhwizjmlYXnLkMjby4PU7z4?via=matrix.org&via=feneas.org&via=kde.org).
A patch file from https://github.com/void-linux/void-packages/pull/25084.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-pinephone-qol-25084.patch --]
[-- Type: text/x-diff, Size: 6819 bytes --]
From 0d22968acd2e0321afd768099bdc03064ec2a517 Mon Sep 17 00:00:00 2001
From: John Sullivan <jsullivan@csumb.edu>
Date: Fri, 25 Sep 2020 00:44:17 -0700
Subject: [PATCH 1/3] New package: atinout-0.9.1
---
srcpkgs/atinout/template | 14 ++++++++++++++
1 file changed, 14 insertions(+)
create mode 100644 srcpkgs/atinout/template
diff --git a/srcpkgs/atinout/template b/srcpkgs/atinout/template
new file mode 100644
index 00000000000..e292bf9c9c7
--- /dev/null
+++ b/srcpkgs/atinout/template
@@ -0,0 +1,14 @@
+# Template file for 'atinout'
+pkgname=atinout
+version=0.9.1
+revision=1
+build_style=gnu-makefile
+short_desc="Send AT commands to modem and print responses"
+maintainer="John Sullivan <jsullivan@csumb.edu>"
+license="GPL-3.0-or-later"
+homepage="http://atinout.sourceforge.net"
+distfiles="${SOURCEFORGE_SITE}/project/${pkgname}/v${version}/${pkgname}-${version}.tar.gz"
+checksum=4d15c8288aca414e11cd304686b172696104c5e42bf776300311c005634854a2
+
+# Disable -Werror (GCC9+ turns switch fallthrough into error)
+CFLAGS="-W -Wall -Wextra -DVERSION=\\\"${version}\\\" -g"
From affc562d9d3302025dbe9cadf823b15bc4e522c8 Mon Sep 17 00:00:00 2001
From: John Sullivan <jsullivan@csumb.edu>
Date: Fri, 5 Feb 2021 21:31:03 -0800
Subject: [PATCH 2/3] New package: pinephone-utils-0.1
---
srcpkgs/pinephone-utils/files/COPYING | 6 ++++
.../patches/vendor/modem-rules.patch | 8 +++++
srcpkgs/pinephone-utils/template | 34 +++++++++++++++++++
3 files changed, 48 insertions(+)
create mode 100644 srcpkgs/pinephone-utils/files/COPYING
create mode 100644 srcpkgs/pinephone-utils/patches/vendor/modem-rules.patch
create mode 100644 srcpkgs/pinephone-utils/template
diff --git a/srcpkgs/pinephone-utils/files/COPYING b/srcpkgs/pinephone-utils/files/COPYING
new file mode 100644
index 00000000000..f70a8d3fd2e
--- /dev/null
+++ b/srcpkgs/pinephone-utils/files/COPYING
@@ -0,0 +1,6 @@
+Some files used in this package originate from postmarketOS, and are used with
+some modifications under the terms of the MIT license
+https://opensource.org/licenses/MIT
+
+see for sources:
+https://gitlab.com/postmarketOS/pmaports/-/tree/master/device/main/device-pine64-pinephone
diff --git a/srcpkgs/pinephone-utils/patches/vendor/modem-rules.patch b/srcpkgs/pinephone-utils/patches/vendor/modem-rules.patch
new file mode 100644
index 00000000000..2157c2184d0
--- /dev/null
+++ b/srcpkgs/pinephone-utils/patches/vendor/modem-rules.patch
@@ -0,0 +1,8 @@
+--- device/main/device-pine64-pinephone/90-modem-eg25.rules 2021-01-27 07:11:44.000000000 -0800
++++ srcpkgs/pinephone-utils/files/90-modem-eg25.rules 2020-09-25 01:37:55.390496779 -0700
+@@ -3,5 +3,3 @@
+ SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="01", SYMLINK+="EG25.NMEA", MODE="0660"
+ SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="02", SYMLINK+="EG25.AT", MODE="0660"
+ SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="03", SYMLINK+="EG25.MODEM", MODE="0660"
+-
+-ACTION=="add", SUBSYSTEM=="tty", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="02", RUN+="/usr/bin/pinephone_setup-modem '%E{DEVNAME}'"
diff --git a/srcpkgs/pinephone-utils/template b/srcpkgs/pinephone-utils/template
new file mode 100644
index 00000000000..0444fb51b9f
--- /dev/null
+++ b/srcpkgs/pinephone-utils/template
@@ -0,0 +1,34 @@
+# Template file for 'pinephone-utils'
+pkgname=pinephone-utils
+version=0.1
+revision=1
+archs="aarch64*"
+create_wrksrc=yes
+depends="alsa-ucm-conf"
+short_desc="Scripts/configs for managing pinephone hardware"
+maintainer="John Sullivan <jsullivan@csumb.edu>"
+license="MIT"
+homepage="https://postmarketos.org/"
+
+_commit_pmos=c48037d5ed307d865903ef3aecd302f1fa4417f8
+_pmos_device='device/main/device-pine64-pinephone'
+_pmos_checkout="pmaports-${_commit_pmos}-$(echo ${_pmos_device} | tr '/' '-')/${_pmos_device}"
+
+distfiles="https://gitlab.com/postmarketOS/pmaports/-/archive/${_commit_pmos}/pmaports-${_commit_pmos}.tar.gz?path=${_pmos_device}>pmos-scripts.tar.gz"
+checksum="d73200da438b6a5641ccd0e73f778cad07301c83b5bbf7286722c74a98675d2e"
+
+do_patch() {
+ patch "${_pmos_checkout}/90-modem-eg25.rules" -slNp1 -i "${PATCHESDIR}/vendor/modem-rules.patch"
+ sed -i 's/postmarketOS/void/' "${_pmos_checkout}/setup-modem.sh"
+}
+
+do_install() {
+ vinstall "${_pmos_checkout}/90-modem-eg25.rules" 644 usr/lib/udev/rules.d
+ vinstall "${_pmos_checkout}/00_alsa_pinephone_dshare.conf" 644 etc/alsa/conf.d "00-alsa-pinephone-dshare.conf"
+ vbin "${_pmos_checkout}/setup-modem.sh" "pinephone-modem-setup"
+
+ vmkdir usr/share/alsa/ucm2
+ vcopy "${_pmos_checkout}/ucm" usr/share/alsa/ucm2/PinePhone
+
+ vlicense "${FILESDIR}/COPYING"
+}
From 46489cec6cdf268174a456471b75c10915ba44d8 Mon Sep 17 00:00:00 2001
From: John Sullivan <jsullivan@csumb.edu>
Date: Fri, 5 Feb 2021 21:32:10 -0800
Subject: [PATCH 3/3] pinephone-base: get utilities from pinephone-utils
---
srcpkgs/pinephone-base/files/90-modem-eg25.rules | 5 -----
srcpkgs/pinephone-base/template | 8 ++------
2 files changed, 2 insertions(+), 11 deletions(-)
delete mode 100644 srcpkgs/pinephone-base/files/90-modem-eg25.rules
diff --git a/srcpkgs/pinephone-base/files/90-modem-eg25.rules b/srcpkgs/pinephone-base/files/90-modem-eg25.rules
deleted file mode 100644
index cd0031422cb..00000000000
--- a/srcpkgs/pinephone-base/files/90-modem-eg25.rules
+++ /dev/null
@@ -1,5 +0,0 @@
-SUBSYSTEMS=="usb", ENV{.LOCAL_ifNum}="$attr{bInterfaceNumber}"
-
-SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="01", SYMLINK+="EG25.NMEA", MODE="0660"
-SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="02", SYMLINK+="EG25.AT", MODE="0660"
-SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="03", SYMLINK+="EG25.MODEM", MODE="0660"
diff --git a/srcpkgs/pinephone-base/template b/srcpkgs/pinephone-base/template
index 6c750a92bd5..a4741e24cb7 100644
--- a/srcpkgs/pinephone-base/template
+++ b/srcpkgs/pinephone-base/template
@@ -1,15 +1,11 @@
# Template file for 'pinephone-base'
pkgname=pinephone-base
-version=0.1
+version=0.2
revision=1
archs="aarch64*"
build_style=meta
-depends="pinephone-kernel pinephone-uboot"
+depends="pinephone-kernel pinephone-uboot pinephone-utils"
short_desc="Void Linux PinePhone platform package"
maintainer="John Sullivan <jsullivan@csumb.edu>"
license="Public Domain"
homepage="https://www.voidlinux.org"
-
-do_install() {
- vinstall "${FILESDIR}/90-modem-eg25.rules" 644 usr/lib/udev/rules.d
-}
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
` (14 preceding siblings ...)
2021-02-06 7:15 ` jjsullivan5196
@ 2021-02-06 7:21 ` jjsullivan5196
2021-02-22 21:39 ` MungFuSensei
` (13 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2021-02-06 7:21 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 356 bytes --]
New comment by jjsullivan5196 on void-packages repository
https://github.com/void-linux/void-packages/pull/25084#issuecomment-774416991
Comment:
@the-maldridge I split out the utilities into `pinephone-utils`, and @ericonr I'm sourcing postmarketos' stuff directly from pmaports now. If it looks a little hacky, I can revert back to vendoring the files.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
` (15 preceding siblings ...)
2021-02-06 7:21 ` jjsullivan5196
@ 2021-02-22 21:39 ` MungFuSensei
2021-02-24 4:03 ` [PR REVIEW] " ericonr
` (12 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: MungFuSensei @ 2021-02-22 21:39 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 233 bytes --]
New comment by MungFuSensei on void-packages repository
https://github.com/void-linux/void-packages/pull/25084#issuecomment-783692485
Comment:
Anything holding this up? I have this on my pinephone with sxmo and it's working fine.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR REVIEW] pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
` (16 preceding siblings ...)
2021-02-22 21:39 ` MungFuSensei
@ 2021-02-24 4:03 ` ericonr
2021-02-24 4:03 ` ericonr
` (11 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: ericonr @ 2021-02-24 4:03 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 404 bytes --]
New review comment by ericonr on void-packages repository
https://github.com/void-linux/void-packages/pull/25084#discussion_r581604727
Comment:
```suggestion
distfiles="https://gitlab.com/postmarketOS/pmaports/-/archive/${_commit_pmos}/pmaports-${_commit_pmos}.tar.gz?path=${_pmos_device}>pmos-scripts-${version}.tar.gz"
```
Otherwise local builds will use your cache and not update the checksum.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR REVIEW] pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
` (17 preceding siblings ...)
2021-02-24 4:03 ` [PR REVIEW] " ericonr
@ 2021-02-24 4:03 ` ericonr
2021-02-24 4:03 ` ericonr
` (10 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: ericonr @ 2021-02-24 4:03 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 151 bytes --]
New review comment by ericonr on void-packages repository
https://github.com/void-linux/void-packages/pull/25084#discussion_r581604753
Comment:
vsed
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR REVIEW] pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
` (18 preceding siblings ...)
2021-02-24 4:03 ` ericonr
@ 2021-02-24 4:03 ` ericonr
2021-02-25 19:38 ` Piraty
` (9 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: ericonr @ 2021-02-24 4:03 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 199 bytes --]
New review comment by ericonr on void-packages repository
https://github.com/void-linux/void-packages/pull/25084#discussion_r581604802
Comment:
Can you explain the reason for the patch at the top?
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR REVIEW] pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
` (19 preceding siblings ...)
2021-02-24 4:03 ` ericonr
@ 2021-02-25 19:38 ` Piraty
2021-03-01 0:14 ` [PR PATCH] [Updated] " jjsullivan5196
` (8 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: Piraty @ 2021-02-25 19:38 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 198 bytes --]
New review comment by Piraty on void-packages repository
https://github.com/void-linux/void-packages/pull/25084#discussion_r583111294
Comment:
instead of the subshell, use `${_pmos_device//\//-}`
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR PATCH] [Updated] pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
` (20 preceding siblings ...)
2021-02-25 19:38 ` Piraty
@ 2021-03-01 0:14 ` jjsullivan5196
2021-03-01 0:15 ` [PR REVIEW] " jjsullivan5196
` (7 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2021-03-01 0:14 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 3560 bytes --]
There is an updated pull request by jjsullivan5196 against master on the void-packages repository
https://github.com/jjsullivan5196/void-packages pinephone-qol
https://github.com/void-linux/void-packages/pull/25084
pinephone: add support for modem setup and audio routing.
This pull adds the necessary components for 4G modem usage, with the following use-cases in mind:
- Configure audio setup to and from modem
- Make and receive calls
- Send and read SMS
- Use mobile broadband/cellular data
- Wake-on-Modem (for calls and texts)
For now I've tested this with ModemManager+NetworkManager, but this also provides the groundwork for environments that use `ofono` (or just plain AT commands with `atinout` or `screen`, if you feel clever :^) )
To get started, you first need to run `pinephone-modem-setup` once as root to do the initial modem configuration. (chances are postmarketOS already did this if you booted the phone once, but this might need to be done again incase of potential data loss)
Some use-cases might require further configuration of software (eg specific to NetworkManager) but the setup script should do most of the needed work. Make sure modem is powered up by running `echo 1 > /sys/class/modem-power/modem-power/device/powered_blocking` Some examples of usage that I've tested below:
Read sms with `mmcli`
```sh
$ mmcli -s '/org/freedesktop/ModemManager1/SMS/2'
-----------------------------------
Content | number: '+5555555555'
| text: 'Test'
-----------------------------------
Properties | PDU type: 'deliver'
| state: 'received'
| storage: 'me'
| smsc: '+919810051829'
| timestamp: '160808142935+05'
```
Sample script for answering calls, using ModemManager dbus interface. Audio is setup thru `alsaucm`
```sh
#!/bin/bash
MM_IFACE="org.freedesktop.ModemManager1"
MATCH_CALLS="type='signal',sender='${MM_IFACE}',interface='${MM_IFACE}.Modem.Voice',member='CallAdded'"
do_accept() {
while read TYPE TIME SENDER HEADER
do
if [[ "$HEADER" = *"Modem.Voice"* ]]; then
read TYPE _P OBJ
OBJ=$(echo "${OBJ}" | tr -d '"')
echo "Pickup ${OBJ}"
alsaucm \
open PinePhone \
set _verb 'Voice Call' \
set _enadev 'Mic' \
set _enadev 'Earpiece'
dbus-send \
--system \
--dest="${MM_IFACE}" \
--print-reply \
"${OBJ}" \
"${MM_IFACE}.Call.Accept"
else
read
fi
done
}
dbus-monitor --system "${MATCH_CALLS}" | do_accept
```
Add a NetworkManager connection for LTE (sub `<operator_apn>` for your carrier's data APN)
```sh
$ nmcli c add type gsm ifname '*' con-name LTE apn <operator_apn>
```
For Wake-on-Modem: I tested by doing `loginctl suspend` from a sway session, then calling the phone. It wakes up within 2 rings.
fwiw: these examples are only good for making sure the hardware/software interface works. More work still needs to be done to get some telephony front-end software in the repo, like #24538 Sxmo also should work out-of-the box with the NetworkManager+ModemManager pair https://git.sr.ht/~mil/sxmo-docs
For any concerns about the `COPYING` file, the [original author approves](https://matrix.to/#/!ToPtLQdvveNEbXcHqE:fam-ribbers.com/$YEfAo9NI3WPApA1QbhmQrhwizjmlYXnLkMjby4PU7z4?via=matrix.org&via=feneas.org&via=kde.org).
A patch file from https://github.com/void-linux/void-packages/pull/25084.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-pinephone-qol-25084.patch --]
[-- Type: text/x-diff, Size: 5732 bytes --]
From a318b25feac7d1a9b309860804e872297b6e1f12 Mon Sep 17 00:00:00 2001
From: John Sullivan <jsullivan@csumb.edu>
Date: Fri, 5 Feb 2021 21:31:03 -0800
Subject: [PATCH 1/2] New package: pinephone-utils-0.1
---
srcpkgs/pinephone-utils/files/COPYING | 6 ++++
.../patches/vendor/modem-rules.patch | 8 +++++
srcpkgs/pinephone-utils/template | 34 +++++++++++++++++++
3 files changed, 48 insertions(+)
create mode 100644 srcpkgs/pinephone-utils/files/COPYING
create mode 100644 srcpkgs/pinephone-utils/patches/vendor/modem-rules.patch
create mode 100644 srcpkgs/pinephone-utils/template
diff --git a/srcpkgs/pinephone-utils/files/COPYING b/srcpkgs/pinephone-utils/files/COPYING
new file mode 100644
index 00000000000..f70a8d3fd2e
--- /dev/null
+++ b/srcpkgs/pinephone-utils/files/COPYING
@@ -0,0 +1,6 @@
+Some files used in this package originate from postmarketOS, and are used with
+some modifications under the terms of the MIT license
+https://opensource.org/licenses/MIT
+
+see for sources:
+https://gitlab.com/postmarketOS/pmaports/-/tree/master/device/main/device-pine64-pinephone
diff --git a/srcpkgs/pinephone-utils/patches/vendor/modem-rules.patch b/srcpkgs/pinephone-utils/patches/vendor/modem-rules.patch
new file mode 100644
index 00000000000..2157c2184d0
--- /dev/null
+++ b/srcpkgs/pinephone-utils/patches/vendor/modem-rules.patch
@@ -0,0 +1,8 @@
+--- device/main/device-pine64-pinephone/90-modem-eg25.rules 2021-01-27 07:11:44.000000000 -0800
++++ srcpkgs/pinephone-utils/files/90-modem-eg25.rules 2020-09-25 01:37:55.390496779 -0700
+@@ -3,5 +3,3 @@
+ SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="01", SYMLINK+="EG25.NMEA", MODE="0660"
+ SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="02", SYMLINK+="EG25.AT", MODE="0660"
+ SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="03", SYMLINK+="EG25.MODEM", MODE="0660"
+-
+-ACTION=="add", SUBSYSTEM=="tty", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="02", RUN+="/usr/bin/pinephone_setup-modem '%E{DEVNAME}'"
diff --git a/srcpkgs/pinephone-utils/template b/srcpkgs/pinephone-utils/template
new file mode 100644
index 00000000000..448f1b2690f
--- /dev/null
+++ b/srcpkgs/pinephone-utils/template
@@ -0,0 +1,34 @@
+# Template file for 'pinephone-utils'
+pkgname=pinephone-utils
+version=0.1
+revision=1
+archs="aarch64*"
+create_wrksrc=yes
+depends="alsa-ucm-conf"
+short_desc="Scripts/configs for managing pinephone hardware"
+maintainer="John Sullivan <jsullivan@csumb.edu>"
+license="MIT"
+homepage="https://postmarketos.org/"
+
+_commit_pmos=c48037d5ed307d865903ef3aecd302f1fa4417f8
+_pmos_device='device/main/device-pine64-pinephone'
+_pmos_checkout="pmaports-${_commit_pmos}-${_pmos_device//\//-}/${_pmos_device}"
+
+distfiles="https://gitlab.com/postmarketOS/pmaports/-/archive/${_commit_pmos}/pmaports-${_commit_pmos}.tar.gz?path=${_pmos_device}>pmos-scripts-${version}.tar.gz"
+checksum="d73200da438b6a5641ccd0e73f778cad07301c83b5bbf7286722c74a98675d2e"
+
+do_patch() {
+ patch "${_pmos_checkout}/90-modem-eg25.rules" -slNp1 -i "${PATCHESDIR}/vendor/modem-rules.patch"
+ vsed -i 's/postmarketOS/void/' "${_pmos_checkout}/setup-modem.sh"
+}
+
+do_install() {
+ vinstall "${_pmos_checkout}/90-modem-eg25.rules" 644 usr/lib/udev/rules.d
+ vinstall "${_pmos_checkout}/00_alsa_pinephone_dshare.conf" 644 etc/alsa/conf.d "00-alsa-pinephone-dshare.conf"
+ vbin "${_pmos_checkout}/setup-modem.sh" "pinephone_setup-modem"
+
+ vmkdir usr/share/alsa/ucm2
+ vcopy "${_pmos_checkout}/ucm" usr/share/alsa/ucm2/PinePhone
+
+ vlicense "${FILESDIR}/COPYING"
+}
From 67e5be2a524d6837f9ae4f6573d9c1c3f9967914 Mon Sep 17 00:00:00 2001
From: John Sullivan <jsullivan@csumb.edu>
Date: Fri, 5 Feb 2021 21:32:10 -0800
Subject: [PATCH 2/2] pinephone-base: get utilities from pinephone-utils
---
srcpkgs/pinephone-base/files/90-modem-eg25.rules | 5 -----
srcpkgs/pinephone-base/template | 8 ++------
2 files changed, 2 insertions(+), 11 deletions(-)
delete mode 100644 srcpkgs/pinephone-base/files/90-modem-eg25.rules
diff --git a/srcpkgs/pinephone-base/files/90-modem-eg25.rules b/srcpkgs/pinephone-base/files/90-modem-eg25.rules
deleted file mode 100644
index cd0031422cb..00000000000
--- a/srcpkgs/pinephone-base/files/90-modem-eg25.rules
+++ /dev/null
@@ -1,5 +0,0 @@
-SUBSYSTEMS=="usb", ENV{.LOCAL_ifNum}="$attr{bInterfaceNumber}"
-
-SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="01", SYMLINK+="EG25.NMEA", MODE="0660"
-SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="02", SYMLINK+="EG25.AT", MODE="0660"
-SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="03", SYMLINK+="EG25.MODEM", MODE="0660"
diff --git a/srcpkgs/pinephone-base/template b/srcpkgs/pinephone-base/template
index 6c750a92bd5..a4741e24cb7 100644
--- a/srcpkgs/pinephone-base/template
+++ b/srcpkgs/pinephone-base/template
@@ -1,15 +1,11 @@
# Template file for 'pinephone-base'
pkgname=pinephone-base
-version=0.1
+version=0.2
revision=1
archs="aarch64*"
build_style=meta
-depends="pinephone-kernel pinephone-uboot"
+depends="pinephone-kernel pinephone-uboot pinephone-utils"
short_desc="Void Linux PinePhone platform package"
maintainer="John Sullivan <jsullivan@csumb.edu>"
license="Public Domain"
homepage="https://www.voidlinux.org"
-
-do_install() {
- vinstall "${FILESDIR}/90-modem-eg25.rules" 644 usr/lib/udev/rules.d
-}
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR REVIEW] pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
` (21 preceding siblings ...)
2021-03-01 0:14 ` [PR PATCH] [Updated] " jjsullivan5196
@ 2021-03-01 0:15 ` jjsullivan5196
2021-03-01 0:15 ` jjsullivan5196
` (6 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2021-03-01 0:15 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 164 bytes --]
New review comment by jjsullivan5196 on void-packages repository
https://github.com/void-linux/void-packages/pull/25084#discussion_r584386881
Comment:
done :+1:
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR REVIEW] pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
` (22 preceding siblings ...)
2021-03-01 0:15 ` [PR REVIEW] " jjsullivan5196
@ 2021-03-01 0:15 ` jjsullivan5196
2021-03-01 0:17 ` the-maldridge
` (5 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2021-03-01 0:15 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 163 bytes --]
New review comment by jjsullivan5196 on void-packages repository
https://github.com/void-linux/void-packages/pull/25084#discussion_r584386950
Comment:
yep :+1:
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
` (23 preceding siblings ...)
2021-03-01 0:15 ` jjsullivan5196
@ 2021-03-01 0:17 ` the-maldridge
2021-03-01 0:18 ` [PR REVIEW] " jjsullivan5196
` (4 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: the-maldridge @ 2021-03-01 0:17 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 375 bytes --]
New comment by the-maldridge on void-packages repository
https://github.com/void-linux/void-packages/pull/25084#issuecomment-787554432
Comment:
Just an update on this. Pretty much all available maintainer effort is going into the openssl migration next weekend, but I have my shiny new pinephone and I'm looking at testing this PR when I get time, then it will be merged.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR REVIEW] pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
` (24 preceding siblings ...)
2021-03-01 0:17 ` the-maldridge
@ 2021-03-01 0:18 ` jjsullivan5196
2022-04-09 9:28 ` JamiKettunen
` (3 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2021-03-01 0:18 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 782 bytes --]
New review comment by jjsullivan5196 on void-packages repository
https://github.com/void-linux/void-packages/pull/25084#discussion_r584387362
Comment:
@ericonr Initially I took this out because I noticed this invocation didn't do anything, but that might be because the upstream script is 'broken' in a sense. The main parts of it are tested, but the variable which contains the path to the modem device file is unset https://gitlab.com/postmarketOS/pmaports/-/blob/master/device/main/device-pine64-pinephone/setup-modem.sh
This might have gone unnoticed, since the changes made by this script should be persistent until new settings are uploaded to the modem. I'll ask the pmos people about it, and try the script again myself. If nothing is wrong, I'll just kill this patch.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
` (25 preceding siblings ...)
2021-03-01 0:18 ` [PR REVIEW] " jjsullivan5196
@ 2022-04-09 9:28 ` JamiKettunen
2022-04-18 20:17 ` HadetTheUndying
` (2 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: JamiKettunen @ 2022-04-09 9:28 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 282 bytes --]
New comment by JamiKettunen on void-packages repository
https://github.com/void-linux/void-packages/pull/25084#issuecomment-1093837250
Comment:
Is this still getting tested and merged one day? I'm getting a PinePhone later this month and would love to mess around on Void with it
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
` (26 preceding siblings ...)
2022-04-09 9:28 ` JamiKettunen
@ 2022-04-18 20:17 ` HadetTheUndying
2022-07-19 2:14 ` github-actions
2022-08-07 2:13 ` [PR PATCH] [Closed]: " github-actions
29 siblings, 0 replies; 31+ messages in thread
From: HadetTheUndying @ 2022-04-18 20:17 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 521 bytes --]
New comment by HadetTheUndying on void-packages repository
https://github.com/void-linux/void-packages/pull/25084#issuecomment-1101726550
Comment:
My existing pinephone is having some power on issues right now, but intend to pre-order the Pro and would love to be running Void on it. Is there anything I can do to help while I wait on the Pro to ship? They're supposed to send me some emails about figuring out what exactly is wrong with my pmOS edition Pinephone so I might be able to get it back up and running soon.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
` (27 preceding siblings ...)
2022-04-18 20:17 ` HadetTheUndying
@ 2022-07-19 2:14 ` github-actions
2022-08-07 2:13 ` [PR PATCH] [Closed]: " github-actions
29 siblings, 0 replies; 31+ messages in thread
From: github-actions @ 2022-07-19 2:14 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 305 bytes --]
New comment by github-actions[bot] on void-packages repository
https://github.com/void-linux/void-packages/pull/25084#issuecomment-1188518644
Comment:
Pull Requests become stale 90 days after last activity and are closed 14 days after that. If this pull request is still relevant bump it or assign it.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR PATCH] [Closed]: pinephone: add support for modem setup and audio routing.
2020-09-25 9:18 [PR PATCH] pinephone: add support for modem setup and audio routing jjsullivan5196
` (28 preceding siblings ...)
2022-07-19 2:14 ` github-actions
@ 2022-08-07 2:13 ` github-actions
29 siblings, 0 replies; 31+ messages in thread
From: github-actions @ 2022-08-07 2:13 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 3162 bytes --]
There's a closed pull request on the void-packages repository
pinephone: add support for modem setup and audio routing.
https://github.com/void-linux/void-packages/pull/25084
Description:
This pull adds the necessary components for 4G modem usage, with the following use-cases in mind:
- Configure audio setup to and from modem
- Make and receive calls
- Send and read SMS
- Use mobile broadband/cellular data
- Wake-on-Modem (for calls and texts)
For now I've tested this with ModemManager+NetworkManager, but this also provides the groundwork for environments that use `ofono` (or just plain AT commands with `atinout` or `screen`, if you feel clever :^) )
To get started, you first need to run `pinephone_setup-modem` once as root to do the initial modem configuration. (chances are postmarketOS already did this if you booted the phone once, but this might need to be done again incase of potential data loss)
Some use-cases might require further configuration of software (eg specific to NetworkManager) but the setup script should do most of the needed work. Make sure modem is powered up by running `echo 1 > /sys/class/modem-power/modem-power/device/powered_blocking` Some examples of usage that I've tested below:
Read sms with `mmcli`
```sh
$ mmcli -s '/org/freedesktop/ModemManager1/SMS/2'
-----------------------------------
Content | number: '+5555555555'
| text: 'Test'
-----------------------------------
Properties | PDU type: 'deliver'
| state: 'received'
| storage: 'me'
| smsc: '+919810051829'
| timestamp: '160808142935+05'
```
Sample script for answering calls, using ModemManager dbus interface. Audio is setup thru `alsaucm`
```sh
#!/bin/bash
MM_IFACE="org.freedesktop.ModemManager1"
MATCH_CALLS="type='signal',sender='${MM_IFACE}',interface='${MM_IFACE}.Modem.Voice',member='CallAdded'"
do_accept() {
while read TYPE TIME SENDER HEADER
do
if [[ "$HEADER" = *"Modem.Voice"* ]]; then
read TYPE _P OBJ
OBJ=$(echo "${OBJ}" | tr -d '"')
echo "Pickup ${OBJ}"
alsaucm \
open PinePhone \
set _verb 'Voice Call' \
set _enadev 'Mic' \
set _enadev 'Earpiece'
dbus-send \
--system \
--dest="${MM_IFACE}" \
--print-reply \
"${OBJ}" \
"${MM_IFACE}.Call.Accept"
else
read
fi
done
}
dbus-monitor --system "${MATCH_CALLS}" | do_accept
```
Add a NetworkManager connection for LTE (sub `<operator_apn>` for your carrier's data APN)
```sh
$ nmcli c add type gsm ifname '*' con-name LTE apn <operator_apn>
```
For Wake-on-Modem: I tested by doing `loginctl suspend` from a sway session, then calling the phone. It wakes up within 2 rings.
fwiw: these examples are only good for making sure the hardware/software interface works. More work still needs to be done to get some telephony front-end software in the repo, like #24538 Sxmo also should work out-of-the box with the NetworkManager+ModemManager pair https://git.sr.ht/~mil/sxmo-docs
^ permalink raw reply [flat|nested] 31+ messages in thread