This thread contains a patchset. You're looking at the original emails,
but you may wish to use the patch review UI.
Review patch
7
5
[PATCH sxmo-utils] sxmo_audio.sh drop alsa support
Now that we support Pipewire and Pulseaudio, and that we automatically
determine available output ports, this is useless and badly supported.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
---
scripts/core/sxmo_audio.sh | 197 +++++ -------------
scripts/deviceprofiles/README.md | 9 -
...sxmo_deviceprofile_pine64,pinephone-1.2.sh | 1 -
3 files changed, 57 insertions(+), 150 deletions(-)
diff --git a/scripts/core/sxmo_audio.sh b/scripts/core/sxmo_audio.sh
index 0b7fcb0..f7fb81f 100755
--- a/scripts/core/sxmo_audio.sh
+++ b/scripts/core/sxmo_audio.sh
@@ -24,150 +24,150 @@ notifyvol() {
}
# adjust *output* vol/mute
- pulsevolup() {
+ volup() {
pactl set-sink-volume @DEFAULT_SINK@ +"${1:-5}%"
}
- pulsevoldown() {
+ voldown() {
pactl set-sink-volume @DEFAULT_SINK@ -"${1:-5}%"
}
- pulsevoltogglemute() {
+ voltogglemute() {
pactl set-sink-mute @DEFAULT_SINK@ toggle
}
- pulsevolismuted() {
+ volismuted() {
pactl get-sink-mute @DEFAULT_SINK@ | grep -q "Mute: yes"
}
- pulsevolget() {
- if pulsevolismuted; then
+ volget() {
+ if volismuted; then
printf "muted"
else
pactl get-sink-volume @DEFAULT_SINK@ | head -n1 | cut -d'/' -f2 | sed 's/ //g' | sed 's/\%//'
fi
}
- pulsevolset() {
+ volset() {
pactl set-sink-volume @DEFAULT_SINK@ "$1"%
}
# adjust *input* vol/mute
- pulsemicvolup() {
+ micvolup() {
pactl set-source-volume @DEFAULT_SOURCE@ +"${1:-5}%"
}
- pulsemicvoldown() {
+ micvoldown() {
pactl set-source-volume @DEFAULT_SOURCE@ -"${1:-5}%"
}
- pulsemictogglemute() {
+ mictogglemute() {
pactl set-source-mute @DEFAULT_SOURCE@ toggle
}
- pulsemicismuted() {
+ micismuted() {
pactl get-source-mute @DEFAULT_SOURCE@ | grep -q "Mute: yes"
}
- pulsemicvolget() {
- if pulsemicismuted; then
+ micvolget() {
+ if micismuted; then
printf "muted"
else
pactl get-source-volume @DEFAULT_SOURCE@ | head -n1 | cut -d'/' -f2 | sed 's/ //g' | sed 's/\%//'
fi
}
- pulsemicvolset() {
+ micvolset() {
pactl set-source-volume @DEFAULT_SOURCE@ "$1"%
}
# set the *active port* for output
- pulsedeviceset() {
+ deviceset() {
pactl set-sink-port @DEFAULT_SINK@ "[Out] $1"
}
# set the *active port* for input
- pulsedevicesetinput() {
+ devicesetinput() {
pactl set-source-port @DEFAULT_SOURCE@ "[In] $1"
}
# get the *active port* for input
- pulsedevicegetinput() {
+ devicegetinput() {
[ -z "$1" ] && default_source="$(pactl get-default-source)" || default_source="$1"
pactl --format=json list sources | jq -r ".[] | select(.name == \"$default_source\") | .active_port" | sed 's/\[In] //'
}
# get the *active port* for output
- pulsedeviceget() {
+ deviceget() {
[ -z "$1" ] && default_sink="$(pactl get-default-sink)" || default_sink="$1"
pactl --format=json list sinks | jq -r ".[] | select(.name == \"$default_sink\") | .active_port" | sed 's/\[Out] //'
}
# get the default sink
- pulsedevicegetdefaultsink() {
+ devicegetdefaultsink() {
pactl get-default-sink
}
# get the default source
- pulsedevicegetdefaultsource() {
+ devicegetdefaultsource() {
pactl get-default-source
}
- pulsesourceset() {
+ sourceset() {
pactl set-default-source "$1"
}
- pulsesinkset() {
+ sinkset() {
pactl set-default-sink "$1"
}
# get a list of sinks
- _pulsesinkssubmenu() {
+ _sinkssubmenu() {
[ -z "$1" ] && default_sink="$(pactl get-default-sink)" || default_sink="$1"
pactl --format=json list sinks | jq -r '.[] | .name, .description' | while read -r line; do
name="$line"
read -r description
if [ "$default_sink" = "$name" ]; then
- printf "%s %s %s ^ pulsesinkset %s\n" "$icon_chk" "$icon_spk" "$description" "$name"
+ printf "%s %s %s ^ sinkset %s\n" "$icon_chk" "$icon_spk" "$description" "$name"
else
- printf " %s %s ^ pulsesinkset %s\n" "$icon_spk" "$description" "$name"
+ printf " %s %s ^ sinkset %s\n" "$icon_spk" "$description" "$name"
fi
done
}
# get a list of output ports
- _pulseoutportssubmenu() {
+ _outportssubmenu() {
[ -z "$1" ] && default_sink="$(pactl get-default-sink)" || default_sink="$1"
- active_out_port="$(pulsedeviceget "$default_sink")"
+ active_out_port="$(deviceget "$default_sink")"
pactl --format=json list sinks | jq -r ".[] | select(.name == \"$default_sink\" ) | .ports[] | select(.availability != \"not available\" ) | .name" | sed 's/\[Out] //' | while read -r line; do
[ "$active_out_port" = "$line" ] && icon="$icon_ton" || icon="$icon_tof"
- printf " %s %s ^ pulsedeviceset %s\n" "$icon" "$line" "$line"
+ printf " %s %s ^ deviceset %s\n" "$icon" "$line" "$line"
done
}
# get a list of input sources
- _pulsesourcessubmenu() {
+ _sourcessubmenu() {
[ -z "$1" ] && default_source="$(pactl get-default-source)" || default_source="$1"
pactl --format=json list sources | jq -r '.[] | select (.monitor_source == "") | .name, .description' | while read -r line; do
name="$line"
read -r description
if [ "$default_source" = "$name" ]; then
- printf "%s %s %s ^ pulsesourceset %s\n" "$icon_chk" "$icon_mic" "$description" "$name"
+ printf "%s %s %s ^ sourceset %s\n" "$icon_chk" "$icon_mic" "$description" "$name"
else
- printf " %s %s ^ pulsesourceset %s\n" "$icon_mic" "$description" "$name"
+ printf " %s %s ^ sourceset %s\n" "$icon_mic" "$description" "$name"
fi
done
}
# get a list of input ports
- _pulseinportssubmenu() {
+ _inportssubmenu() {
# if the Headset is NOT plugged in, then do not display Headset
# as a option, as clicking on it causes pulse to unset the source!!
[ -z "$1" ] && default_source="$(pactl get-default-source)" || default_source="$1"
- active_in_port="$(pulsedevicegetinput "$default_source")"
+ active_in_port="$(devicegetinput "$default_source")"
pactl --format=json list sources | jq -r ".[] | select(.name == \"$default_source\" ) | .ports[] | select(.availability != \"not available\" ) | .name" | sed 's/\[In] //' | while read -r line; do
[ "$active_in_port" = "$line" ] && icon="$icon_ton" || icon="$icon_tof"
- printf " %s %s ^ pulsedevicesetinput %s\n" "$icon" "$line" "$line"
+ printf " %s %s ^ devicesetinput %s\n" "$icon" "$line" "$line"
done
}
@@ -197,136 +197,53 @@ _ringmodesubmenu() {
fi
}
- pulsemenuchoices() {
- cur_vol="$(pulsevolget)"
- cur_mic_vol="$(pulsemicvolget)"
- default_sink_name="$(pulsedevicegetdefaultsink)"
- default_source_name="$(pulsedevicegetdefaultsource)"
+ menuchoices() {
+ cur_vol="$(volget)"
+ cur_mic_vol="$(micvolget)"
+ default_sink_name="$(devicegetdefaultsink)"
+ default_source_name="$(devicegetdefaultsource)"
grep . <<EOF
$icon_cls Close Menu ^ exit
Output:
- $(_pulsesinkssubmenu "$default_sink_name")
+ $(_sinkssubmenu "$default_sink_name")
$(
if [ "$cur_vol" != "muted" ]; then
- printf " %s Volume (%s%%) ^ pulsevolup\n" "$icon_aru" "$cur_vol"
- printf " %s Volume (%s%%) ^ pulsevoldown\n" "$icon_ard" "$cur_vol"
- printf " %s Output Mute ^ pulsevoltogglemute\n" "$icon_tof"
+ printf " %s Volume (%s%%) ^ volup\n" "$icon_aru" "$cur_vol"
+ printf " %s Volume (%s%%) ^ voldown\n" "$icon_ard" "$cur_vol"
+ printf " %s Output Mute ^ voltogglemute\n" "$icon_tof"
else
- printf " %s Output Mute ^ pulsevoltogglemute\n" "$icon_ton"
+ printf " %s Output Mute ^ voltogglemute\n" "$icon_ton"
fi
)
- $(_pulseoutportssubmenu "$default_sink_name")
+ $(_outportssubmenu "$default_sink_name")
Input:
- $(_pulsesourcessubmenu "$default_source_name")
+ $(_sourcessubmenu "$default_source_name")
$(
if [ "$cur_mic_vol" != "muted" ]; then
- printf " %s Volume (%s%%) ^ pulsemicvolup\n" "$icon_aru" "$cur_mic_vol"
- printf " %s Volume (%s%%) ^ pulsemicvoldown\n" "$icon_ard" "$cur_mic_vol"
- printf " %s Input Mute ^ pulsemictogglemute\n" "$icon_tof"
+ printf " %s Volume (%s%%) ^ micvolup\n" "$icon_aru" "$cur_mic_vol"
+ printf " %s Volume (%s%%) ^ micvoldown\n" "$icon_ard" "$cur_mic_vol"
+ printf " %s Input Mute ^ mictogglemute\n" "$icon_tof"
else
- printf " %s Input Mute ^ pulsemictogglemute\n" "$icon_ton"
+ printf " %s Input Mute ^ mictogglemute\n" "$icon_ton"
fi
)
- $(_pulseinportssubmenu "$default_source_name")
+ $(_inportssubmenu "$default_source_name")
Call Options:
$(_callaudiodsubmenu)
$(_ringmodesubmenu)
EOF
}
- alsacurrentdevice() {
- if ! [ -f "$XDG_RUNTIME_DIR"/sxmo.audiocurrentdevice ]; then
- alsadeviceset "$SPEAKER"
- printf %s "$SPEAKER" > "$XDG_RUNTIME_DIR"/sxmo.audiocurrentdevice
- fi
-
- cat "$XDG_RUNTIME_DIR"/sxmo.audiocurrentdevice
- }
-
- amixerextractvol() {
- grep -oE '([0-9]+)%' |
- tr -d ' %' |
- awk '{ s += $1; c++ } END { print s/c }' |
- xargs printf %.0f
- }
-
- alsavolup() {
- amixer -c "${SXMO_ALSA_CONTROL_NAME:-0}" set "$(alsacurrentdevice)" "${1:-5}%+" | amixerextractvol | notifyvol -
- }
-
- alsavoldown() {
- amixer -c "${SXMO_ALSA_CONTROL_NAME:-0}" set "$(alsacurrentdevice)" "${1:-5}%-" | amixerextractvol | notifyvol -
- }
-
- alsavolget() {
- if [ -n "$(alsacurrentdevice)" ]; then
- amixer -c "${SXMO_ALSA_CONTROL_NAME:-0}" get "$(alsacurrentdevice)" | amixerextractvol
- fi
- }
-
- alsamicismuted() {
- echo "alsamicismuted: Not implemented">&2
- }
-
- alsadeviceget() {
- case "$(alsacurrentdevice)" in
- "$SPEAKER")
- printf "Speaker"
- ;;
- "$HEADPHONE")
- printf "Headphone"
- ;;
- "$EARPIECE")
- printf "Earpiece"
- ;;
- esac
- }
-
- alsamenuchoices() {
- CURRENTDEV="$(alsacurrentdevice)"
- cat <<EOF
- $icon_cls Close Menu ^ exit
- $icon_hdp Headphones $([ "$CURRENTDEV" = "Headphone" ] && echo "$icon_chk") ^ alsadeviceset Headphones
- $icon_spk Speaker $([ "$CURRENTDEV" = "Line Out" ] && echo "$icon_chk") ^ alsadeviceset Speaker
- $icon_phn Earpiece $([ "$CURRENTDEV" = "Earpiece" ] && echo "$icon_chk") ^ alsadeviceset Earpiece
- $icon_mut None $([ -z "$CURRENTDEV" ] && echo "$icon_chk") ^ alsadeviceset
- $icon_aru Volume up ^ alsavolup
- $icon_ard Volume down ^ alsavoldown
- $(_ringmodesubmenu)
- EOF
- }
-
- ispulse() {
- command -v pactl > /dev/null 2>&1 || return 1
- pactl info > /dev/null 2>&1 || return 1
- }
-
if [ -z "$*" ]; then
set -- menu
fi
- backend="$AUDIO_BACKEND"
- if [ -z "$backend" ]; then
- if ispulse; then
- backend=pulse
- else
- backend=alsa
- fi
- fi
-
- if [ "$backend" = "alsa" ]; then
- # set some alsa specific things
- SPEAKER="${SXMO_SPEAKER:-"Line Out"}"
- HEADPHONE="${SXMO_HEADPHONE:-"Headphone"}"
- EARPIECE="${SXMO_EARPIECE:-"Earpiece"}"
- fi
-
cmd="$1"
shift
case "$cmd" in
menu)
while : ; do
- CHOICES="$("$backend"menuchoices)"
+ CHOICES="$(menuchoices)"
PICKED="$(
printf "%s\n" "$CHOICES" |
cut -d'^' -f1 |
@@ -341,22 +258,22 @@ case "$cmd" in
vol)
verb="$1"
shift
- "$backend"vol"$verb" "$@"
+ vol"$verb" "$@"
;;
mic)
verb="$1"
shift
- "$backend"mic"$verb" "$@"
+ mic"$verb" "$@"
;;
device)
verb="$1"
shift
- "$backend"device"$verb" "$1"
+ device"$verb" "$1"
;;
notify)
- notifyvol "$("${backend}volget")"
+ notifyvol "$(volget)"
;;
micnotify)
- notifyvol "$("${backend}micvolget")"
+ notifyvol "$(micvolget)"
;;
esac
diff --git a/scripts/deviceprofiles/README.md b/scripts/deviceprofiles/README.md
index 7c00ccc..c6afe53 100644
--- a/scripts/deviceprofiles/README.md
+++ b/scripts/deviceprofiles/README.md
@@ -54,15 +54,6 @@ ### Screen-related
SXMO_SWAY_SCALE | Screen scale for hidpi screens. Can be fractional [SWAY-ONLY].
- ### Music-related
- SXMO_SPEAKER | Audio device name for the main speaker [default: Speaker]
-
- SXMO_EARPIECE | Audio device name for the earpiece speaker [default: Earpiece]
-
- SXMO_HEADPHONE | Audio device name for the headphones [default: Headphone]
-
- SXMO_ALSA_CONTROL_NAME | Alsa audio control name [default: 0]
-
### Input-related
SXMO_TOUCHSCREEN_ID | ID (from xinput) for the touchscreen device [DWM-ONLY] [default: 10]
diff --git a/scripts/deviceprofiles/sxmo_deviceprofile_pine64,pinephone-1.2.sh b/scripts/deviceprofiles/sxmo_deviceprofile_pine64,pinephone-1.2.sh
index eef1d72..21ae228 100755
--- a/scripts/deviceprofiles/sxmo_deviceprofile_pine64,pinephone-1.2.sh
+++ b/scripts/deviceprofiles/sxmo_deviceprofile_pine64,pinephone-1.2.sh
@@ -5,5 +5,4 @@
export SXMO_SYS_FILES="/sys/power/state /sys/devices/platform/soc/1f00000.rtc/power/wakeup /sys/power/mem_sleep /dev/rtc0 /sys/devices/platform/soc/1f03400.rsb/sunxi-rsb-3a3/axp221-pek/power/wakeup"
export SXMO_TOUCHSCREEN_ID=8
export SXMO_MONITOR="DSI-1"
- export SXMO_ALSA_CONTROL_NAME=PinePhone
export SXMO_SWAY_SCALE="2"
--
2.42.0
[sxmo-utils/patches/test.yml] build failed
I'm down with this...
On Tue, Aug 29, 2023 at 08:58:03PM +0200, Willow Barraco wrote:
>Now that we support Pipewire and Pulseaudio, and that we automatically
>determine available output ports, this is useless and badly supported.
>
>Signed-off-by: Willow Barraco <contact@willowbarraco.fr >
>---
> scripts/core/sxmo_audio.sh | 197 +++++-------------
> scripts/deviceprofiles/README.md | 9 -
> ...sxmo_deviceprofile_pine64,pinephone-1.2.sh | 1 -
> 3 files changed, 57 insertions(+), 150 deletions(-)
>
>diff --git a/scripts/core/sxmo_audio.sh b/scripts/core/sxmo_audio.sh
>index 0b7fcb0..f7fb81f 100755
>--- a/scripts/core/sxmo_audio.sh
>+++ b/scripts/core/sxmo_audio.sh
>@@ -24,150 +24,150 @@ notifyvol() {
> }
>
> # adjust *output* vol/mute
>-pulsevolup() {
>+volup() {
> pactl set-sink-volume @DEFAULT_SINK@ +"${1:-5}%"
> }
>
>-pulsevoldown() {
>+voldown() {
> pactl set-sink-volume @DEFAULT_SINK@ -"${1:-5}%"
> }
>
>-pulsevoltogglemute() {
>+voltogglemute() {
> pactl set-sink-mute @DEFAULT_SINK@ toggle
> }
>
>-pulsevolismuted() {
>+volismuted() {
> pactl get-sink-mute @DEFAULT_SINK@ | grep -q "Mute: yes"
> }
>
>-pulsevolget() {
>- if pulsevolismuted; then
>+volget() {
>+ if volismuted; then
> printf "muted"
> else
> pactl get-sink-volume @DEFAULT_SINK@ | head -n1 | cut -d'/' -f2 | sed 's/ //g' | sed 's/\%//'
> fi
> }
>
>-pulsevolset() {
>+volset() {
> pactl set-sink-volume @DEFAULT_SINK@ "$1"%
> }
>
> # adjust *input* vol/mute
>-pulsemicvolup() {
>+micvolup() {
> pactl set-source-volume @DEFAULT_SOURCE@ +"${1:-5}%"
> }
>
>-pulsemicvoldown() {
>+micvoldown() {
> pactl set-source-volume @DEFAULT_SOURCE@ -"${1:-5}%"
> }
>
>-pulsemictogglemute() {
>+mictogglemute() {
> pactl set-source-mute @DEFAULT_SOURCE@ toggle
> }
>
>-pulsemicismuted() {
>+micismuted() {
> pactl get-source-mute @DEFAULT_SOURCE@ | grep -q "Mute: yes"
> }
>
>-pulsemicvolget() {
>- if pulsemicismuted; then
>+micvolget() {
>+ if micismuted; then
> printf "muted"
> else
> pactl get-source-volume @DEFAULT_SOURCE@ | head -n1 | cut -d'/' -f2 | sed 's/ //g' | sed 's/\%//'
> fi
> }
>
>-pulsemicvolset() {
>+micvolset() {
> pactl set-source-volume @DEFAULT_SOURCE@ "$1"%
> }
>
> # set the *active port* for output
>-pulsedeviceset() {
>+deviceset() {
> pactl set-sink-port @DEFAULT_SINK@ "[Out] $1"
> }
>
> # set the *active port* for input
>-pulsedevicesetinput() {
>+devicesetinput() {
> pactl set-source-port @DEFAULT_SOURCE@ "[In] $1"
> }
>
> # get the *active port* for input
>-pulsedevicegetinput() {
>+devicegetinput() {
> [ -z "$1" ] && default_source="$(pactl get-default-source)" || default_source="$1"
> pactl --format=json list sources | jq -r ".[] | select(.name == \"$default_source\") | .active_port" | sed 's/\[In] //'
> }
>
> # get the *active port* for output
>-pulsedeviceget() {
>+deviceget() {
> [ -z "$1" ] && default_sink="$(pactl get-default-sink)" || default_sink="$1"
> pactl --format=json list sinks | jq -r ".[] | select(.name == \"$default_sink\") | .active_port" | sed 's/\[Out] //'
> }
>
> # get the default sink
>-pulsedevicegetdefaultsink() {
>+devicegetdefaultsink() {
> pactl get-default-sink
> }
>
> # get the default source
>-pulsedevicegetdefaultsource() {
>+devicegetdefaultsource() {
> pactl get-default-source
> }
>
>-pulsesourceset() {
>+sourceset() {
> pactl set-default-source "$1"
> }
>
>-pulsesinkset() {
>+sinkset() {
> pactl set-default-sink "$1"
> }
>
> # get a list of sinks
>-_pulsesinkssubmenu() {
>+_sinkssubmenu() {
> [ -z "$1" ] && default_sink="$(pactl get-default-sink)" || default_sink="$1"
> pactl --format=json list sinks | jq -r '.[] | .name, .description' | while read -r line; do
> name="$line"
> read -r description
> if [ "$default_sink" = "$name" ]; then
>- printf "%s %s %s ^ pulsesinkset %s\n" "$icon_chk" "$icon_spk" "$description" "$name"
>+ printf "%s %s %s ^ sinkset %s\n" "$icon_chk" "$icon_spk" "$description" "$name"
> else
>- printf " %s %s ^ pulsesinkset %s\n" "$icon_spk" "$description" "$name"
>+ printf " %s %s ^ sinkset %s\n" "$icon_spk" "$description" "$name"
> fi
> done
> }
>
> # get a list of output ports
>-_pulseoutportssubmenu() {
>+_outportssubmenu() {
> [ -z "$1" ] && default_sink="$(pactl get-default-sink)" || default_sink="$1"
>- active_out_port="$(pulsedeviceget "$default_sink")"
>+ active_out_port="$(deviceget "$default_sink")"
> pactl --format=json list sinks | jq -r ".[] | select(.name == \"$default_sink\" ) | .ports[] | select(.availability != \"not available\" ) | .name" | sed 's/\[Out] //' | while read -r line; do
> [ "$active_out_port" = "$line" ] && icon="$icon_ton" || icon="$icon_tof"
>- printf " %s %s ^ pulsedeviceset %s\n" "$icon" "$line" "$line"
>+ printf " %s %s ^ deviceset %s\n" "$icon" "$line" "$line"
> done
> }
>
> # get a list of input sources
>-_pulsesourcessubmenu() {
>+_sourcessubmenu() {
> [ -z "$1" ] && default_source="$(pactl get-default-source)" || default_source="$1"
> pactl --format=json list sources | jq -r '.[] | select (.monitor_source == "") | .name, .description' | while read -r line; do
> name="$line"
> read -r description
> if [ "$default_source" = "$name" ]; then
>- printf "%s %s %s ^ pulsesourceset %s\n" "$icon_chk" "$icon_mic" "$description" "$name"
>+ printf "%s %s %s ^ sourceset %s\n" "$icon_chk" "$icon_mic" "$description" "$name"
> else
>- printf " %s %s ^ pulsesourceset %s\n" "$icon_mic" "$description" "$name"
>+ printf " %s %s ^ sourceset %s\n" "$icon_mic" "$description" "$name"
> fi
> done
> }
>
> # get a list of input ports
>-_pulseinportssubmenu() {
>+_inportssubmenu() {
> # if the Headset is NOT plugged in, then do not display Headset
> # as a option, as clicking on it causes pulse to unset the source!!
> [ -z "$1" ] && default_source="$(pactl get-default-source)" || default_source="$1"
>- active_in_port="$(pulsedevicegetinput "$default_source")"
>+ active_in_port="$(devicegetinput "$default_source")"
> pactl --format=json list sources | jq -r ".[] | select(.name == \"$default_source\" ) | .ports[] | select(.availability != \"not available\" ) | .name" | sed 's/\[In] //' | while read -r line; do
> [ "$active_in_port" = "$line" ] && icon="$icon_ton" || icon="$icon_tof"
>- printf " %s %s ^ pulsedevicesetinput %s\n" "$icon" "$line" "$line"
>+ printf " %s %s ^ devicesetinput %s\n" "$icon" "$line" "$line"
> done
> }
>
>@@ -197,136 +197,53 @@ _ringmodesubmenu() {
> fi
> }
>
>-pulsemenuchoices() {
>-cur_vol="$(pulsevolget)"
>-cur_mic_vol="$(pulsemicvolget)"
>-default_sink_name="$(pulsedevicegetdefaultsink)"
>-default_source_name="$(pulsedevicegetdefaultsource)"
>+menuchoices() {
>+cur_vol="$(volget)"
>+cur_mic_vol="$(micvolget)"
>+default_sink_name="$(devicegetdefaultsink)"
>+default_source_name="$(devicegetdefaultsource)"
> grep . <<EOF
> $icon_cls Close Menu ^ exit
> Output:
>-$(_pulsesinkssubmenu "$default_sink_name")
>+$(_sinkssubmenu "$default_sink_name")
> $(
> if [ "$cur_vol" != "muted" ]; then
>- printf " %s Volume (%s%%) ^ pulsevolup\n" "$icon_aru" "$cur_vol"
>- printf " %s Volume (%s%%) ^ pulsevoldown\n" "$icon_ard" "$cur_vol"
>- printf " %s Output Mute ^ pulsevoltogglemute\n" "$icon_tof"
>+ printf " %s Volume (%s%%) ^ volup\n" "$icon_aru" "$cur_vol"
>+ printf " %s Volume (%s%%) ^ voldown\n" "$icon_ard" "$cur_vol"
>+ printf " %s Output Mute ^ voltogglemute\n" "$icon_tof"
> else
>- printf " %s Output Mute ^ pulsevoltogglemute\n" "$icon_ton"
>+ printf " %s Output Mute ^ voltogglemute\n" "$icon_ton"
> fi
> )
>-$(_pulseoutportssubmenu "$default_sink_name")
>+$(_outportssubmenu "$default_sink_name")
> Input:
>-$(_pulsesourcessubmenu "$default_source_name")
>+$(_sourcessubmenu "$default_source_name")
> $(
> if [ "$cur_mic_vol" != "muted" ]; then
>- printf " %s Volume (%s%%) ^ pulsemicvolup\n" "$icon_aru" "$cur_mic_vol"
>- printf " %s Volume (%s%%) ^ pulsemicvoldown\n" "$icon_ard" "$cur_mic_vol"
>- printf " %s Input Mute ^ pulsemictogglemute\n" "$icon_tof"
>+ printf " %s Volume (%s%%) ^ micvolup\n" "$icon_aru" "$cur_mic_vol"
>+ printf " %s Volume (%s%%) ^ micvoldown\n" "$icon_ard" "$cur_mic_vol"
>+ printf " %s Input Mute ^ mictogglemute\n" "$icon_tof"
> else
>- printf " %s Input Mute ^ pulsemictogglemute\n" "$icon_ton"
>+ printf " %s Input Mute ^ mictogglemute\n" "$icon_ton"
> fi
> )
>-$(_pulseinportssubmenu "$default_source_name")
>+$(_inportssubmenu "$default_source_name")
> Call Options:
> $(_callaudiodsubmenu)
> $(_ringmodesubmenu)
> EOF
> }
>
>-alsacurrentdevice() {
>- if ! [ -f "$XDG_RUNTIME_DIR"/sxmo.audiocurrentdevice ]; then
>- alsadeviceset "$SPEAKER"
>- printf %s "$SPEAKER" > "$XDG_RUNTIME_DIR"/sxmo.audiocurrentdevice
>- fi
>-
>- cat "$XDG_RUNTIME_DIR"/sxmo.audiocurrentdevice
>-}
>-
>-amixerextractvol() {
>- grep -oE '([0-9]+)%' |
>- tr -d ' %' |
>- awk '{ s += $1; c++ } END { print s/c }' |
>- xargs printf %.0f
>-}
>-
>-alsavolup() {
>- amixer -c "${SXMO_ALSA_CONTROL_NAME:-0}" set "$(alsacurrentdevice)" "${1:-5}%+" | amixerextractvol | notifyvol -
>-}
>-
>-alsavoldown() {
>- amixer -c "${SXMO_ALSA_CONTROL_NAME:-0}" set "$(alsacurrentdevice)" "${1:-5}%-" | amixerextractvol | notifyvol -
>-}
>-
>-alsavolget() {
>- if [ -n "$(alsacurrentdevice)" ]; then
>- amixer -c "${SXMO_ALSA_CONTROL_NAME:-0}" get "$(alsacurrentdevice)" | amixerextractvol
>- fi
>-}
>-
>-alsamicismuted() {
>- echo "alsamicismuted: Not implemented">&2
>-}
>-
>-alsadeviceget() {
>- case "$(alsacurrentdevice)" in
>- "$SPEAKER")
>- printf "Speaker"
>- ;;
>- "$HEADPHONE")
>- printf "Headphone"
>- ;;
>- "$EARPIECE")
>- printf "Earpiece"
>- ;;
>- esac
>-}
>-
>-alsamenuchoices() {
>- CURRENTDEV="$(alsacurrentdevice)"
>- cat <<EOF
>-$icon_cls Close Menu ^ exit
>-$icon_hdp Headphones $([ "$CURRENTDEV" = "Headphone" ] && echo "$icon_chk") ^ alsadeviceset Headphones
>-$icon_spk Speaker $([ "$CURRENTDEV" = "Line Out" ] && echo "$icon_chk") ^ alsadeviceset Speaker
>-$icon_phn Earpiece $([ "$CURRENTDEV" = "Earpiece" ] && echo "$icon_chk") ^ alsadeviceset Earpiece
>-$icon_mut None $([ -z "$CURRENTDEV" ] && echo "$icon_chk") ^ alsadeviceset
>-$icon_aru Volume up ^ alsavolup
>-$icon_ard Volume down ^ alsavoldown
>-$(_ringmodesubmenu)
>-EOF
>-}
>-
>-ispulse() {
>- command -v pactl > /dev/null 2>&1 || return 1
>- pactl info > /dev/null 2>&1 || return 1
>-}
>-
> if [ -z "$*" ]; then
> set -- menu
> fi
>
>-backend="$AUDIO_BACKEND"
>-if [ -z "$backend" ]; then
>- if ispulse; then
>- backend=pulse
>- else
>- backend=alsa
>- fi
>-fi
>-
>-if [ "$backend" = "alsa" ]; then
>- # set some alsa specific things
>- SPEAKER="${SXMO_SPEAKER:-"Line Out"}"
>- HEADPHONE="${SXMO_HEADPHONE:-"Headphone"}"
>- EARPIECE="${SXMO_EARPIECE:-"Earpiece"}"
>-fi
>-
> cmd="$1"
> shift
> case "$cmd" in
> menu)
> while : ; do
>- CHOICES="$("$backend"menuchoices)"
>+ CHOICES="$(menuchoices)"
> PICKED="$(
> printf "%s\n" "$CHOICES" |
> cut -d'^' -f1 |
>@@ -341,22 +258,22 @@ case "$cmd" in
> vol)
> verb="$1"
> shift
>- "$backend"vol"$verb" "$@"
>+ vol"$verb" "$@"
> ;;
> mic)
> verb="$1"
> shift
>- "$backend"mic"$verb" "$@"
>+ mic"$verb" "$@"
> ;;
> device)
> verb="$1"
> shift
>- "$backend"device"$verb" "$1"
>+ device"$verb" "$1"
> ;;
> notify)
>- notifyvol "$("${backend}volget")"
>+ notifyvol "$(volget)"
> ;;
> micnotify)
>- notifyvol "$("${backend}micvolget")"
>+ notifyvol "$(micvolget)"
> ;;
> esac
>diff --git a/scripts/deviceprofiles/README.md b/scripts/deviceprofiles/README.md
>index 7c00ccc..c6afe53 100644
>--- a/scripts/deviceprofiles/README.md
>+++ b/scripts/deviceprofiles/README.md
>@@ -54,15 +54,6 @@ ### Screen-related
>
> SXMO_SWAY_SCALE | Screen scale for hidpi screens. Can be fractional [SWAY-ONLY].
>
>-### Music-related
>-SXMO_SPEAKER | Audio device name for the main speaker [default: Speaker]
>-
>-SXMO_EARPIECE | Audio device name for the earpiece speaker [default: Earpiece]
>-
>-SXMO_HEADPHONE | Audio device name for the headphones [default: Headphone]
>-
>-SXMO_ALSA_CONTROL_NAME | Alsa audio control name [default: 0]
>-
> ### Input-related
> SXMO_TOUCHSCREEN_ID | ID (from xinput) for the touchscreen device [DWM-ONLY] [default: 10]
>
>diff --git a/scripts/deviceprofiles/sxmo_deviceprofile_pine64,pinephone-1.2.sh b/scripts/deviceprofiles/sxmo_deviceprofile_pine64,pinephone-1.2.sh
>index eef1d72..21ae228 100755
>--- a/scripts/deviceprofiles/sxmo_deviceprofile_pine64,pinephone-1.2.sh
>+++ b/scripts/deviceprofiles/sxmo_deviceprofile_pine64,pinephone-1.2.sh
>@@ -5,5 +5,4 @@
> export SXMO_SYS_FILES="/sys/power/state /sys/devices/platform/soc/1f00000.rtc/power/wakeup /sys/power/mem_sleep /dev/rtc0 /sys/devices/platform/soc/1f03400.rsb/sunxi-rsb-3a3/axp221-pek/power/wakeup"
> export SXMO_TOUCHSCREEN_ID=8
> export SXMO_MONITOR="DSI-1"
>-export SXMO_ALSA_CONTROL_NAME=PinePhone
> export SXMO_SWAY_SCALE="2"
>--
>2.42.0
>
--
sic dicit magister P
https://phartman.sites.luc.edu/
GPG keyID 0xE0DBD3D6 (CAE6 3A6F 755F 7BC3 36CA 330D B3E6 39C6 E0DB D3D6)
> I'm down with this...
wdym?
On Wed Aug 30, 2023 at 10:20 AM CEST, Willow Barraco wrote:
> > I'm down with this...
>
> wdym?
That's means he's ok with the change. I am too, it simplifies stuff if
we don't have to maintain bare alsa support.
On Wed, Aug 30, 2023 at 12:24:29PM +0200, Maarten van Gompel wrote:
>On Wed Aug 30, 2023 at 10:20 AM CEST, Willow Barraco wrote:
>> > I'm down with this...
>>
>> wdym?
>
>That's means he's ok with the change. I am too, it simplifies stuff if
>we don't have to maintain bare alsa support.
Yeah! I've been dreaming of the day we can drop alsa support :D IIRC
the Poco F1 needed alsa stuff for a bit but I think those days are over.
--
sic dicit magister P
https://phartman.sites.luc.edu/
GPG keyID 0xE0DBD3D6 (CAE6 3A6F 755F 7BC3 36CA 330D B3E6 39C6 E0DB D3D6)
> >> > I'm down with this...
> >>
> >> wdym?
> >
> >That's means he's ok with the change. I am too, it simplifies stuff if
> >we don't have to maintain bare alsa support.
>
> Yeah! I've been dreaming of the day we can drop alsa support :D IIRC
> the Poco F1 needed alsa stuff for a bit but I think those days are over.
I'm glad you agree! I let you double checked I didn't messed up, and to
apply this upstream. I'm running it for sometime so it should be great.
I've been running this for a bit and it seems okay.
However, on my Oneplus 6 I hear no call audio for some reason (most probably
entirely unrelated to this patch as it was also the case before this
patch, I still need to investigate that further).