• Re: How to realize a 'serial server' (with com port emulation on pc Win

    From Grant Taylor@3:770/3 to RobertoA on Sat Jan 2 12:29:04 2021
    On 1/2/21 3:08 AM, RobertoA wrote:
    When you talk about 'client program' exactly what are you referring to?

    I remember messing with things in two broad categories.

    1) A driver that created a virtual serial port on the client computer,
    e.g. COM3, Which any standard Windows program could use, e.g.
    Hyperterminal.

    2) A program that spoke the RFC 2217 protocol itself. Think enhanced
    telnet / PuTTY / etc.

    I believe #1 / driver type is what you are after.



    --
    Grant. . . .
    unix || die

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Dennis Lee Bieber@3:770/3 to All on Sat Jan 2 14:48:38 2021
    On Sat, 2 Jan 2021 11:08:27 +0100, RobertoA <amorosik@tiscalinet.it>
    declaimed the following:

    No particular protocol is required, the final goal is to be able to use
    a Hyperterminal / Realterm type program on a Windows PC to read/write
    on any of the 6 Raspberry4 uart boards


    Since you imply plain text I/O, the simplest route would probably be to SSH into the R-Pi, and then use a command line terminal program on the R-Pi
    to connect to the specific UART(s) -- rather than try to create a terminal server on the R-Pi exporting virtual com ports on Windows..

    https://www.cyberciti.biz/hardware/5-linux-unix-commands-for-connecting-to-the-serial-console/
    {NOTE: subject says "serial console" but you just want raw serial}

    https://linux.die.net/man/1/cu
    """
    cu takes a single argument, besides the options. If the argument is the
    string "dir" cu will make a direct connection to the port. This may only be used by users with write access to the port, as it permits reprogramming
    the modem.
    """

    The "screen" command, alone, doesn't seem that helpful -- at least, most examples seem to assume one is just toggling shell sessions on the
    device; I've only found one example claiming to open connected to a serial port.... Ah, wait https://www.cyberciti.biz/faq/unix-linux-apple-osx-bsd-screen-set-baud-rate/ """
    If a tty name (e.g. “/dev/ttyS0”) is specified as the first parameter to the screen command, the window is directly connected to this device.
    """

    Similar process with "minicom"... SSH from host to R-Pi, start minicom, connect to desired UART/serial port.

    If using something like PuTTY on the Windows box, you could maybe even provide a start-up command to be run when the connection is made -- that command could be to start one of the above commands automatically (you'd
    have a PuTTY configuration defined for each target serial port, so clicking
    on the configuration in PuTTY session control menu would connect to the
    R-Pi, run the appropriate connection command for the port, ...





    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Grant Taylor@3:770/3 to Dennis Lee Bieber on Sat Jan 2 13:31:25 2021
    On 1/2/21 12:48 PM, Dennis Lee Bieber wrote:
    Since you imply plain text I/O, the simplest route would probably be to
    SSH into the R-Pi, and then use a command line terminal program on the
    R-Pi to connect to the specific UART(s) -- rather than try to create
    a terminal server on the R-Pi exporting virtual com ports on Windows..

    This may be a simpler solution. But it often falls quite short of other solutions. Particularly when software is running in a VM that needs to
    connect to a modem to call a bank / CC company / etc. or needs to
    connect to industrial equipment.

    Conversely, drivers that create a virtual serial port that communicates
    across the network will work for these types of special case scenarios.



    --
    Grant. . . .
    unix || die

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Dennis Lee Bieber@3:770/3 to All on Sun Jan 3 12:27:42 2021
    On Sat, 2 Jan 2021 13:31:25 -0700, Grant Taylor
    <gtaylor@tnetconsulting.net> declaimed the following:

    On 1/2/21 12:48 PM, Dennis Lee Bieber wrote:
    Since you imply plain text I/O, the simplest route would probably be to
    SSH into the R-Pi, and then use a command line terminal program on the
    R-Pi to connect to the specific UART(s) -- rather than try to create
    a terminal server on the R-Pi exporting virtual com ports on Windows..

    This may be a simpler solution. But it often falls quite short of other >solutions. Particularly when software is running in a VM that needs to

    But the OP explicitly stated the use of a simple terminal program (though HyperTerm is ancient and $$$, since the light version is no longer available on Windows... TeraTerm and PuTTY in serial connection mode might
    do).

    My approach would probably start with:

    * Take out the Windows box first -- assume keyboard/mouse/monitor connected to R-Pi.
    How would the OP handle the 6 serial ports from this configuration?
    Open 6 shell windows/xterm and run minicom/cu in each (I presume
    they expect to receive some status back from the end devices in response to
    any commands sent, otherwise a simple "echo command > serialport" would
    maybe suffice and only use one shell window/xterm). Too messy? Open one
    shell window/xterm with 6 tabs, each tab running minicom/cu.
    Create a custom application (Python with wxPython/Python GTK/Tkinter...) with input and response widgets, and [send] button?

    * Don't have keyboard/mouse/monitor on the R-Pi?
    Configure the R-Pi VNC server. Install VNC client on the Windows box. Connect to R-Pi using VNC client.
    One now has a window on the Windows box that looks just like the
    monitor did in the previous option, and the same serial port handling is available (minicom/cu in shell window/tab) or custom application.

    * VNC too much overhead?
    Install (if needed) "screen" on the R-Pi. Use PuTTY to SSH into the R-Pi. Start "screen" as a shell (NOT the option for direct connect to
    port). Run minicom/cu on first serial port. Use screen escape sequence to create a second "window", run minicom/cu on second serial port; repeat
    until all six instances are running. Now user screen escape sequences to
    switch from serial port instance to instance.
    Of course, if no responses are expected from the end devices, a single PuTTY session without screen would suffice, using the "echo command
    serialport" operations.
    Note: GUI applications need not apply (though a custom application
    using text-only curses that handles all 6 serial ports at once is feasible)

    * Screen escapes too messy? Text-only too ugly?
    Run a web-server on the R-Pi (nginx?). Create a web-app (flask/django, PHP?) which presents a form with 6 sections (one for each serial port, each section has a command input field, and a response output field).
    The most basic form would require a submit button, probably using
    "GET" and the web-app would extract the sent command(s), deliver them to
    the corresponding ports, collect return status (timeout?), then
    refresh/resend the form with now empty input fields but populated response fields.
    Better might be to have the form use AJAX to dynamically send commands as entered, and receive responses for each port as they become available, instead of undergoing full page refreshes.


    Creating VCPs seems fraught with difficulties. First, one needs a "discovery" mechanism (for USB adapters, that is the USB device enumeration system, which discovers newly connected adapters, queries them for
    capabilities [serial port using xyz chip-set], searches registry for
    chip-set specific driver [or goes on-line to find one], creates VCP
    connected to adapter at address mno, assigns COM port number [and that
    number may change if the adapter is moved to a different USB port]). For a device on the net? Either the discovery module is hard-coded for a specific R-Pi, and "pings" the network looking for it, and the R-Pi is running a
    daemon that collects/distributes network packets, while the discovery
    module creates VCPs that identify specific network port connections (and
    how does one ensure the COM port numbers make logical sense)... OR the discovery module is a passive listener, and the R-Pi broadcasts an
    announcement that it has a serial port -- which any computer on the net
    with a listener could respond to by sending back "I want it" response, and
    then setting up a VCP talking to that handler process on the R-PI -- repeat
    for each port.

    Which leads us back to something like https://www.eltima.com/products/com-port-redirector/ (which, strangely,
    appears to be the same as
    https://www.eltima.com/products/serial-over-ethernet/ with a different
    name). One runs server side on the R-Pi (suspect one has to build from
    source, they likely don't have an ARMHF build), and client side on Windows
    to create the VCPs.




    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Grant Taylor@3:770/3 to Dennis Lee Bieber on Sun Jan 3 14:22:53 2021
    On 1/3/21 10:27 AM, Dennis Lee Bieber wrote:
    But the OP explicitly stated the use of a simple terminal program (though HyperTerm is ancient and $$$, since the light version is no longer available on Windows... TeraTerm and PuTTY in serial connection mode might do).

    And the COM port driver allows a simple terminal program to use the
    remote serial ports.

    How would the OP handle the 6 serial ports from this configuration?

    Six different instances of the COM driver pointed to each remote serial
    port.

    Then HyperTerm / ProComPlus / Quicken / pager program / fax program
    could use COM1, COM2, COM3, COM4, COM5, COM6 at their discretion. Just
    like they would for a hardware COM port.

    You could even have Windows Routing and Remote Access Server provide
    Dial Up Networking on the aforementioned COM ports.

    Open 6 shell windows/xterm and run minicom/cu in each (I presume they
    expect to receive some status back from the end devices in response to
    any commands sent, otherwise a simple "echo command > serialport" would
    maybe suffice and only use one shell window/xterm). Too messy? Open
    one shell window/xterm with 6 tabs, each tab running minicom/cu.

    The pager / fax / banking program that need to connect to a modem on a
    serial port are the exact type of programs that can't / won't use
    something like minicom / cu on a remote machine.

    Create a custom application (Python with wxPython/Python
    GTK/Tkinter...) with input and response widgets, and [send] button?

    That won't work when the time clock / attendance application needs to
    connect to the time clocks in the factory over a serial port.

    * Don't have keyboard/mouse/monitor on the R-Pi?
    Configure the R-Pi VNC server. Install VNC client on the Windows box.
    Connect to R-Pi using VNC client.

    That is untennable in a business environment. Especially when there is
    an option to install a virtual COM port that connects across the network
    and allows the application to run the same way that it has for the last
    15 years.

    One now has a window on the Windows box that looks just like the
    monitor did in the previous option, and the same serial port handling
    is available (minicom/cu in shell window/tab) or custom application.

    Nope.

    It's about more than simply talking to the serial port. It's about
    /how/ you talk to the serial port and /where/ you talk to the serial port.

    Things like the time clock application or the fax software running on
    Windows (where) need (as in they have no choice in the matter) to talk
    to a local (to Windows) COM port (how).

    Note: GUI applications need not apply (though a custom application
    using text-only curses that handles all 6 serial ports at once is
    feasible)

    GUI applications work perfectly fine with the virtual COM port.

    Run a web-server on the R-Pi (nginx?). Create a web-app (flask/django,
    PHP?) which presents a form with 6 sections (one for each serial port,
    each section has a command input field, and a response output field).

    So now you want to add even more complexity -and- code development into
    the process.

    You're selling the virtual COM port for me.

    1) Install and configure the remote serial port server.
    2) Install and configure the virtual COM port driver.
    3) Reconfigure the existing program to use the new COM port.
    4) Profit!!!

    Creating VCPs seems fraught with difficulties.

    Not really.

    It's quite like using an IP port for a printer. It's been quite
    standard for the better part of 30 years. Quite easy to do too.

    Which leads us back to something like https://www.eltima.com/products/com-port-redirector/
    (which, strangely, appears to be the same as https://www.eltima.com/products/serial-over-ethernet/ with a different
    name). One runs server side on the R-Pi (suspect one has to build
    from source, they likely don't have an ARMHF build), and client side
    on Windows to create the VCPs.

    Which seems to be a varient of what I'm describing.



    --
    Grant. . . .
    unix || die

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Dennis Lee Bieber@3:770/3 to All on Sun Jan 3 22:27:53 2021
    o/~ Talking to myself in public o/~

    On Sun, 03 Jan 2021 12:27:42 -0500, Dennis Lee Bieber
    <wlfraed@ix.netcom.com> declaimed the following:

    Run a web-server on the R-Pi (nginx?). Create a web-app (flask/django,
    PHP?) which presents a form with 6 sections (one for each serial port, each >section has a command input field, and a response output field).
    The most basic form would require a submit button, probably using
    "GET" and the web-app would extract the sent command(s), deliver them to
    the corresponding ports, collect return status (timeout?), then >refresh/resend the form with now empty input fields but populated response >fields.
    Better might be to have the form use AJAX to dynamically send
    commands as entered, and receive responses for each port as they become >available, instead of undergoing full page refreshes.


    This might almost be a built-in...

    Node-Red is available for the R-Pi. There appear to be modules available to create a web-page "dashboard". So... It should be possible to define a "flow" for text inputs to a serial port and serial port to an
    output (for any responses).

    I'm not familiar with Node-Red, and for some reason was unable to get said dashboard to display an input item -- I did have a text input node connected to a serial port (send/receive port node -- there are also
    send-only and receive-only nodes).

    This would be simpler than a full-fledged web app and server configuration, since the flows are defined by drag&drop nodes.


    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)