1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#!/bin/bash read_mux_dev() { for _ in {1..3}; do if /usr/sbin/i2cget -f -y "$1" "$2" 2>/dev/null; then return 0 fi done return 1 } probe_sitv_pttv_mux() { if read_mux_dev 9 0x71; then echo pca9546 0x71 > /sys/bus/i2c/devices/i2c-9/new_device else echo pca9546 0x71 > /sys/bus/i2c/devices/i2c-11/new_device fi } probe_sitv_pttv_mux exit 0