diff options
author | Ingo Bürk <admin@airblader.de> | 2018-09-04 11:58:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-04 11:58:58 +0200 |
commit | 5c9d12befa760e8c7790219f79de837feb5d8ff0 (patch) | |
tree | 131ed264e068482e72bbc82a990c9ea7060b69d3 | |
parent | 38ead0249b42233993b7925a57eeceb69e9d9d38 (diff) | |
parent | 02be7c6fdf14250232529ce928ab96309057bdc0 (diff) |
Merge pull request #305 from David96/master
Add support for "POWER_SUPPLY_STATUS=Not charging" (fixes #304)
-rw-r--r-- | src/print_battery_info.c | 2 | ||||
-rw-r--r-- | testcases/023-battery-not-charging/BAT0_uevent | 1 | ||||
-rw-r--r-- | testcases/023-battery-not-charging/expected_output.txt | 1 | ||||
-rw-r--r-- | testcases/023-battery-not-charging/i3status.conf | 10 |
4 files changed, 13 insertions, 1 deletions
diff --git a/src/print_battery_info.c b/src/print_battery_info.c index 8c85192..3ac8c11 100644 --- a/src/print_battery_info.c +++ b/src/print_battery_info.c @@ -179,7 +179,7 @@ static bool slurp_battery_info(struct battery_info *batt_info, yajl_gen json_gen batt_info->status = CS_CHARGING; else if (BEGINS_WITH(last, "POWER_SUPPLY_STATUS=Full")) batt_info->status = CS_FULL; - else if (BEGINS_WITH(last, "POWER_SUPPLY_STATUS=Discharging")) + else if (BEGINS_WITH(last, "POWER_SUPPLY_STATUS=Discharging") || BEGINS_WITH(last, "POWER_SUPPLY_STATUS=Not charging")) batt_info->status = CS_DISCHARGING; else if (BEGINS_WITH(last, "POWER_SUPPLY_STATUS=")) batt_info->status = CS_UNKNOWN; diff --git a/testcases/023-battery-not-charging/BAT0_uevent b/testcases/023-battery-not-charging/BAT0_uevent new file mode 100644 index 0000000..1c609ce --- /dev/null +++ b/testcases/023-battery-not-charging/BAT0_uevent @@ -0,0 +1 @@ +POWER_SUPPLY_STATUS=Not charging diff --git a/testcases/023-battery-not-charging/expected_output.txt b/testcases/023-battery-not-charging/expected_output.txt new file mode 100644 index 0000000..6fc5dfb --- /dev/null +++ b/testcases/023-battery-not-charging/expected_output.txt @@ -0,0 +1 @@ +BAT diff --git a/testcases/023-battery-not-charging/i3status.conf b/testcases/023-battery-not-charging/i3status.conf new file mode 100644 index 0000000..8660857 --- /dev/null +++ b/testcases/023-battery-not-charging/i3status.conf @@ -0,0 +1,10 @@ +general { + output_format = "none" +} + +order += "battery all" + +battery all { + format = "%status" + path = "testcases/023-battery-not-charging/BAT%d_uevent" +} |