android - Real-time watch /dev file in a tail -f fashon -


i have andriod-based device has physical button on it, , it's state can read via file: /sys/class/gpio/gpio8/value 1 or 0 (a "device file"? there a special word kind of file?).

i want know if there way watch file, without polling. know watch small interval, seems bad practice me/there has way.

then next step determine how pipe android application.

it worth noting not believe these buttons integrated android sensors api/lib, otherwise use that

i looking direction on how proceed. there no way watch button state aka when button pushed , circuit completed, there no event pushed os, os has poll.

thanks!

if gpio driver supports pollable attributes via sysfs_notify() mechanism can use poll() in program wait state change. know 2 ways how check this: a) read driver's source code , b) make test , see if works you.

some upcoming sysfs enhancements


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -