ser2net icon indicating copy to clipboard operation
ser2net copied to clipboard

Help Converting .conf to . yaml

Open Quicksilver2002 opened this issue 1 year ago • 4 comments

Hi, I'm working on a project that was originally setup by someone else using the .conf. file I'm trying to convert to .Yaml, but I'm not sure how to do some of the conversions. Specifically, the raw:600 portion and the XONXOFF. The conf settings, and my new yaml are listed below. Can someone explain how I would add these in the Yaml file? Thanks!

Original .conf. `BANNER:banner:\r\nSer2net \p device \d [\s] \r\nConnection will stay open for 10 min \r\n\r\n

1041:raw:600:/dev/ttyUSB0:9600 8DATABITS NONE 1STOPBIT XONXOFF banner 32010:raw:600:/dev/ttyUSB0:9600 8DATABITS NONE 1STOPBIT banner 32011:raw:600:/dev/ttyUSB0:57600 8DATABITS NONE 1STOPBIT banner 32012:raw:600:/dev/ttyUSB0:115200 8DATABITS NONE 1STOPBIT banner `

This is how I have the .yaml

`%YAML 1.1

define: &banner \r\nSer2net \p device \d [\s] \r\n /r/n/r/n

connection: &con1 accepter: tcp,1041 enable: on options: banner: *banner kickolduser: true telnet-brk-on-sync: true connector: serialdev, /dev/ttyUSB0, 9600n81,local

connection: &con2 accepter: tcp,9100 enable: on options: banner: *banner kickolduser: true telnet-brk-on-sync: true connector: serialdev, /dev/ttyUSB0, 9600n81,local

connection: &con3 accepter: tcp,32011 enable: on options: banner: *banner kickolduser: true telnet-brk-on-sync: true connector: serialdev, /dev/ttyUSB0, 57600n81,local

connection: &con4 accepter: tcp,32012 enable: on options: banner: *banner kickolduser: true telnet-brk-on-sync: true connector: serialdev, /dev/ttyUSB0, 115200n81,local

`

Quicksilver2002 avatar May 16 '24 16:05 Quicksilver2002

On Thu, May 16, 2024 at 11:46 AM Quicksilver2002 @.***> wrote:

Hi, I'm working on a project that was originally setup by someone else using the .conf. file I'm trying to convert to .Yaml, but I'm not sure how to do some of the conversions. Specifically, the raw:600 portion and the XONXOFF. The conf settings, and my new yaml are listed below. Can someone explain how I would add these in the Yaml file? Thanks!

raw is the default if you just use "tcp".

Original .conf. `BANNER:banner:\r\nSer2net \p device \d [\s] \r\nConnection will stay open for 10 min \r\n\r\n

1041:raw:600:/dev/ttyUSB0:9600 8DATABITS NONE 1STOPBIT XONXOFF banner 32010:raw:600:/dev/ttyUSB0:9600 8DATABITS NONE 1STOPBIT banner 32011:raw:600:/dev/ttyUSB0:57600 8DATABITS NONE 1STOPBIT banner 32012:raw:600:/dev/ttyUSB0:115200 8DATABITS NONE 1STOPBIT banner `

This is how I have the .yaml `%YAML 1.1

define: &banner \r\nSer2net \p device \d [\s] \r\n /r/n/r/n

connection: &con1

Add: timeout: 600 to all the connections.

accepter: tcp,1041 enable: on options: banner: *banner kickolduser: true telnet-brk-on-sync: true connector: serialdev, /dev/ttyUSB0, 9600n81,local

append ,xonxoff to the above line.

connection: &con2 accepter: tcp,9100 enable: on options: banner: *banner kickolduser: true telnet-brk-on-sync: true connector: serialdev, /dev/ttyUSB0, 9600n81,local

connection: &con3 accepter: tcp,32011 enable: on options: banner: *banner kickolduser: true telnet-brk-on-sync: true connector: serialdev, /dev/ttyUSB0, 57600n81,local

connection: &con4 accepter: tcp,32012 enable: on options: banner: *banner kickolduser: true telnet-brk-on-sync: true connector: serialdev, /dev/ttyUSB0, 115200n81,local

`

