05-17-2021, 01:20 AM
Thank you for the script and the idea. Unfortunately, i don't know how to accomplish what you are looking for but i want to share my experience in toggling proximity sensor on my device.
> if it doesnt work see if that "iio\:device2" became device 1 or 0 or ...
In my case it was "iio\:device1"
I am also using Manjaro Phosh.
Additional note:
I had to run the command with sudo
sudo ./proximity-toggle.sh
The following is the script that toggles proximity sensor without problem:
[pp@pp-device ~]$ cat proximity-toggle.sh
> if it doesnt work see if that "iio\:device2" became device 1 or 0 or ...
In my case it was "iio\:device1"
I am also using Manjaro Phosh.
Additional note:
I had to run the command with sudo
sudo ./proximity-toggle.sh
The following is the script that toggles proximity sensor without problem:
[pp@pp-device ~]$ cat proximity-toggle.sh
Code:
id | grep root || sudo $0
NUMBER=`cat /sys/module/stk3310/drivers/i2c\:stk3310/2-0048/iio\:device1/in_proximity_scale`
if [ $NUMBER = 0.100000 ]
then
echo turning off
echo 6.4 > /sys/module/stk3310/drivers/i2c\:stk3310/2-0048/iio\:device1/in_proximity_scale
else
echo turning on
echo 0.1 > /sys/module/stk3310/drivers/i2c\:stk3310/2-0048/iio\:device1/in_proximity_scale
fi