hparra / ruby-serialport

ruby-serialport is a Ruby library that provides a class for using RS-232 serial ports
http://rubygems.org/gems/serialport
GNU General Public License v2.0
246 stars 58 forks source link

Module arbitrarily excludes arbitrary baud rates on Windows #16

Closed asquared closed 14 years ago

asquared commented 14 years ago

The SetCommState Windows API call allows arbitrary baud rates to be set in addition to the standard enumerated values (see http://msdn.microsoft.com/en-us/library/aa363214%28v=VS.85%29.aspx). Thus, the module should not restrict this use, and the rather lengthy switch statement can be eliminated. I've patched it and pushed the change to a fork...

asquared commented 14 years ago

In other news, Windows (XP at least) is brain dead. From the looks of things, if you pass a baud rate or other DCB settings which happen to be unsupported by the hardware, SetCommState returns zero but doesn't SetLastError( ) in the process. This in turn causes the Ruby interpreter to crash...

hparra commented 14 years ago

I have a Windows 7 box as well. Will test.

hparra commented 14 years ago

Which ruby?

asquared commented 14 years ago

Ruby 1.9.1p378 from rubyinstaller.org, on XP SP3.

hparra commented 14 years ago

Moved second bug regarding SetLastError() to new issue #21 . Please follow it.