Closed erubin closed 12 years ago
Reviewed issue. Reviewing code.
If you can confirm that you are not getting an IOError thrown that would help.
It turned out that the problem was not just with flow_control but with other parameters as well.
There does seem to be a problem with setting parameters from a hash. When I do this:
@@port = SerialPort.new("/dev/ttyUSB0", :baud => 9600, :data_bits => 8, :stop_bits => 1, :parity => SerialPort::NONE)
parameters do not get set.
When I do this:
@@port = SerialPort.new("/dev/ttyUSB0") @@port.baud = 9600 @@port.data_bits = 8 @@port.stop_bits = 1 @@port.parity = SerialPort::NONE @@port.flow_control = SerialPort::NONE
It works fine.
I am trying to communicate via USB to a board that requires no flow control. I am creating the SerialPort as follows:
@@port = SerialPort.new("/dev/ttyUSB0", :baud => 9600, :data_bits => 8, :stop_bits => 1, :parity => SerialPort::NONE, :flow_control => SerialPort::NONE)
It says that @@port.flow_control is 0, but I can't communicate with the board. When I turn off flow control with minicom it works fine, and after that my ruby code can talk to the board (presumably because minicom leaves flow control off when it exits). Explicitly saying @@port.flow_control = SerialPort::NONE doesn't help.
So it seems that serialport (1.0.4) is not actually turning off flow control. Has anyone else seen this? An suggestions for a workaround? (I'm running Ruby 1.9 under CentOS 5.7)
Eric Rubin