Skip to content

Instantly share code, notes, and snippets.

@ThuggishNuggets
Created May 3, 2019 17:34
Show Gist options
  • Save ThuggishNuggets/4a1547dee9429f53fdd462c84dead2c4 to your computer and use it in GitHub Desktop.
Save ThuggishNuggets/4a1547dee9429f53fdd462c84dead2c4 to your computer and use it in GitHub Desktop.
GPD Pocket Linux Charge Status
#!/bin/bash
voltage() { cat /sys/class/power_supply/fusb302-typec-source/voltage_now; }
voltage_actual() { cat /sys/class/power_supply/max170xx_battery/voltage_now; }
current_actual() { cat /sys/class/power_supply/max170xx_battery/current_now; }
current() { cat /sys/class/power_supply/fusb302-typec-source/current_max; }
current_limit() { cat /sys/class/power_supply/bq24190-charger/input_current_limit; }
capacity() { cat /sys/class/power_supply/max170xx_battery/capacity; }
echo "Voltage: $(expr `voltage` / 1000000)V DC"
echo "Voltage (actual): $(echo 'scale=2; '$(voltage_actual)'/1000000' | bc)V DC"
echo "Current: $(echo 'scale=2; '$(current)'/1000000' | bc)A"
echo "Current (max): $(echo 'scale=2; '$(current_limit)'/1000000' | bc)A"
echo "Current (actual): $(echo 'scale=2; '$(current_actual)'/1000000' | bc)A"
echo "Capacity: $(capacity)%"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment