Parent

Included Modules

Class/Module Index [+]

Quicksearch

Object

Constants

BAUDRATE
DEVICE

Public Instance Methods

dev_open(path) click to toggle source
# File examples/modem_check1.rb, line 7
def dev_open(path)
  dev = open(DEVICE, File::RDWR | File::NONBLOCK)
  mode = dev.fcntl(Fcntl::F_GETFL, 0)
  dev.fcntl(Fcntl::F_SETFL, mode & ~File::NONBLOCK)
  dev
end
dump_termios(tio, banner) click to toggle source
# File test/test0.rb, line 3
def dump_termios(tio, banner)
  puts banner
  puts "  ispeed = #{Termios::BAUDS[tio.ispeed]}, ospeed = #{Termios::BAUDS[tio.ospeed]}"
  ["iflag", "oflag", "cflag", "lflag"].each do |x|
    flag = tio.send(x)
    flags = []
    eval("Termios::#{x.upcase}S").each do |f, sym|
      flags << sym.to_s if flag & f != 0
    end
    puts "   #{x} = #{flags.sort.join(' | ')}"
  end
  print "      cc ="
  cc = tio.cc
  cc.each_with_index do |x, idx|
    print " #{Termios::CCINDEX[idx]}=#{x}" if Termios::CCINDEX.include?(idx)
  end
  puts
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.