I am trying to find out, how should I work with the serialport
library. I have a 3G modem, ZTE MF637. I have a snippet of code to
test the library:
sp = SerialPort.new(’/dev/ttyUSB2’,9600)
sp.read_timeout = 2000
I am trying it in two ways: as commands in irb and just as a script.
All commands go fine, but when I input “sp.read”, the output is empty:
[email protected]:/tmp/ruby-serialport$ irb
ruby-1.8.7-p302 > require ‘rubygems’
ruby-1.8.7-p302 > require ‘serialport’
ruby-1.8.7-p302 > sp = SerialPort.new(’/dev/ttyUSB0’,9600)
ruby-1.8.7-p302 > sp.read_timeout = 200
ruby-1.8.7-p302 > sp.write(“AT\r\n”)
ruby-1.8.7-p302 > sp.read
The modem is fine, I tried to connect to Internet over it, and it
works. I even read the logs of pppd, and I saw that init strings pass
fine. What can I do?
Thanks a lot.