Bug#803031: patch: support serial serial dev/serial/by-path names
On 06/28/2016 07:27 AM, Riku Voipio wrote: On 27 June 2016 at 21:56, Marc Haberwrote: On Sun, Jun 26, 2016 at 10:39:04PM +0200, Marc Haber wrote: On Mon, Oct 26, 2015 at 10:10:35AM +0200, Riku Voipio wrote: ser2net uses : as field separator in ser2net.conf. Udev creates by-path and by-id paths to identify unique serial ports. These paths are highly useful as ttyUSB* might end up shuffling around. I have forwarded this upstream. Here is upstream's answer: |Unfortunately, the patch provided is not really a very good idea. If there |is a quote later in the data (after the separating :), it would break things |up wrong. Fair enough, it's a quick hack. | |To do this right would require more complicated parsing or some creative |handling. I've come up with the following options: | |* Do complicated parsing |* Do backslash handling and use \x3a for the colon. |* Allow a name (like BANNER) to be created for a device. option 4) use a standard format like yaml and get quoting/escaping automatically. hand-crafted parsers are a bit risky anyways. Yeah, I wish I had started with yaml. Unfortunately, I can't really change the format now, or I'll have to be able to read two formats. -corey | |Of the three, I prefer the last. These device paths are long and fairly |meaningless, this would allow a meaningful name to be created for these |devices. And it would probably be the simplest. | |-corey He is also now subscribed here. Welcome, corey. Thanks for working on ser2net! Riku
Bug#803031: patch: support serial serial dev/serial/by-path names
On 27 June 2016 at 21:56, Marc Haberwrote: > On Sun, Jun 26, 2016 at 10:39:04PM +0200, Marc Haber wrote: >> On Mon, Oct 26, 2015 at 10:10:35AM +0200, Riku Voipio wrote: >> > ser2net uses : as field separator in ser2net.conf. Udev creates by-path and >> > by-id paths to identify unique serial ports. These paths are highly >> > useful as ttyUSB* might end up shuffling around. >> I have forwarded this upstream. > Here is upstream's answer: > |Unfortunately, the patch provided is not really a very good idea. If there > |is a quote later in the data (after the separating :), it would break things > |up wrong. Fair enough, it's a quick hack. > | > |To do this right would require more complicated parsing or some creative > |handling. I've come up with the following options: > | > |* Do complicated parsing > |* Do backslash handling and use \x3a for the colon. > |* Allow a name (like BANNER) to be created for a device. option 4) use a standard format like yaml and get quoting/escaping automatically. hand-crafted parsers are a bit risky anyways. > | > |Of the three, I prefer the last. These device paths are long and fairly > |meaningless, this would allow a meaningful name to be created for these > |devices. And it would probably be the simplest. > | > |-corey > > He is also now subscribed here. Welcome, corey. Thanks for working on ser2net! Riku
Bug#803031: patch: support serial serial dev/serial/by-path names
tags #803031 - patch thanks On Sun, Jun 26, 2016 at 10:39:04PM +0200, Marc Haber wrote: > On Mon, Oct 26, 2015 at 10:10:35AM +0200, Riku Voipio wrote: > > ser2net uses : as field separator in ser2net.conf. Udev creates by-path and > > by-id paths to identify unique serial ports. These paths are highly > > useful as ttyUSB* might end up shuffling around. > > I have forwarded this upstream. Here is upstream's answer: |Unfortunately, the patch provided is not really a very good idea. If there |is a quote later in the data (after the separating :), it would break things |up wrong. | |To do this right would require more complicated parsing or some creative |handling. I've come up with the following options: | |* Do complicated parsing |* Do backslash handling and use \x3a for the colon. |* Allow a name (like BANNER) to be created for a device. | |Of the three, I prefer the last. These device paths are long and fairly |meaningless, this would allow a meaningful name to be created for these |devices. And it would probably be the simplest. | |-corey He is also now subscribed here. Welcome, corey. Greetings Marc -- - Marc Haber | "I don't trust Computers. They | Mailadresse im Header Leimen, Germany| lose things."Winona Ryder | Fon: *49 6224 1600402 Nordisch by Nature | How to make an American Quilt | Fax: *49 6224 1600421
Bug#803031: patch: support serial serial dev/serial/by-path names
tags #803031 patch upstream forwarded #803031 upstream thanks Hi Riko On Mon, Oct 26, 2015 at 10:10:35AM +0200, Riku Voipio wrote: > ser2net uses : as field separator in ser2net.conf. Udev creates by-path and > by-id paths to identify unique serial ports. These paths are highly > useful as ttyUSB* might end up shuffling around. I have forwarded this upstream. > Github seems to carry severaly useful forks of ser2net, all in having > useful features yet not beeing very actively maintained :( > > https://github.com/longshine/ser2nets > https://github.com/Lingku/mser2net I am aware of that. I'd like to stay with upstream though. Greetings Marc -- - Marc Haber | "I don't trust Computers. They | Mailadresse im Header Leimen, Germany| lose things."Winona Ryder | Fon: *49 6224 1600402 Nordisch by Nature | How to make an American Quilt | Fax: *49 6224 1600421
Bug#803031: patch: support serial serial dev/serial/by-path names
Package: ser2net Version: 2.9.1-1 Severity: wishlist Tags: patch Hi, ser2net uses : as field separator in ser2net.conf. Udev creates by-path and by-id paths to identify unique serial ports. These paths are highly useful as ttyUSB* might end up shuffling around. But the by-path symlink has always a : in the filename, and by-id might: # arndale 7001:telnet:0:'/dev/serial/by-path/pci-:00:1d.0-usb-0:1.8.4.2:1.0-port0':115200 8DATABITS NONE 1STOPBIT In this case the by-id doesn't, but it illustrates that the name comes from the device and can have anything in the name. The attached patch adds quoting to ser2net device name: --- x/ser2net-2.9.1/readconfig.c2013-07-24 19:04:39.0 +0300 +++ ser2net-2.9.1/readconfig.c 2015-10-26 09:55:53.973462321 +0200 @@ -379,7 +379,14 @@ return; } -devname = strtok_r(NULL, ":", _data); +if (strtok_data[0] == '\'') { +/* device name may contains character ':' + eg. 2003:raw:5:'/dev/serial/by-path/pci-:00:1d.1-usb-0:2.1:1.0-port0':9600 */ +devname = strtok_r(NULL, "'", _data); +} +else { +devname = strtok_r(NULL, ":", _data); +} if (devname == NULL) { syslog(LOG_ERR, "No device name given on line %d", lineno); return; origin of patch: https://github.com/Lingku/mser2net/commit/e36aa4b12d896e056c13759105ee9380c1f20fbe Github seems to carry severaly useful forks of ser2net, all in having useful features yet not beeing very actively maintained :( https://github.com/longshine/ser2nets https://github.com/Lingku/mser2net Riku