osx - Virtual serial ports in ORSSerialPort -


i rewriting osx control application using orsserialport. in occasions, control serial device not directly connected machine, or mock communication of such device locally testing. using socat 1 can create virtual serial ports, example channel communication real serial device locally or on network.

for example, here create pair of virtual devices /dev/master , /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, able connect virtual ports using pyserial. however, using orsserialport did not work me.

when stepping through code seems originate orsserialport relying solely on iokit, in 'virtual' devices don't show on radar. when initialising instance path, e.g. /dev/master, corresponding io_object_t not exist -- , initialisation returns nil.

i want avoid going deep iokit , kernel stuff (as suggested here).

looking @ code see deep within, senddata writes filedescriptor. in way feasible there way initialise orsserialport 'plain' file descriptor, skipping detailed ioctl settings, , treating plain character stream (assuming how pyserial pulls off). alternatives ?


update feb 10, 2016:

i discussed situation creator armadsen on orsserialport github issue list:

i think basic approach "swap" initializers in internalserialport , serialport path initializer designated/required one, , iokit initializer optional one. it's case (as you've noted) path (not io_object_t) used internally file descriptor , read/write to/from port. in other words, hope not terribly complicated change.

i posted answer final result below...


update feb 10, 2016:

i discussed situation creator armadsen on orsserialport github issue list:

i think basic approach "swap" initializers in internalserialport , serialport path initializer designated/required one, , iokit initializer optional one. it's case (as you've noted) path (not io_object_t) used internally file descriptor , read/write to/from port. in other words, hope not terribly complicated change.

after made proof-of-concept implementation works me "just filedescriptors" , socat , can found here:

https://github.com/gerwindehaan/orsserialport/tree/3.0


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -