Files
metasploit-gs/external/serialport/test/miniterm.rb
T
druid cad513b703 MSF fork of the RubyForge ruby-serialport library
git-svn-id: file:///home/svn/framework3/trunk@6117 4d416f70-5f16-0410-b530-b9f4589650da
2009-01-11 05:35:23 +00:00

26 lines
428 B
Ruby

require "../serialport.so"
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