Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Unbuffered IO
Bertram Scharpf
12/22/2006 10:41:00 AM
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
--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-...
1 Answer
Bertram Scharpf
12/22/2006 11:47:00 AM
0
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-...
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Unbuffered IO
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password