I\'m familiar with C\'s select()
function. I\'ve been using this function for many purposes. Most of them, if not all, for reading and writing
Python's select()
gets passed through as a select()
system call as you are expecting, but the problem you have with it blocking is a different issue, probably relating to buffering. Just to satify yourself that select()
is doing the right thing, try reading/writing a file on the file system rather than using a special device such as a joystick.
You probably want to change your open()
call. Pythons open call will by default use buffered reads, so even if you do a read(8)
it will likely read more data from the input file and buffer the results. You need to set the buffering
option to open
so that the joystick device is opened unbuffered.
Suggestions for you to try:
mode
to be rb
when dealing with special devices such as a joystick.select
based calls. Try using os.open()
with os.O_RDONLY|os.O_NONBLOCK
flags.