How do I read a value from a system path?

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
GollyJer
Posts: 15
Joined: 19 Sep 2016 01:01

How do I read a value from a system path?

Post by GollyJer » 03 Oct 2016 17:17

I want to get the value (1 or 0) from this path.

Code: Select all

/sys/devices/virtual/graphics/fb0/hbm
I've messed around with Execute Root but am not getting it right.

Thanks!

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: How do I read a value from a system path?

Post by Martin » 04 Oct 2016 19:25

Hi,

You could probably use action Execute Root Command with command cat /sys/devices/virtual/graphics/fb0/hbm and then check the contents of variable stdout.
The result likely contains the value and a newline so following script in condition Expression could be used to check if the output is 0: trim(stdout)=="0"

Regards,
Martin

User avatar
GollyJer
Posts: 15
Joined: 19 Sep 2016 01:01

Re: How do I read a value from a system path?

Post by GollyJer » 05 Oct 2016 03:52

That worked perfectly. Thanks!

john.lasdas
Posts: 2
Joined: 27 Jan 2016 16:57

Re: How do I read a value from a system path?

Post by john.lasdas » 08 Oct 2016 06:27

Thank you GollyJer and Martin,

This solved the half of my problem too.

The other half problem is how I can modify the value of a path like this... (e.g. from Y to N) :?

Thanks

User avatar
GollyJer
Posts: 15
Joined: 19 Sep 2016 01:01

Re: How do I read a value from a system path?

Post by GollyJer » 08 Oct 2016 15:01

Hi John. Try this

Code: Select all

echo {your_desired_value} > /sys/devices/virtual/graphics/fb0/hbm

john.lasdas
Posts: 2
Joined: 27 Jan 2016 16:57

Re: How do I read a value from a system path?

Post by john.lasdas » 08 Oct 2016 15:35

GollyJer wrote:Hi John. Try this

Code: Select all

echo {your_desired_value} > /sys/devices/virtual/graphics/fb0/hbm

Thank you GollyJer,

Tried it with execute root command and it worked!

Post Reply