summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2023-01-19 19:59:06 +0300
committerEvgeny Zinoviev <me@ch1p.io>2023-01-19 19:59:06 +0300
commit110f1619acbeb50ed86fb5eecde364ac99e45dff (patch)
treeee0ba3553dfa666a16fcd05a81a0ffe12f5bf22f /tools
parentec1e287bf129b3c4b91b565e0334009b72f6e928 (diff)
parent53d231b44d552a2ffeadd35e7f490fe5d55993e6 (diff)
Merge branch 'master' of ch1p.io:homekit
Diffstat (limited to 'tools')
-rw-r--r--tools/sunxi-h3-i2c-reset.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/sunxi-h3-i2c-reset.sh b/tools/sunxi-h3-i2c-reset.sh
new file mode 100644
index 0000000..e654dfb
--- /dev/null
+++ b/tools/sunxi-h3-i2c-reset.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+devices="1c2ac00.i2c 1c2b000.i2c"
+pins="8 9 28 30"
+driver_path="/sys/bus/platform/drivers/mv64xxx_i2c"
+
+driver_unbind() {
+ echo -n "$1" > "$driver_path/unbind"
+}
+
+driver_bind() {
+ echo -n "$1" > "$driver_path/bind"
+}
+
+for dev in $devices; do driver_unbind "$dev"; done
+echo "unbind done"
+
+for pin in pins; do
+ gpio mode $pin out
+ gpio write $pin 0
+done
+echo "gpio reset done"
+
+for dev in $devices; do driver_bind "$dev"; done
+echo "bind done" \ No newline at end of file