first commit

This commit is contained in:
jack
2026-04-04 15:32:51 +08:00
commit a862314d94
34 changed files with 10253 additions and 0 deletions

24
i2c_scan.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
# i2c_scan_all.sh - 扫描当前系统所有 I2C 总线上的设备
set -e
if ! command -v i2cdetect >/dev/null 2>&1; then
echo "未找到 i2cdetect请先安装 i2c-tools"
echo " sudo apt install i2c-tools"
exit 1
fi
echo "列出 I2C 总线:"
i2cdetect -l
echo
buses=$(i2cdetect -l | awk '{print $1}' | sed 's/i2c-//')
for bus in $buses; do
echo "==============================="
echo "扫描 I2C bus $bus (/dev/i2c-$bus)"
echo "==============================="
i2cdetect -y "$bus"
echo
done