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
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