ruby-serialport dropped bytes

M

mail

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
 

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

Members online

Forum statistics

Threads
473,967
Messages
2,570,148
Members
46,694
Latest member
LetaCadwal

Latest Threads

Top