Why is writing to /sys/class/power_supply/battery/status
having no effect?
Accessed manually via adb shell
as root, eg echo "Discharging" > /sys/class/power_supply/battery/status
does not change the file's contents. vi
does not want to save any changes. touch
also fails to create a test file in the same directory.
Permissions were 444 originally, but changed to 644 with chmod
.
The goal is to use Battery Charge Limit to limit how much the phone's battery is charged, and that app writes to a control file to achieve this. Since the app isn't working on this phone I tried to test writing manually to diagnose.
The phone is a Samsung Gio GT-S5660M running Cyanogenmod 11 which is the most recent ROM I found for it.
File system and memory:
root@gio:/ # df
Filesystem Size Used Free Blksize
/dev 136.9M 136.0K 136.7M 4096
/sys/fs/cgroup 136.9M 0.0K 136.9M 4096
/mnt/asec 136.9M 0.0K 136.9M 4096
/mnt/obb 136.9M 0.0K 136.9M 4096
/mnt/fuse 136.9M 0.0K 136.9M 4096
/system 206.4M 185.2M 21.3M 4096
/data 178.4M 114.7M 63.7M 4096
/cache 24.8M 4.2M 20.6M 4096
/mnt/media_rw/sdcard0 1.8G 4.3M 1.8G 32768
/mnt/secure/asec 1.8G 4.3M 1.8G 32768
/storage/sdcard0 1.8G 4.3M 1.8G 32768
root@gio:/ # free
total used free shared buffers
Mem: 280276 267796 12480 0 3672
-/+ buffers: 264124 16152
Swap: 49148 4580 44568
root@gio:/ # mount
rootfs / rootfs ro,relatime 0 0
tmpfs /dev tmpfs rw,seclabel,nosuid,relatime,mode=755 0 0
devpts /dev/pts devpts rw,seclabel,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,seclabel,relatime 0 0
selinuxfs /sys/fs/selinux selinuxfs rw,relatime 0 0
none /acct cgroup rw,relatime,cpuacct 0 0
none /sys/fs/cgroup tmpfs rw,seclabel,relatime,mode=750,gid=1000 0 0
none /sys/fs/cgroup/memory cgroup rw,relatime,memory 0 0
tmpfs /mnt/asec tmpfs rw,seclabel,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/obb tmpfs rw,seclabel,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/fuse tmpfs rw,seclabel,relatime,mode=775,gid=1000 0 0
none /dev/cpuctl cgroup rw,relatime,cpu 0 0
/dev/block/stl12 /system ext4 ro,seclabel,relatime,user_xattr,acl,barrier=1,data=ordered 0 0
/dev/block/stl13 /data ext4 rw,seclabel,nosuid,nodev,relatime,user_xattr,acl,barrier=1,data=ordered 0 0
/dev/block/stl14 /cache ext4 rw,seclabel,nosuid,nodev,relatime,user_xattr,acl,barrier=1,data=ordered 0 0
/sys/kernel/debug /sys/kernel/debug debugfs rw,relatime 0 0
/dev/block/vold/179:1 /mnt/media_rw/sdcard0 vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1023,gid=1023,fmask=0007,dmask=0007,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
/dev/block/vold/179:1 /mnt/secure/asec vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1023,gid=1023,fmask=0007,dmask=0007,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
/dev/fuse /storage/sdcard0 fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
status
file does not work, it could explain why BCL is not working. Even though BCL is no longer maintained, it is simple and works well on another phone. The Samsung Gio is very old and limited in storage (178MB internal). And I don't know if ACCA or Magisk still support android 4.4.4. Maybe I could try the ACC install on its own, but I would like to figure out why writing is failing on this ROM. Am I missing something simple?cat /sys/class/power_supply/battery/status
always showsCharging
even when fully charged. But I cannot write to it withecho
orvi
, even when root has write permissions to the file, and I can't create a file in the same directory withtouch
. I'm trying to understand why writing is not working and how to have it succeed before looking further about control files or charge limiting apps.