— Reply to this email directly, view it on GitHub https://github.com/cminyard/ser2net/issues/126, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBPTGFOLTK4RPZ2A7E6LDDZCTPGFAVCNFSM6AAAAABH2S2UJSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGMYDAOBYGQYTMNY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

cminyard avatar May 16 '24 19:05 cminyard

wow! Thanks for the quick response! I appreciated the info. I will get these changes made.

I've been reading ser2net(5) and ser2net(8), and I'm having a hard time understanding the banner and how it works. Its working how it is now, but I'm trying to understand the reasoning behind it. I understand \r\n does a new line, but is this for the data I'm sending to it? I was thinking it was "formatting" the data I was sending but doesn't appear to have the correct amount of carriage returns for that so maybe it's not for the data I'm sending. I'm sending 5 fields of data. The data I'm sending looks like this

<HP123-12 Test Description 076-007 2207260105 25000>

Also, the .conf has a [\s] in the banner and I'm not sure why that's in square brackets. It also says, "Connection will stay open for 10 min", I removed that line in my .yaml and it didn't see to affect anything.

In the .conf file its BANNER:banner:\r\nSer2net \p device \d [\s] \r\nConnection will stay open for 10 min \r\n\r\n

Yaml file define: &banner \r\nSer2net \p device \d [\s] \r\n \r\n\r\n

Was just curious if maybe you could help clarify this a little for me. Thanks!

Quicksilver2002 avatar May 20 '24 14:05 Quicksilver2002

On Mon, May 20, 2024 at 07:35:48AM -0700, Quicksilver2002 wrote:

wow! Thanks for the quick response! I appreciated the info. I will get these changes made.

I've been reading ser2net(5) and ser2net(8), and I'm having a hard time understanding the banner and how it works. Its working how it is now, but I'm trying to understand the reasoning behind it. I understand \r\n does a new line, but is this for the data I'm sending to it? I was thinking it was "formatting" the data I was sending but doesn't appear to have the correct amount of carriage returns for that so maybe it's not for the data I'm sending. I'm sending 5 fields of data. The data I'm sending looks like this

<HP123-12 Test Description 076-007 2207260105 25000>

Also, the .conf has a [\s] in the banner and I'm not sure why that's in square brackets. It also says, "Connection will stay open for 10 min", I removed that line in my .yaml and it didn't see to affect anything.

The [] doesn't mean anything, it just makes it easier to see the parameters. The \s prints the serial port parameters (115200n81 ). What in here is just text.

The \r\n thing has to do with how terminals do newlines for the cursor. Technically, a \n moves the cursor immediately down line line (if you are on line 10 column 20, it will move to line 11 column 20). A \r is a carraige return, meaning it moves the cursor to the beginning of the current line. So to to go the beginning of the next line, \r\n. This is confused to some extent because "C" uses \n for it's newline character, but when it prints \n the OS will translate that to \r\n.

The banner is just normal text, except the things prefixed by \ cause either special characters to be inserted or information strings about the connection.

-corey

In the .conf file its BANNER:banner:\r\nSer2net \p device \d [\s] \r\nConnection will stay open for 10 min \r\n\r\n

Yaml file define: &banner \r\nSer2net \p device \d [\s] \r\n \r\n\r\n

Was just curious if maybe you could help clarify this a little for me. Thanks!

-- Reply to this email directly or view it on GitHub: https://github.com/cminyard/ser2net/issues/126#issuecomment-2120590650 You are receiving this because you commented.

Message ID: @.***>

cminyard avatar May 20 '24 15:05 cminyard

I really appreciate your help Thanks!

Quicksilver2002 avatar May 20 '24 21:05 Quicksilver2002

This appears to be done, please re-open if you have other questions or issues.

cminyard avatar Jul 16 '24 16:07 cminyard