Page 1 of 1

[patch] Support for persistent USB paths

PostPosted: Wed Nov 29, 2017 10:26 am
by rickvanderzwet
Persistent USB path listings are currently recognized as hostname, due to the colon in the path:

Code: Select all

Those are useful to support, since they will not change names as their /dev/ttyUSBX counterparts do, when you have multiple installed.

Since forward slash is not supported in hostname, more strict checking at hostname level should fix it:
Code: Select all
diff -ur ../otmonitor.vfs.orig/otmonitor.tcl ./otmonitor.tcl
--- ../otmonitor.vfs.orig/otmonitor.tcl   2017-11-29 10:00:59.575541879 +0100
+++ ./otmonitor.tcl   2017-11-29 10:18:34.525891843 +0100
@@ -1537,7 +1537,7 @@
   } elseif {[llength $arg] == 0} {
       # Use default/saved connection settings
-   } elseif {[regexp {^(.+):(.+)} $fn -> host port]} {
+   } elseif {[regexp {^([^/]+):(.+)} $fn -> host port]} {
       set optcfg(connection,type) tcp
       set optcfg(connection,host) $host
       set optcfg(connection,port) $port

FYI: The source code file has otmonitor.orig included, is this intended on purpose?
Code: Select all
$ unzip -t ~/  | grep orig
    testing: otmonitor.vfs/otmonitor.tcl.orig   OK

Re: [patch] Support for persistent USB paths

PostPosted: Thu Nov 30, 2017 6:05 pm
by hvxl
Persistent USB paths only work if you always use the same USB port to connect the OTGW. For that reason I usually use an udev rule to create a symbolic link from something like /dev/otgw to the USB device. Then you can just specify "/dev/otgw" in otmonitor.

Of course you can only use that technique if you have root access. So I will implement your suggestion as that works for regular users as well. Thanks.

And no, otmonitor.tcl.orig was not supposed to be in the zip file.