summaryrefslogtreecommitdiffstats
path: root/firmware/target/hosted/agptek/power-agptek.c
diff options
context:
space:
mode:
authorMarcin Bukat <marcin.bukat@gmail.com>2018-03-13 21:24:56 +0100
committerMarcin Bukat <marcin.bukat@gmail.com>2018-06-12 10:31:15 +0200
commit7692558674be24dfe51d7be84b4d01995c23e67b (patch)
tree9cf8909c361ea6373ee81d46518cc168c5d60074 /firmware/target/hosted/agptek/power-agptek.c
parentd5889b3d94c0ff2403c2c6c9c89500b85e050bca (diff)
downloadrockbox-7692558674be24dfe51d7be84b4d01995c23e67b.tar.gz
rockbox-7692558674be24dfe51d7be84b4d01995c23e67b.zip
Agptek Rocker: Implement USB mass storage driver
Agptek uses composite android driver. Change-Id: Iece188ad640f3dfd24c171946c14da4c3516b6d5
Diffstat (limited to 'firmware/target/hosted/agptek/power-agptek.c')
-rw-r--r--firmware/target/hosted/agptek/power-agptek.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/firmware/target/hosted/agptek/power-agptek.c b/firmware/target/hosted/agptek/power-agptek.c
index 7403801681..023d3888b9 100644
--- a/firmware/target/hosted/agptek/power-agptek.c
+++ b/firmware/target/hosted/agptek/power-agptek.c
@@ -35,19 +35,23 @@ const char * const sysfs_bat_voltage =
const char * const sysfs_bat_status =
"/sys/class/power_supply/battery/status";
-unsigned int agptek_power_get_status(void)
+const char * const sysfs_pow_supply =
+ "/sys/class/power_supply/usb/present";
+
+unsigned int agptek_power_input_status(void)
+{
+ int present = 0;
+ sysfs_get_int(sysfs_pow_supply, &present);
+
+ return present ? POWER_INPUT_USB_CHARGER : POWER_INPUT_NONE;
+}
+
+bool agptek_power_charging_status(void)
{
char buf[12] = {0};
sysfs_get_string(sysfs_bat_status, buf, sizeof(buf));
- if (strncmp(buf, "Charging", 8) == 0)
- {
- return POWER_INPUT_USB_CHARGER;
- }
- else
- {
- return POWER_INPUT_NONE;
- }
+ return (strncmp(buf, "Charging", 8) == 0);
}
unsigned int agptek_power_get_battery_voltage(void)