Unbuffered IO

B

Bertram Scharpf

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
from :0

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

Thanks in advance.

Bertram
 
B

Bertram Scharpf

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

iconv "\n" (Iconv::InvalidCharacter) 0
how to change it in to hex? 3
Help with Readlines error 2
IO.pos bug? 5
Regular expression contradiction 1
Socket errors 0
parentheses and newlines 2
Date::Delta 0

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top