Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why doesn “cat” return when reading the X10 devices?

cat Devices Reading Return X10
0
Posted

Why doesn “cat” return when reading the X10 devices?

0

When the program “cat” opens a file to read, it opens it in blocking mode. Since the driver continually receives information, there is no real end-of-file, therefore, when you read the device in blocking mode, the read will wait for more data to arrive for the device. Since most scripts need to just read the current value and then exit, a utility called “nbread” (non-blocking read) has been provided in the utils directory. This utility opens the device with the flag O_NONBLOCK so that when the driver has no more data it returns 0 bytes causing the read() request to return. Realizing that there may be cases where you want the driver to never block for a status read, the flag “nonblockread” can be passed to the module when it is loaded to cause it to never block. The syntax for loading with nonblocking reads is “insmod x10_ nonblockread=1″.

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123