Unbuffered IO

Hi,

this used to work in an older version/environment:

I read from a usb joystick:

  irb(main):001:0> f = File.new "/dev/input/event0"
  => #<File:/dev/input/event0>
  irb(main):002:0> i=0
  => 0
  irb(main):003:0> loop { a = f.read 8 ; puts [i,a.inspect].join( "--") ; i += 1 }
  0--"\342\252\213E\315\363\000\000"
  ...
  7--"\000\000\000\000\000\000\000\000"
  [wait]

When I press the buttons on the device I get the output
8-line-wise, that is 64 bytes at a time. So I try:

  irb(main):001:0> f = File.new "/dev/input/event0"
  => #<File:/dev/input/event0>
  irb(main):002:0> f.sysread 8
  Errno::EINVAL: Invalid argument - /dev/input/event0
          from (irb):2:in `sysread'
          from (irb):2

What does this mean and how could I get around it?

Thanks in advance.

Bertram

···

from :0

--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de

Hi,

···

Am Freitag, 22. Dez 2006, 19:41:00 +0900 schrieb Bertram Scharpf:

I read from a usb joystick:

  irb(main):001:0> f = File.new "/dev/input/event0"
  => #<File:/dev/input/event0>

I confused event interface and joystick interface.

Please don't answer on this stupid question.

Bertram

--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de