Page 1 of 1

Reading of the "/dev/piControl0" file

Posted: 11 Dec 2018, 14:32
by Patrick
I try to read and write to the Picontrol0 file.
I can read and write but i have problems with the logging.
The "/var/log/kern.log" becomes huge, and the revpi is no longer available (rotation daily)
What is wrong, can I disable the logging?

logging data:
===========
piControl 0:piControlOpen
opened 1 instance
Invalid Ioctl
piControlRelease
close instance 1/1

CODE:
======
with open("/dev/piControl0","rb",0) as f:
#underscores are a tab
___f.seek(523,0)
___data = f.read(128)

Re: Reading of the "/dev/piControl0" file

Posted: 11 Dec 2018, 16:55
by RevPiModIO
I think it is because the open function of python is checking if the file could be a tty device... And it will do this by sending ioctl requests to the file handler.

If you do this, the log messages will appear:

Code: Select all

fd = open("/dev/piControl0", "rb+")
fd.isatty()
fd.isatty()
fd.isatty()
fd.isatty()
fd.close()
So, open the file just one time in you program, or use os.open(...) to create a file handler and work with the os.read, os.write functions in python...

Maybe Kunbus can fix that in the piControl device driver.

Sven

Re: Reading of the "/dev/piControl0" file

Posted: 18 Mar 2019, 14:09
by lukas
I concur with Sven's comments: Opening the device file just once seems desirable from a performance perspective anyway and should also reduce the messages.

With a contemporary piControl version, only a single message should be logged, namely the "Invalid Ioctl" one. All the others were silenced by a commit pushed in July 2017. I've just pushed another commit to tone down the remaining message to debug severity, so if you build your own kernel and piControl with kernelbakery now, all the messages should be gone.