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