You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wonder if replacing readline with read would also solve this. readline-based implementation was only introduced recently. Will try to reproduce in a couple of hours.
Activity
ensonic commentedon Nov 5, 2015
Found a fix. PR is coming in a sec. But in the long run I think we should mmap these files.
Also flush on read() to not return cached data.
dlech commentedon Nov 5, 2015
There is no guarantee that the value returned by the sysfs attribute includes a newline, it is just convention.
I think instead of flushing, it might be more efficient to open with no buffering.
These files can't be mmapped (except the
bin_dataattribute).ddemidov commentedon Nov 5, 2015
I wonder if replacing
readlinewithreadwould also solve this.readline-based implementation was only introduced recently. Will try to reproduce in a couple of hours.dlech commentedon Nov 5, 2015
I know from experience that you need to turn off buffering or read() does not work correctly.
ddemidov commentedon Nov 5, 2015
Good to know. I'll do a PR after some testing then.
ensonic commentedon Nov 5, 2015
The flush() is better than nothing, but I can try differently. @ddemidov no need for another PR I can change this one.
ddemidov commentedon Nov 5, 2015
@ensonic, ok, thanks!
Turn off buffering to not return cached data when reading.
ensonic commentedon Nov 5, 2015
PR updated using with with buffering disabled and using read()
rhempel commentedon Nov 6, 2015
Agreed, I merged the PR, if this fixes your issue, please close.