Jump to content

Interesting/useful sysfs settings (use on your own risk)


Recommended Posts

In this topic, which I'll update every time I find something useful, I will share configurations that are safe and configurations that are risky that you can try yourself on your own PRO¹-X.

Everything shown here requires system permissions. The only way for you to get system permissions is by rooting the phone. There's no way around. That's how Android works.

Because these are settings using sysfs. By design, they are temporary. Rebooting your phone will reset them to their default values. If you break something and you don't know how or what, one way that usually solves it is shutting down and then booting normally.

Reading & writing:

The most common ways to read and write to sysfs is by using cat and echo with redirections. You can also use tee for writing, in replacement of echo.

Examples:

Reading:

cat /sys/path/to/attr

echo Writing:

echo 1 > /sys/path/to/attr

tee Writing:

<<< "1" tee /sys/path/to/attr

The <<< just tells the shell to input that value to the command (tee, in this case).

Safe

These settings are safe for you to try out. Even if you use large values or out of bounds values, it shouldn't brick or break your phone in any way.

Do be careful that next to safe elements to write to, there are unsafe elements. DO NOT TOUCH THOSE IF YOU DON'T KNOW WHAT YOU ARE DOING!

With that out of the way, here's the information for sharing:

Suspend power input (also, battery charging)

You can temporarily suspend battery charging (good use of this feature improves battery life).
This suspends power input (and battery charging, by consequence):

echo 1 > /sys/class/power_supply/battery/input_suspend

 This restores power input (its default):

echo 0 > /sys/class/power_supply/battery/input_suspend

 Manually control keyboard light

You can manually control the keyboard backlight. Do note that system programs can also control the keyboard backlight. So, they can change this value themselves.
Turn on the keyboard backlight:

echo 1 > /sys/class/leds/button-backlight/brightness

Turn off keyboard backlight:

echo 0 > /sys/class/leds/button-backlight/brightness

Manually force keyboard backlight to stay off

You can manually force the keyboard backlight to stay off.
This setting overrides the previous entry of this manual

Turn off keyboard backlight and don't allow back on again (reminder: Only lasts until reboot):

echo 0 > /sys/class/leds/button-backlight/max_brightness

Allow keyboard backlight on again (doesn't necessarily turn brightness on):

echo 255 > /sys/class/leds/button-backlight/max_brightness

Note: I didn't find a way to force keyboard backlight to stay on.

UNSafe

These settings are NOT safe for you to try out. Do it at your own risk and don't come crying if it breaks something. If an unsafe option is actually deemed safe, it will be moved to the list above. However, until then, only READ (using cat command) and never write to them.

DO NOT TOUCH THESE IF YOU DON'T KNOW WHAT YOU ARE DOING!

With that out of the way, here's the information for sharing:

 Pretend you have battery capacity you don't

You can manually pretend to have a different battery capacity than the real one (this also means that any rooted program/app can do the same, be VERY careful which programs/apps you give root access!!!)

Unsafe: From what appears like, this value, once set, doesn't update with the status of the battery. This is quite useful to test if automations related to the battery status are working well without having to wait for the battery to actually deppel or recharge.

Pretend your phone has 90% capacity left

echo 90 > /sys/class/power_supply/battery/capacity

Pretend your phone has 10% capacity left:

echo 10 > /sys/class/power_supply/battery/capacity

 

 

Edited by brunoais
  • Like 2
  • Thanks 3
Link to post
Share on other sites

Awesome findings, thanks. I did not test the (unsafe) battery capacity-faking bit (yet). 😉

The battery charging control works the same on the original (835) Pro1.

The keyboard backlight control also works similarly, except that, on the Pro1, the respective sysfs files are located under

/sys/class/leds/keyboard-backlight/

rather than "/sys/class/leds/button-backlight/".

  • Like 1
Link to post
Share on other sites

I don't know but the sysfs I currently show there stops energy input. That means the phone starts working powered by the battery, even though it's connected to the cable.
What you point out, is the phone just not charging but still taking power to sustain itself (what I'd rather be turning on there). It can have a relation but they are different in that detail I pointed out

Link to post
Share on other sites
6 minutes ago, brunoais said:

I don't know but the sysfs I currently show there stops energy input. That means the phone starts working powered by the battery, even though it's connected to the cable.

Confirmed for the 835 Pro1. Toggling that flag causes the Pro1 to ignore the connected power cable and drain its battery instead.

  • Thanks 1
Link to post
Share on other sites
8 hours ago, brunoais said:

I don't know but the sysfs I currently show there stops energy input. That means the phone starts working powered by the battery, even though it's connected to the cable.
What you point out, is the phone just not charging but still taking power to sustain itself (what I'd rather be turning on there). It can have a relation but they are different in that detail I pointed out

Ah I see, so not only suspending battery charging, but suspending power input completely. So the discriptive wording ought to be adjusted slightly. Maybe something like

suspending power input (and thus battery charging)

Link to post
Share on other sites
1 hour ago, EskeRahn said:

Ah I see, so not only suspending battery charging, but suspending power input completely. So the discriptive wording ought to be adjusted slightly. Maybe something like

suspending power input (and thus battery charging)

Fixed

  • Thanks 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Terms