3

Is there any way to monitor /proc files, such as

/proc/acpi/battery/BAT0/state
/proc/acpi/ac_adapter/ADP0/state

in a non-polling fashion, similar to inotify on a normal filesystem?

I want to do this in a PyGTK app, so I tried using PyGObject's gio.FileMonitor, but no dice. A Python solution that plays well with gtk.main() would be ideal.

ezod
  • 7,261
  • 2
  • 24
  • 34

1 Answers1

2

Probably you can get the information you want by listening to the ACPI events. Preferably not directly (/proc/acpi/event), but via acpid or other high-level interface.

Update: the other, higher level interface is the DBus interface provided by DeviceKit-power / UPower.

Files in /proc are not regular files, rather a simple interface to kernel state, so many facilities for regular files won't work there.

Jacek Konieczny
  • 8,283
  • 2
  • 23
  • 35