mirror of
https://github.com/miskcoo/ugreen_dx4600_leds_controller.git
synced 2025-07-23 12:23:09 +02:00
fix the duplicated calls of ugreen-probe-leds (#25)
Some checks failed
Build kernel module for TrueNAS / build-and-run (push) Has been cancelled
Some checks failed
Build kernel module for TrueNAS / build-and-run (push) Has been cancelled
This commit is contained in:
@@ -9,7 +9,13 @@ i2c_dev=$(i2cdetect -l | grep "SMBus I801 adapter" | grep -Po "i2c-\d+")
|
||||
|
||||
if [ $? = 0 ]; then
|
||||
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
|
||||
echo "I2C device not found!"
|
||||
fi
|
||||
|
Reference in New Issue
Block a user