hardware icon indicating copy to clipboard operation
hardware copied to clipboard

Battery and disk feature request

Open andraantariksa opened this issue 4 years ago • 3 comments

I think it will be good if the library has an API for battery (Battery percentage) and disk (R/W speed, capacity, etc). What do you think?

andraantariksa avatar Jul 23 '20 06:07 andraantariksa

Good idea. For battery, it is possible through /sys/class/power_supply/BAT0. It will be hard to test because servers don't have ones. For disk usage, the ideal would be to have statfs (https://github.com/crystal-lang/crystal/issues/6053), but it is possible to use /sys and /proc.

j8r avatar Jul 23 '20 12:07 j8r

Thank you for your response. I will try to create a PR for it

andraantariksa avatar Jul 23 '20 12:07 andraantariksa

After I think it again, I think I should implement a Power class which will inherit Battery and USB (See https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-power). So it's not only for battery

andraantariksa avatar Jul 24 '20 05:07 andraantariksa