1 # When parsing 'upower --dump'
7 # When parsing 'upower --monitor-detail'
8 /^\
[[0-9]+:[0-9]+:[0-9]+\.
[0-9]+\
][ \t]+device changed
:[ \t]+/ {
14 / battery
/ && device
["path"] {
15 device
["is_battery"] =
1
19 / state
:/ && device
["is_battery"] {
20 device
["battery_state"] = $
2
24 / percentage
:/ && device
["is_battery"] {
25 device
["battery_percentage"] = $
2
26 sub("%$", "", device
["battery_percentage"])
30 /^$
/ && device
["is_battery"] {
31 print("battery_state" , device
["battery_state"])
32 print("battery_percentage", device
["battery_percentage"])
37 / line
-power
/ && device
["path"] {
38 device
["is_line_power"] =
1
42 / online
:/ && device
["is_line_power"] {
43 device
["line_power_online"] = $
2
47 /^$
/ && device
["is_line_power"] {
48 print("line_power", device
["line_power_online"])
This page took 0.077854 seconds and 4 git commands to generate.