fix the duplicated calls of ugreen-probe-leds (#25)
Some checks failed
Build kernel module for TrueNAS / build-and-run (push) Has been cancelled

This commit is contained in:
Yuhao Zhou
2024-10-03 01:59:58 +08:00
parent 92b33134a5
commit 8587b51e76

View File

@@ -9,7 +9,13 @@ i2c_dev=$(i2cdetect -l | grep "SMBus I801 adapter" | grep -Po "i2c-\d+")
if [ $? = 0 ]; then if [ $? = 0 ]; then
echo "Found I2C device /dev/${i2c_dev}" echo "Found I2C device /dev/${i2c_dev}"
echo "led-ugreen 0x3a" > /sys/bus/i2c/devices/${i2c_dev}/new_device 2>/dev/null || true dev_path=/sys/bus/i2c/devices/$i2c_dev/${i2c_dev/i2c-/}-003a
if [ ! -d $dev_path ]; then
echo "led-ugreen 0x3a" > /sys/bus/i2c/devices/${i2c_dev}/new_device
elif [ "$(cat $dev_path/name)" != "led-ugreen" ]; then
echo "ERROR: the device ${i2c_dev/i2c-/}-003a has been registered as $(cat $dev_path/name)"
exit 1
fi
else else
echo "I2C device not found!" echo "I2C device not found!"
fi fi