[patch] Support for persistent USB paths

This Forum is about the Opentherm gateway (OTGW) from Schelte

Moderator: hvxl

Post Reply
rickvanderzwet
Starting Member
Starting Member
Posts: 11
Joined: Sun Jan 08, 2017 6:01 pm
Location: Zoeterwoude
Contact:

[patch] Support for persistent USB paths

Post by rickvanderzwet »

Persistent USB path listings are currently recognized as hostname, due to the colon in the path:

Code: Select all

/sys/devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.4/3-3.4.2/3-3.4.2:1.0/ttyUSB0/tty/ttyUSB0/device
/dev/serial/by-path/platform-20980000.usb-usb-0:1.3.4.1:1.0-port0
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 @@
 	    help
 	} 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 ~/otmonitor.zip  | grep orig
    testing: otmonitor.vfs/otmonitor.tcl.orig   OK
hvxl
Senior Member
Senior Member
Posts: 1965
Joined: Sat Jun 05, 2010 11:59 am
Contact:

Re: [patch] Support for persistent USB paths

Post 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.
Schelte
Post Reply

Return to “Opentherm Gateway Forum”