Help- low level control of mouse device

rob europax at
Mon Sep 4 19:28:01 CEST 2000

Thank you.  I will try this out. I think I've been banging my head and
missing the obvious.  Rob.

Andrew Kuchling wrote:
> rob <europax at> writes:
> > tp=open('/dev/psm0','wb+')  #open device
> > tp.write(`0xff`)    #reset touchpad
> > print     #read ack
> The file objects returned by the open() built-in use the C stdio
> library to do I/O; this means that they do buffering, which will mess
> up matters for Unix device files, since data you write may still be
> sitting and waiting in the buffer.  Solutions:
> 1) Try opening the file in unbuffered mode: open('/dev/psm0', 'wb+', 0)
> 2) Use the function which returns a file descriptor, and use
> / os.write().
> Incidentally, line 2 is wrong if you're trying to send byte 255 to the
> device; use chr(0xff).  `0xff` returns the repr() of 0xff, so line 2
> writes the string '255' to the file.
> --amk

More information about the Python-list mailing list