Why doesn “cat” return when reading the X10 devices?
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_