Closed markf closed 14 years ago
More information:
From my installed serialport.rb:
def SerialPort::new(port, *params)
sp = create(port)
begin
sp.set_modem_params(*params)
rescue
sp.close
raise
end
return sp
end
Looks right to me.
Does the same behavior occur with Serialport.open?
Are you building this through ruby gems? Version? Mac OS X version (10.6)? 64-bit?
Same behavior exists with Serialport.open:
irb(main):003:0> sp = SerialPort.open("/dev/ttyUSB1", 4800, 8, 1)
ArgumentError: wrong number of arguments (4 for 2)
from (irb):3:in `initialize'
from (irb):3:in `open'
from (irb):3
from :0
Building through ruby gems on both platforms.
Mac OS X version is 10.6.3.
Messing around a bit more with this today and explicitly directed Ruby to the location of serialport.rb (require '/path/serialport.rb'), and it worked as expected. Not sure exactly what it might be seeing with just require 'serialport' but obviously picking something else up. Either way, closing this issue.
I'm having trouble (and appear to be the only one doing so) using serialport with ruby 1.8.6/1.8.7. I've tried on two installations - one Linux (2.6.26) the other OS X and I'm having the same behavior on both. For starters, I've built the binary in ext/native appropriately on both (and I know it works as I had some slight changes to the text of the tty ports). Then I see something like the following on both installations:
Passing a string should work, I thought, but I can easily work around that - so far did it using the C piece
This part is the issue. It isn't allowing me to send more than 2 arguments; that is, it doesn't seem to be allowing me to use the variable argument list *params. However, if I do 2 or less, I have success. Surely I'm doing something silly here, but from what I can tell, this is in line with all of the examples. The included miniterm.rb has the same issue.
Surely I'm doing something wrong (consistently) as this is showing up wherever I install.
The issue exists with the serialport-1.0.1 and 1.0.2 gems as well as historical ruby-serialport gems.