Skip to content

Commit

Permalink
v6.29
Browse files Browse the repository at this point in the history
+ DietPi-Set_hardware | rpi-opengl: Be more strict on arguments, only allow the two explicit valid overlays
+ DietPi-Set_hardware | rpi-opengl: Install libegl1 as well, to have all possible OpenGL output variants supported OOTB
+ DietPi-Set_hardware | soundcard: Fix wrong ALSA state file being removed
+ DietPi-Set_hardware | soundcard on RPi: Fix wrong card index increment when vc4-fkms-v3d overlay has been added, since only the full KMS driver adds the vc4hdmi sound device: #3356 (comment)
+ DietPi-Set_hardware | Tiny coding and alignment
  • Loading branch information
MichaIng authored Jan 24, 2020
1 parent 5d66819 commit d2ad522
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions dietpi/func/dietpi-set_hardware
Original file line number Diff line number Diff line change
Expand Up @@ -597,10 +597,12 @@ _EOF_
# Always remove previous vc4 overlay entry
sed -i '/^[[:blank:]]*dtoverlay=vc4-/d' $FP_RPI_CONFIG

if [[ $INPUT_DEVICE_VALUE == 'vc4-'* ]]; then
if [[ $INPUT_DEVICE_VALUE == 'vc4-kms-v3d' || $INPUT_DEVICE_VALUE == 'vc4-fkms-v3d' ]]; then

# GL packages
G_AG_CHECK_INSTALL_PREREQ libgl1-mesa-dri libgles2 mesa-utils
local libegl1='libegl1'
(( $G_DISTRO < 5 )) && libegl1+='-mesa'
G_AG_CHECK_INSTALL_PREREQ libgl1-mesa-dri libgles2 $libegl1 mesa-utils

G_CONFIG_INJECT "dtoverlay=$INPUT_DEVICE_VALUE" "dtoverlay=$INPUT_DEVICE_VALUE" $FP_RPI_CONFIG

Expand Down Expand Up @@ -1656,7 +1658,7 @@ Do you want to continue and DISABLE Bluetooth now?'; then
[[ -f '/etc/asound.conf' ]] && rm /etc/asound.conf

# - Remove previously stored alsactl state
[[ -f '/var/lib/alsa/state' ]] && rm /var/lib/alsa/state
[[ -f '/var/lib/alsa/asound.state' ]] && rm /var/lib/alsa/asound.state

# - Reset active alsactl/amixer state
[[ $INPUT_DEVICE_VALUE != 'none' ]] && alsactl -g init
Expand Down Expand Up @@ -1815,30 +1817,30 @@ Do you want to continue and DISABLE Bluetooth now?'; then

ALSA_EQ_ENABLED=1

# - Remove -eq from string so it doesn't get sent as a dtoverlay= on rpi and dietpi.txt entry
# Remove -eq from string so it doesn't get sent as a dtoverlay= on rpi and dietpi.txt entry
INPUT_DEVICE_VALUE=${INPUT_DEVICE_VALUE%-eq}

fi

# - RPi: Quick workaround for vc4 taking card 0: https://github.com/MichaIng/DietPi/issues/2173
(( $G_HW_MODEL < 10 )) && grep -q '^[[:blank:]]*dtoverlay=vc4-' $FP_RPI_CONFIG && ((SOUNDCARD_TARGET_CARD++))
# - RPi: Quick workaround for dtoverlay=vc4-kms-v3d taking card 0: https://github.com/MichaIng/DietPi/issues/3356#issuecomment-578215611
(( $G_HW_MODEL < 10 )) && grep -q '^[[:blank:]]*dtoverlay=vc4-kms-v3d' $FP_RPI_CONFIG && ((SOUNDCARD_TARGET_CARD++))

# - Cards
case "$INPUT_DEVICE_VALUE" in

# --------------- Generic ---------------
# - Specific card + device, e.g. from auto-detection
# Specific card + device, e.g. from auto-detection
hw:*)

SOUNDCARD_TARGET_CARD=$(mawk -F, '{print $1}' <<< ${INPUT_DEVICE_VALUE#hw:})
SOUNDCARD_TARGET_DEVICE=$(mawk -F, '{print $2}' <<< ${INPUT_DEVICE_VALUE#hw:})

;;

# - Auto detect USB DAC
# Auto detect USB DAC
usb-dac*)

local usb_detection_card_index=$(aplay -l | mawk '/USB Audio/ {print $2;exit}' | sed 's/://g')
local usb_detection_card_index=$(aplay -l | mawk '/USB Audio/{print $2;exit}' | sed 's/://g')
if disable_error=1 G_CHECK_VALIDINT "$usb_detection_card_index"; then

SOUNDCARD_TARGET_CARD=$usb_detection_card_index
Expand All @@ -1848,7 +1850,7 @@ Do you want to continue and DISABLE Bluetooth now?'; then
if (( $G_HW_MODEL == 70 )); then

# - USB 1.1 compat mode (Sparky currently)
[[ $INPUT_DEVICE_VALUE == *'1.1' ]] && sed -i 's/aotg.aotg1_speed=0/aotg.aotg1_speed=1/' $FP_UENV
[[ $INPUT_DEVICE_VALUE == *'1.1' ]] && sed -i 's/aotg\.aotg1_speed=0/aotg.aotg1_speed=1/' $FP_UENV

# - Unmute all (re: @sudeep)
for x in $(amixer -c $SOUNDCARD_TARGET_CARD controls | grep layback)
Expand All @@ -1870,7 +1872,7 @@ _EOF_

fi

# - Not found
# Not found
else

G_DIETPI-NOTIFY 1 'Unable to find a USB DAC on your system, reverting to "none"...'
Expand Down Expand Up @@ -1921,7 +1923,7 @@ _EOF_
SOUNDCARD_TARGET_CARD=0
SOUNDCARD_TARGET_DEVICE=0

# - Vol
# Vol
amixer –c 0 set 'DAC PA' 35

if [[ $INPUT_DEVICE_VALUE == 'allo-cheapo-analogue' ]]; then
Expand All @@ -1944,12 +1946,12 @@ _EOF_
# rpi-bcm2835-3.5mm
rpi-bcm2835*)

# - Enable onboard audio dtparm
# Enable onboard audio dtparm
G_CONFIG_INJECT 'dtparam=audio=' 'dtparam=audio=on' $FP_RPI_CONFIG
dtparam audio=on
sleep 1 # Allow hardware to init

# - Force 3.5mm out?
# Force 3.5mm out?
if [[ $INPUT_DEVICE_VALUE == *'3.5mm' ]]; then

amixer -c $SOUNDCARD_TARGET_CARD cset numid=3 1
Expand Down

0 comments on commit d2ad522

Please sign in to comment.