Tail-ing /sys/devices/platform/applesmc.768/light not working
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
Once upon a time, I cast this shellspell,
# tail -f /sys/devices/platform/applesmc.768/light
and it does produce,
(0,0)
Those file I read is light sensor abstraction file of Macbook Pro.
Unfortunately, when I give some light into the sensor (in the same place as camera), It didn't update the value!
It does show the change when read manually,
# cat /sys/devices/platform/applesmc.768/light
(50,0)
The quest is as to why?!
Cause I want to do some polling into the value and get the notification when it changed. Using python too doesn't work.
macintosh tail sysfs
add a comment |Â
up vote
0
down vote
favorite
Once upon a time, I cast this shellspell,
# tail -f /sys/devices/platform/applesmc.768/light
and it does produce,
(0,0)
Those file I read is light sensor abstraction file of Macbook Pro.
Unfortunately, when I give some light into the sensor (in the same place as camera), It didn't update the value!
It does show the change when read manually,
# cat /sys/devices/platform/applesmc.768/light
(50,0)
The quest is as to why?!
Cause I want to do some polling into the value and get the notification when it changed. Using python too doesn't work.
macintosh tail sysfs
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Once upon a time, I cast this shellspell,
# tail -f /sys/devices/platform/applesmc.768/light
and it does produce,
(0,0)
Those file I read is light sensor abstraction file of Macbook Pro.
Unfortunately, when I give some light into the sensor (in the same place as camera), It didn't update the value!
It does show the change when read manually,
# cat /sys/devices/platform/applesmc.768/light
(50,0)
The quest is as to why?!
Cause I want to do some polling into the value and get the notification when it changed. Using python too doesn't work.
macintosh tail sysfs
Once upon a time, I cast this shellspell,
# tail -f /sys/devices/platform/applesmc.768/light
and it does produce,
(0,0)
Those file I read is light sensor abstraction file of Macbook Pro.
Unfortunately, when I give some light into the sensor (in the same place as camera), It didn't update the value!
It does show the change when read manually,
# cat /sys/devices/platform/applesmc.768/light
(50,0)
The quest is as to why?!
Cause I want to do some polling into the value and get the notification when it changed. Using python too doesn't work.
macintosh tail sysfs
asked Nov 5 '17 at 11:38
Abdillah
1033
1033
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
Use watch around cat or a while loop instead:
watch cat /sys/devices/platform/applesmc.768/light
while sleep 0.5; do cat /sys/devices/platform/applesmc.768/light; done
The file is not being appended to with new values, it is being replaced so inorder to reread the values you need to reread the file. Thus tail will not work as it is waiting for more lines to be appended to the file.
In python you could try skipping to the beginning of the opened file, but that will likely just allow you to reread the old value again. Closing and reopening the file should work as you want it to however.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
Use watch around cat or a while loop instead:
watch cat /sys/devices/platform/applesmc.768/light
while sleep 0.5; do cat /sys/devices/platform/applesmc.768/light; done
The file is not being appended to with new values, it is being replaced so inorder to reread the values you need to reread the file. Thus tail will not work as it is waiting for more lines to be appended to the file.
In python you could try skipping to the beginning of the opened file, but that will likely just allow you to reread the old value again. Closing and reopening the file should work as you want it to however.
add a comment |Â
up vote
2
down vote
accepted
Use watch around cat or a while loop instead:
watch cat /sys/devices/platform/applesmc.768/light
while sleep 0.5; do cat /sys/devices/platform/applesmc.768/light; done
The file is not being appended to with new values, it is being replaced so inorder to reread the values you need to reread the file. Thus tail will not work as it is waiting for more lines to be appended to the file.
In python you could try skipping to the beginning of the opened file, but that will likely just allow you to reread the old value again. Closing and reopening the file should work as you want it to however.
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
Use watch around cat or a while loop instead:
watch cat /sys/devices/platform/applesmc.768/light
while sleep 0.5; do cat /sys/devices/platform/applesmc.768/light; done
The file is not being appended to with new values, it is being replaced so inorder to reread the values you need to reread the file. Thus tail will not work as it is waiting for more lines to be appended to the file.
In python you could try skipping to the beginning of the opened file, but that will likely just allow you to reread the old value again. Closing and reopening the file should work as you want it to however.
Use watch around cat or a while loop instead:
watch cat /sys/devices/platform/applesmc.768/light
while sleep 0.5; do cat /sys/devices/platform/applesmc.768/light; done
The file is not being appended to with new values, it is being replaced so inorder to reread the values you need to reread the file. Thus tail will not work as it is waiting for more lines to be appended to the file.
In python you could try skipping to the beginning of the opened file, but that will likely just allow you to reread the old value again. Closing and reopening the file should work as you want it to however.
answered Nov 5 '17 at 11:48
Michael Daffin
2,5801517
2,5801517
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f402634%2ftail-ing-sys-devices-platform-applesmc-768-light-not-working%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password