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

Pete Soper pete at soper.us
Thu Feb 28 10:27:33 CST 2019


On 2/28/19 8:54 AM, John Vaughters via TriEmbed wrote:
> > But I need to go a step further. To assign a name like "NW-FOO" to the 
> XDS110 in the NW corner of my "test range" I'd need to interpose in 
> Udev somehow so it could do the thing to determine which is which.
>
> Right, so are you saying that you do not have unique serial #'s?. The 
> technique described relies on specific devices with serial numbers,
I'm struggling to understand what you mean exactly by serial number in 
this context. Does each USB interface chip (or emulation hardware) have 
a unique serial number along with the manufacturer ID and device ID that 
we see with lsusb? I just assumed they don't and it's up to me to 
extract a standard ID (such as can be programmed into the debug probes) 
or something ad hoc (e.g. with a custom Arduino boot loader recognizing 
a "gimme your UID" command).

I went backwards from you, spending about 10 years with Debian Stable 
before going to the dark side with Ubuntu 13. I regret that, but am 
afraid some key tool my work depends on simply won't play with what was 
a solid rock of reliability. Maybe I should grease up VirtualBox and see 
if I could reverse course.
-Pete
> so if you have to change an Arduino Nano out for instance, you would 
> also need to change the rule to use the new serial number. UDEV is 
> extremely flexible and I haven't even touched the surface of it, so if 
> you write more generic rules to just capture Arduino vs XYX, then I am 
> sure you could find a rule to increment your naming. I used this 
> technique to utilize the serial number to always connect to a specific 
> name. It worked quite well for fixing reconnects where it would 
> normally increment. However, it still did not fix just plain 
> disconnects common in USB. I am not a fan of the USB software layer 
> and I absolutely despise its physical connections. Having said all 
> that I still use it in many ways, I have to, it's all there is for 
> many things. And this solution described with UDEV and serial #'s 
> actually worked quite well at solving the vast majority of issues and 
> was quite stable. Probably fine for non-critical uses.
>
> Example FTDI Serial #
>
> ATTRS{serial}=="A600G5OZ"
>
> >I regret going with Ubuntu 18.04
>
> You are making me feel better about keeping my Ubuntu 16 or is it 14? 
> Anyway, I am done with Ubuntu. it drives me crazy in the same way that 
> windows does, by making decisions for you and assuming the user needs 
> to be probed constantly to act. I have always been a RedHat person, 
> but thanks to Rpi and many other embedded devices, I am now a HUGE fan 
> of Debian. I will not be going to Ubuntu for new installs unless I am 
> setting it up for non-technical users, then Ubuntu is still the #1 go 
> to. For me though, Ubuntu just annoys the crap out of me in so many 
> ways. The problem with RedHat (Centos) is it just doesn't keep up to 
> date for newer software, so I have to use something else for that. It 
> has been Ubuntu, but now it's Debian.
>
> On Wednesday, February 27, 2019, 8:55:07 PM EST, Pete Soper via 
> TriEmbed <triembed at triembed.org> wrote:
>
>
> 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
> Thanks. That's a nice how-to and will make it easy to differentiate 
> between the TI XDS110 debug probes and Beaglebone boards that both 
> manifest as /dev/ttyACMn and between instances of custom devices and 
> the Arduino Nano's I'm using to run some motors that both manifest as 
> /dev/ttyUSBn. But I need to go a step further. To assign a name like 
> "NW-FOO" to the XDS110 in the NW corner of my "test range" I'd need to 
> interpose in Udev somehow so it could do the thing to determine which 
> is which. For the XDS110 there's a TI program that (if you repeat it 
> enough times: flaky as heck) puts out strings including the ID string, 
> but for the custom device I need to use expect to poke something into 
> the port and get back the ID (and same for the Arduino motor 
> controllers).
>
> So the question is whether there's a hook mechanism with Udev that 
> would allow running a command as a side effect of the device's 
> detection and name assignment under /dev. Especially if that could be 
> run as root I could create the symbolic link and properly set its 
> group id. Or maybe the invoked program/script could simply rename the 
> device after it's probed it?
>
> I agree that USB has got further to go. I regret going with Ubuntu 
> 18.04 for my latest PC 'cause Code Composer Studio seems to be much 
> less able to manage the debug probes than when it's running on 16.04. 
> Over on the TriLUG list there's been griping about 18.04 having 
> regressions and that matches my experience.
>
> -Pete
>> 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 
>> <http://combustory.com/wiki/index.php/Arduino_Communications_Device_Naming_with_udev>
>>
>>
>> 	
>>
>>
>> 	
>>
>>
>>     Arduino Communications Device Naming with udev - Combustory
>>
>> <http://combustory.com/wiki/index.php/Arduino_Communications_Device_Naming_with_udev>
>>
>>
>> On Wednesday, February 27, 2019, 4:41:50 PM EST, Pete Soper via 
>> TriEmbed <triembed at triembed.org> <mailto: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 <mailto: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 
>> <mailto:unsubscribe-TriEmbed at bitser.net>?subject=unsubscribe
>>
>>
>>
>> _______________________________________________
>> Triangle, NC Embedded Computing mailing list
>>
>> To post message:TriEmbed at triembed.org  <mailto: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 <mailto: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 
> <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
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.triembed.org/pipermail/triembed_triembed.org/attachments/20190228/e17dce7a/attachment.htm>


More information about the TriEmbed mailing list