From: Adam Shelly Date: 2005-12-16T06:43:27+09:00 Subject: Re: setting serial port settings On 12/15/05, dperkins@frii.com wrote: > I'm writing a simple script that talks to a device on a PC serial port. I > need to be able to set the port settings (baud, bits, parity) but I have > not found a way to do this. How can I do this? I don't know if you can do it directly from ruby, but you can use a system command. On windows irb(main):005:0> system "MODE COM3 BAUD=1200" Status for device COM3: ----------------------- Baud: 1200 Parity: Even Data Bits: 7 Stop Bits: 1 Timeout: OFF XON/XOFF: OFF CTS handshaking: OFF DSR handshaking: OFF DSR sensitivity: OFF DTR circuit: ON RTS circuit: ON => true C:\>help mode Configures system devices. Serial port: MODE COMm[:] [BAUD=b] [PARITY=p] [DATA=d] [STOP=s] [to=on|off] [xon=on|off] [odsr=on|off] [octs=on|off] [dtr=on|off|hs] [rts=on|off|hs|tg] [idsr=on|off] ... > This script will run in a DOS window on Windows, but I might need to use > it with Linux later. > I'll let a linux guru tell you the correct command there. -Adam