-
-
Notifications
You must be signed in to change notification settings - Fork 183
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
Question: ability to work with Virtual serial ports #96
Comments
Hi @gerwindehaan. This is something I'd like to see available, too. In fact, I've thought it would be nice to be able to create virtual serial ports with ORSSerialPort. Not sure if that's feasible. Anyway, to your actual question: This change to allow creating an ORSSerialPort with just a file descriptor and/or a path will be required as part of Issue #93 because Linux doesn't have IOKit. So, it's already on my radar. I'm not in a position to work on this myself at the moment as I'm busy with other projects, but would happily accept a pull request on the 3.0 branch where ORSSerialPort is being rewritten in Swift (see #92). Otherwise, it's something I will implement, but I'm not sure how long it will be before I can get to it. |
If you're interested in implementing this and submitting a pull request, feel free to ask questions. I think the basic approach is to "swap" the initializers in |
Thanks for your reply! Here's an update: As an experiment I switched to using the 3.0 branch and had a go at swapping the initializers in |
Nice! The request/response API is entirely built on top of "high level" ORSSerialPort send/receive functionality. The implementation of the request response API shouldn't depend on the specifics of the low level send/receive implementation at all. Any chance you could push your changes so far to your own branch so I can take a look? |
Ah, the request/reponse API is working allright; some debugging showed me that --somewhere in |
just left it like it is to let you have a peek: https://github.com/gerwindehaan/ORSSerialPort/commits/3.0 ,need to still check if a file descriptor is actually present (or even nicer, have a watchdog to see a port appear/disappear) |
Just a note to say that I still haven't had a chance to look at this, but haven't forgotten, and will get to it when I can. |
Did anything ever become of this? |
Wondering the same. I also have a use case for using |
@macauley I have the exactly same needs - making SkookumLogger and RUMlogNG to talk to a virtual serial port. |
How to use the Objective-C version to solve the problem that the virtual serial port cannot be found? |
I am rewriting an OSX control application using ORSSerialPort. In some occasions, I would like to control a serial device that is not directly connected to my machine, or mock the communication of such device locally for testing. Using socat one can create virtual serial ports, for example to channel communication from a real serial device locally or over a network.
For example, here I create a pair of virtual devices
/dev/master
and/dev/slave
:sudo socat -d -d -d -d -lf /tmp/socat pty,link=/dev/master,ixoff=0,ixon=0,ispeed=9600,ospeed=9600,echo=0,crtscts=0,user=gerwin,group=staff pty,link=/dev/slave,rawer,echo=0,user=gerwin,group=staff
Using such setup, I am able to connect to virtual ports using pySerial. However, using ORSSerialPort did not work for me.
When stepping through the code this seems to originate from ORSSerialPort relying solely on IOKit, in which 'virtual' devices don't show up on its radar. Also when initialising an instance with a path, e.g.
/dev/master
, the correspondingio_object_t
does not exist -- and initialisation returns nil.I want to avoid going to deep into IOKit and kernel stuff (as suggested here).
Looking at the code I see that deep within, sendData writes to a filedescriptor. Is it in any way feasible that there could be a way to initialise an ORSSerialPort with a 'plain' file descriptor, skipping detailed ioctl settings, and treating this as a plain character stream (assuming this is how pySerial pulls it off). Any alternatives ?
The text was updated successfully, but these errors were encountered: