[TriEmbed] best tool for automagic interaction with USB serial ports

Huan Truong htruong at tnhh.net
Wed Feb 27 23:00:30 CST 2019


Naming and Linuxy-stuff aside,...

I think this is a great oportunity to use a state machine design. I
haven't found a state machine compiler that I really seem to like, but
I do think that you'll be able to cook up much more robust test
scenarios with a state machine, while with "expect" you can only test
one code path with one sort of answer.

I've had fun in the past trying to cook up IRC clients, SMTP clients
and printer drivers. Being able to keep track of where we are in the
handshake, data transmission and teardown is key to have a program
that knows what to do in each and every scenario.

Something like this might work:
https://github.com/unclebob/CC_SMC



On Wed, Feb 27, 2019 at 7:10 PM Pete Soper via TriEmbed
<triembed at triembed.org> wrote:
>
> On second glance I see some extra logic would have to be added to the Udev rule to assign consecutive numbers to names like 'arduino_1', 'arduino_2', etc. But default rules do this somehow.
> -Pete
>
>
> On 2/27/19 7:16 PM, John Vaughters via TriEmbed wrote:
>
>
> Pete,
>
> If you are using the same USB devices all the time and do not expect changes, consider doing udev rules. Below is an article I wrote about it. Basically it recognizes your USB device based on certain ID's and you can name the device whatever you want. As far as communicating, "expect" scripts is as good as any tool I can think of. The only thing that is probably better is Tera-Term, but that is strictly windows. It is quite good though and I wrote a tool to run scripts to 300 edge routers using Tera-Term. One thing I used to do is use "socat" to send the serial device to a raw TCP port and communicate over the network. In general I do everything I can to not communicate to USB devices due to their constant connection issues. I prefer using UART if possible.
>
> Good Luck,
>
> John Vaughters
>
> Arduino Communications Device Naming with udev - Combustory
>
>
>
>
> Arduino Communications Device Naming with udev - Combustory
>
>
>
> On Wednesday, February 27, 2019, 4:41:50 PM EST, Pete Soper via TriEmbed <triembed at triembed.org> wrote:
>
>
> It's been many years since I used the Unix "expect" command but that was
> the industrial strength solution for automated interaction with a serial
> connection such as via ssh where you specify a "script" of "this is
> sent, this is what's received back", interactions and the logic to take
> actions based on the interaction details. What's out there now that I
> should be using, or is this still the best way to go? My host
> environment choices are Linux or Cygwin (inside a VM).
>
> My situation is that I have three or four flavors of device that I need
> to connect to with either ssh or a terminal emulator where a script of
> some sort dictates what I have to send and what I expect back. This, in
> turn, is to deal with the musical chair situation with USB connections
> such as when I get intermittent electrical service from Duke Energy (at
> no extra cost!) I've got an automated test system where there are, for
> example, /dev/ttyACM{0,1,2,3,4,5,6,7}, /dev/USB{0,1,2,3}, etc, and I
> need to establish and keep fresh meaninfully named symlinks that get
> associated with the right devices assigned randomly by system startups,
> being forced to unconnect/reconnect cables, etc.
>
> .
> Thanks,
> Pete
>
>
> _______________________________________________
> Triangle, NC Embedded Computing mailing list
>
> To post message: TriEmbed at triembed.org
> List info: http://mail.triembed.org/mailman/listinfo/triembed_triembed.org
> TriEmbed web site: http://TriEmbed.org
> To unsubscribe, click link and send a blank message: mailto:unsubscribe-TriEmbed at bitser.net?subject=unsubscribe
>
>
> _______________________________________________
> Triangle, NC Embedded Computing mailing list
>
> To post message: TriEmbed at triembed.org
> List info: http://mail.triembed.org/mailman/listinfo/triembed_triembed.org
> TriEmbed web site: http://TriEmbed.org
> To unsubscribe, click link and send a blank message: mailto:unsubscribe-TriEmbed at bitser.net?subject=unsubscribe
>
>
> _______________________________________________
> Triangle, NC Embedded Computing mailing list
>
> To post message: TriEmbed at triembed.org
> List info: http://mail.triembed.org/mailman/listinfo/triembed_triembed.org
> TriEmbed web site: http://TriEmbed.org
> To unsubscribe, click link and send a blank message: mailto:unsubscribe-TriEmbed at bitser.net?subject=unsubscribe
>


-- 

Huan Truong
www tnhh.net / twitter @huant




More information about the TriEmbed mailing list