[NTLK] Einstein/NCX serial communication test versions as binary release.

Matthias Melcher mm at matthiasm.com
Mon Feb 20 15:56:37 EST 2017


> On Feb 20, 2017, at 7:58 PM, Jake Bordens <jake at allaboutjake.com> wrote:
> 
> If you have “socat” on our machine (install through homebrew) you can create a PTY in /dev that looks and acts like a serial port:
> 
>> sudo socat -d -d -d PTY,raw,mode=666,echo=0 PIPE:/Users/jake/Library/Application\ Support/Einstein\ Emulator/ExtrSerPortSend\!\!PIPE:/Users/jake/Library/Application\ Support/Einstein\ Emulator/ExtrSerPortRecv
> 
> When run, gives you:
> 
>> 2017/02/20 13:57:02 socat[98081] N PTY is /dev/ttys002
>> 2017/02/20 13:57:02 socat[98081] N opening named pipe "/Users/jake/Library/Application Support/Einstein Emulator/ExtrSerPortSend" for reading
>> 2017/02/20 13:57:02 socat[98081] N opening named pipe "/Users/jake/Library/Application Support/Einstein Emulator/ExtrSerPortRecv" for writing
>> 2017/02/20 13:57:02 socat[98081] N starting data transfer loop with FDs [5,5] and [7,8]
> 
> The only downside is that it doesn’t enumerate as a serial port, so many apps that enumerate serial devices won’t show your emulated device.
> 
> Not sure if there’s a way to emulate what socat is doing here, or maybe we just shell out to socat to setup the device.  The end result is there is much less modification necessary to existing apps when you can point them at something in /dev

Thanks Jake. This is actually was my first approach, and it worked well. I tried to set symbolic links or have socat create a name that would be listed, but to no avail. I reverted to named pipes because they are private to the user and are readily available on every machine including MSWindows. Lastly, socat creates a randomly named device which needs to be published to all apps involved.

On the plus side, an socat device needs no code change on the receiver side, except for finding the correct device name.

 Matthias


More information about the NewtonTalk mailing list