2023-04-28 06:38:13 +00:00
|
|
|
"""
|
|
|
|
This file is used to read the counter_reader value from the /dev/inex_counter device.
|
|
|
|
The value is then send as a notification.
|
|
|
|
"""
|
|
|
|
|
|
|
|
from subprocess import run
|
|
|
|
|
|
|
|
|
2023-04-28 06:45:18 +00:00
|
|
|
def main():
|
2023-04-28 06:38:13 +00:00
|
|
|
"""
|
|
|
|
This function is called when the script is executed.
|
|
|
|
"""
|
|
|
|
# Read the counter_reader value from the device.
|
|
|
|
counter_value = run(["cat", "/dev/inex_counter"], capture_output=True).stdout.decode("utf-8")
|
2023-04-28 06:45:18 +00:00
|
|
|
print(counter_value)
|
2023-04-28 06:38:13 +00:00
|
|
|
# Send the counter_reader value as a notification.
|
2023-04-28 06:45:18 +00:00
|
|
|
run(["notify-send", "Counter value", counter_value])
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|