Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Unbuffered IO

Reply
Thread Tools

Unbuffered IO

 
 
Bertram Scharpf
Guest
Posts: n/a
 
      12-22-2006
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-scharpf.de

 
Reply With Quote
 
 
 
 
Bertram Scharpf
Guest
Posts: n/a
 
      12-22-2006
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unbuffered keyboard input??? Starbase Commander Perl 1 09-10-2004 11:20 PM
Unbuffered basic_streambuf Implementation C++ 1 08-29-2004 04:38 PM
Unbuffered basic_streambuf C++ 0 08-28-2004 10:43 AM
unbuffered output file Rich C++ 5 04-16-2004 01:53 AM
unbuffered input michael young Python 1 02-05-2004 10:21 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57