[squeak-dev] Successful reading of /dev/input/event2 (was Re: Touchscreen events and non-blocking file I/O)

Tony Garnock-Jones tonyg at ccs.neu.edu
Wed Jun 8 21:28:00 UTC 2016

Hello all,

Following Levente's suggestion, I managed to read Linux input events
from /dev/input/event2 (which is a mouse on this system) without
blocking the whole image.

Attached is LinuxIO.st. To try it out,

  d := LinuxInputEventDevice openPath: '/dev/input/event2'.
  d eventHandler:
    [:e | Transcript nextPutAll: e printString; crlf; flush].

(Change event2 to the device file for your mouse - or touchscreen!)

Then, wiggling the mouse should print messages to Transcript.

To stop it,

  d close.

(You can start it again with "d open".)

It's just a proof-of-concept; ideally, it'd know to reopen itself at
image startup. Plus it'd be useful to have some way of identifying at
least device classes. But it's good enough to start playing with reading
touchscreens, perhaps!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: LinuxIO.st
Type: application/squeak-changeset
Size: 3248 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20160608/54baa622/LinuxIO.bin

More information about the Squeak-dev mailing list