Need help with shell script permission denied

Xaon420

New member
Shell script(no root):
cat /sys/class/sensors/light_sensor

Output:
cat: /sys/class/sensors/light_sensor: Permission denied

How the In the world do I get permission for it? Apps can read these sensors fine.

Any help is greatly appreciated and will try it or someway to read the lightsensor without using a trigger or constraint.

Edit: so even LS -a Returns this(Screenshot1)
 

Attachments

  • Screenshot_20220213-095947_Termux.jpg
    Screenshot_20220213-095947_Termux.jpg
    363.4 KB · Views: 6
Last edited:

FrameXX

Well-known member
I tryed and in my /sys/ directory there's no sensors folder. I could find sensors folder in /mnt/vendor/persist/ and there was nothing readable. Without root, my explorer is not even able to read in /sys/ folder, so that's propably the reason.
 
Last edited:

tanutanu

Well-known member
Shell script(no root):
cat /sys/class/sensors/light_sensor

Output:
cat: /sys/class/sensors/light_sensor: Permission denied

How the In the world do I get permission for it? Apps can read these sensors fine.

Any help is greatly appreciated and will try it or someway to read the lightsensor without using a trigger or constraint.
You can access via Termux api instead.
 

Attachments

  • Screenshot_20211020-191934_copy_1080x550.png
    Screenshot_20211020-191934_copy_1080x550.png
    15.2 KB · Views: 16

Xaon420

New member
You can access via Termux api instead.
Have tried but I still get permission error, and cat should be okay but is there anything else that can read sensors(light specifically) and return it to a file or macrodroid?

With a file: I can read whatever is in it, however I still can't read the sensor using cat

Using shell script to read sensors: needs permissions to read folder at all
 

Xaon420

New member
I tryed and in my /sys/ directory there's no sensors folder. I could find sensors folder in /mnt/vendor/persist/ and there was nothing readable. Without root, my explorer is not even able to read in /sys/ folder, so that's propably the reason.
Will try this, but do you know anyway I can find/look through these folders without "My files" app? As I had no idea there was a chance for it to be out of the /sys/ folder

Edit:
using:
cat /mnt/vendor/persist/
returns the Following again:
 

Attachments

  • Screenshot_20220213-092712_MacroDroid.jpg
    Screenshot_20220213-092712_MacroDroid.jpg
    336.5 KB · Views: 18

FrameXX

Well-known member
Will try this, but do you know anyway I can find/look through these folders without "My files" app? As I had no idea there was a chance for it to be out of the /sys/ folder

Edit:
using:
cat /mnt/vendor/persist/
returns the Following again:

I am using MiXplorer to check in root directories. If you are android 11 or higher always make sure to check use helper app checkbox. MacroDroid currently hasn't all file access, so I doubt it has any possibility to access root folder.
 
Last edited:

tanutanu

Well-known member
Have tried but I still get permission error, and cat should be okay but is there anything else that can read sensors(light specifically) and return it to a file or macrodroid?

With a file: I can read whatever is in it, however I still can't read the sensor using cat

Using shell script to read sensors: needs permissions to read folder at all
Follow the instruction please:)
 
Top