Tail-ing /sys/devices/platform/applesmc.768/light not working

The name of the pictureThe name of the pictureThe name of the pictureClash 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.







share|improve this question
























    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.







    share|improve this question






















      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.







      share|improve this question












      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.









      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 5 '17 at 11:38









      Abdillah

      1033




      1033




















          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.






          share|improve this answer




















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            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






























            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.






            share|improve this answer
























              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.






              share|improve this answer






















                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.






                share|improve this answer












                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.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 5 '17 at 11:48









                Michael Daffin

                2,5801517




                2,5801517



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    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













































































                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Displaying single band from multi-band raster using QGIS

                    How many registers does an x86_64 CPU actually have?