[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

ruby-serialport dropped bytes

mail@msryan.co.uk

11/6/2007 11:28:00 PM

I am using ruby-serial port version 0.6 with cygwin on Windows XP.
The version of ruby is 1.8.5. With the test script miniterm.rb
supplied with ruby serial port the first 10 or so bytes are lost when
they are received. Any ideas anyone? The miniterm.rb script is:


if ARGV.size < 4
STDERR.print <<EOF
Usage: ruby #{$0} num_port bps nbits stopb
EOF
exit(1)
end

sp = SerialPort.new(ARGV[0].to_i, ARGV[1].to_i, ARGV[2].to_i,
ARGV[3].to_i, SerialPort::NONE)

open("/dev/tty", "r+") { |tty|
tty.sync = true
Thread.new {
while true do
tty.printf("%c", sp.getc)
end
}
while (l = tty.gets) do
sp.write(l.sub("\n", "\r"))
end
}

sp.close



Mark