Created
June 11, 2023 14:47
-
-
Save ampaze/58e108d370101c8c72556e282702dd0d to your computer and use it in GitHub Desktop.
EDID based passthrough formats for Vero / Kodi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/udev/rules.d/999-passthrough-formats.rules | |
KERNEL=="hdmi_audio", ACTION=="change", ATTR{state}=="HDMI=1", RUN+="/bin/bash -c '/home/osmc/.kodi/userdata/passthrough-format-from-edid.sh %p >> /var/log/edit_passthrough_detection_errors.log 2>&1'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# /home/osmc/.kodi/userdata/passthrough-format-from-edid.sh | |
if [ -z "$1" ] | |
then | |
echo "Arg 1 must be the devpath" | |
exit 1; | |
fi | |
EDIDFILE="/sys$1/device/edid" | |
if [ ! -f "$EDIDFILE" ]; then | |
echo "$EDIDFILE does not exist." | |
exit 2; | |
fi | |
#date | |
declare -a FORMATS | |
declare -a SETTINGS | |
FORMATS[2]=ac3 | |
FORMATS[10]=eac3 | |
FORMATS[7]=dts | |
FORMATS[12]=truehd | |
FORMATS[11]=dtshd | |
FORMATIDS="" | |
for ID in ${!FORMATS[@]}; do | |
FORMATIDS+="$ID|" | |
SETTINGS[$ID]="false" | |
done | |
SUPPORTED=$(egrep -o "^\{(${FORMATIDS:0:-1}), " $EDIDFILE | sort -V -u) | |
ACTIVES="" | |
for ID in $SUPPORTED; do | |
ID=${ID:1:-1} | |
SETTINGS[$ID]="true" | |
ACTIVES+="${FORMATS[$ID]}, " | |
done | |
for id in ${!FORMATS[@]}; do | |
echo "{\"jsonrpc\":\"2.0\", \"method\":\"Settings.SetSettingValue\", \"params\":{\"setting\":\"audiooutput.${FORMATS[$id]}passthrough\",\"value\":${SETTINGS[$id]}}, \"id\":1}" > /dev/tcp/localhost/9090 | |
done | |
MESSAGE="Active for ${ACTIVES:0:-2}" | |
echo "{\"jsonrpc\":\"2.0\", \"method\":\"GUI.ShowNotification\", \"params\":{\"title\":\"Audio Passthrough\",\"message\":\"$MESSAGE\", \"displaytime\":10000}, \"id\":1}" > /dev/tcp/localhost/9090 | |
echo $MESSAGE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /lib/systemd/system/systemd-udevd.service | |
# add IPAddressAllow=localhost after IPAddressDeny=any | |
[Service] | |
... | |
IPAddressDeny=any | |
IPAddressAllow=localhost | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment