hparra/ruby-serialport — Issue #29: Bluetooth to serial interface not working on Windows
Author: thinkify
Created: 2011-10-12 17:49:53+00:00
State: open

Hi.

I've been using your nice gem for a while now on different projects. Thanks!

Recently, I've been trying to connect to a serial device using a bluetooth tranceiver module to provide a wireless interface back to my laptop.

http://www.mdfly.com/index.php?main_page=product_info&cPath=8_47&products_id=769&zenid=h6pb9e47rc6klkvkiattb6uot4

(There are other, similar devices people have used to talk to Arduinos, etc...)

The module initiates a bluetooth connection with my laptop and creates a virtual serial port on my Windows system. I simply pair the device w/windows using a passkey and a new serial port is generated.

Using Hyperterm or Teraterm or other programs I've written in VB and C# I can open this port and communicate with my device as if the bluetooth link were just a serial connection.

I figured I could do the same thing with your library, but I'm having problems. (I've never had problems with standard serial or USB-Serial devices I've used, though)

Here's what's happening.

Standard com port on com1
Bluetooth serial port on com2
(Again, Hyperterminal, TeraTerm and other programs seem to connect to Com2 fine...)

C:\>ruby --version
ruby 1.9.2p180 (2011-02-18) [i386-mingw32]

C:\>gem list serialport

*** LOCAL GEMS ***

serialport (1.0.4)

C:\>irb
irb(main):001:0> require 'serialport'
=> true
irb(main):003:0> sp0=SerialPort.new(0)
=> #
irb(main):004:0> sp0.get_modem_params
=> {"baud"=>115200, "data_bits"=>8, "stop_bits"=>1, "parity"=>0}
irb(main):005:0> sp1=SerialPort.new(1)
Errno::EINVAL: Invalid argument - \\.\COM2
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/serialport-1.0.4/lib/serialport.rb:16:in `create'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/serialport-1.0.4/lib/serialport.rb:16:in `new'
from (irb):5
from c:/Ruby192/bin/irb:12:in `

'
irb(main):006:0>

Thanks for your help!

John.