phosh proximity sensor toggle script
#1
id | grep root || sudo $0
NUMBER=`cat /sys/module/stk3310/drivers/i2c\:stk3310/2-0048/iio\:device2/in_proximity_scale`
if [ $NUMBER = 0.100000 ]
then
  echo turning off
  echo 6.4 > /sys/module/stk3310/drivers/i2c\:stk3310/2-0048/iio\:device2/in_proximity_scale
else
  echo turning on
  echo 0.1 > /sys/module/stk3310/drivers/i2c\:stk3310/2-0048/iio\:device2/in_proximity_scale
fi

works for me under manjaro phosh, YMMV
if it doesnt work see if that "iio\:device2" became device 1 or 0 or ...

is there an easy way to tie this to an icon?
  Reply
#2
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

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
  Reply
#3
This isn't turning it off...

put "blacklist stk3310" inside "/etc/modprobe.d/proximity.conf" to permanently turn it off or do "sudo rmmod stk3310" to turn it off until reboot.
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Photo Mobian with X11 without Wayland and Phosh. Manieck71 0 1,401 09-09-2023, 07:35 AM
Last Post: Manieck71
  Proximity lock on Plasma Mobile alpineduck 0 1,291 08-14-2023, 05:51 PM
Last Post: alpineduck
  How to disable lock screen in Phosh? lat 14 16,621 03-31-2023, 04:17 AM
Last Post: Eugo
  Fedora + Phosh for PinePhone njha 74 151,044 12-12-2022, 10:19 PM
Last Post: wcdeich4@hotmail.com
  Enable 'upcoming-events' on Mobian/Phosh Korac 3 3,010 09-14-2022, 01:19 AM
Last Post: dukla2000
  Advise: ENABLE animations before updating phosh! Otherwise freezes and crashes! dante404 5 4,209 08-18-2022, 02:03 PM
Last Post: dante404
  Phosh message notifications issue itstoughtofocus 2 3,169 08-15-2022, 06:39 AM
Last Post: nemsys
  Building an image with phosh liara 1 2,198 02-01-2022, 08:26 AM
Last Post: kqlnut
  More useful terminal key layout for phosh's squeekboard Boern 21 30,905 01-15-2022, 02:35 PM
Last Post: gilwood
  Flat-file database script for pinephone terminal cabbie001 0 1,461 11-21-2021, 06:17 PM
Last Post: cabbie001

Forum Jump:


Users browsing this thread: 1 Guest(s)