Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows - Can't connect to a Moxa Serial port - Bad file descriptor #37

Open
pini-gh opened this issue Oct 7, 2012 · 2 comments
Open

Comments

@pini-gh
Copy link

pini-gh commented Oct 7, 2012

Hi,

I'm trying to connect to a serial device through a Moxa Board C32065T. The 8 Moxa ports are reported by Windows as COM10 to COM17. My device is on COM13, and accessible from standard serial communication applications such as PortMon.

Using ruby-serialport I initialize the port with (since COM1 is port 0, I guess COM13 should be port 12):
SerialPort.new 12, 9600

But the initialization fails with "EBADF: Bad file descriptor".

Is there a way to access the port by its name "COM13"?

Thanks in advance,

_g.

@pini-gh
Copy link
Author

pini-gh commented Oct 7, 2012

Hi again,

Reading the source code, I understand that the port parameter of SerialPort.new() can be either an integer or a string, so it could open a port by name (say "\.\COM13"). But:

SerialPort.new("\.\COM13")
TypeError: can't convert String into Integer

Thanks,

_g.

@pini-gh
Copy link
Author

pini-gh commented Oct 7, 2012

It seems it's the same issue as #13: when I force the full path of serialport.rb in my require statement it works.

I've tested: renaming serialport.so to libserialport.so and modifying accordingly the require statement in serialport.rb. Then, "require 'serialport'" produces "cannot load such file -- serialport". I guess that serialport.so was loaded instead of serialport.rd which actually isn't in the search path.

Installing serialport.rb init /lib/ruby// and renaming back serialport.so did the trick.

Hence, the actual issue is relative to the serialport.rb installation path.

Thanks,

_g.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant