Re: [Linuxptp-devel] [PATCH 4/4] ts2phc: Add serial baudrate option

2021-07-19 Thread Richard Cochran
On Mon, Jul 19, 2021 at 11:00:40AM +, Geva, Erez wrote:
> This looks like a call to send the a patch with these options.
> 
> Richard, How do you think these options should be implemented?
> A single enumerator, separate integer for each?

Whichever is easier.  Maybe a single code like 8n1 parsed by sscanf
format "%d%c%d" ?

Thanks,
Richard


___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


Re: [Linuxptp-devel] [PATCH 4/4] ts2phc: Add serial baudrate option

2021-07-19 Thread Geva, Erez
Hi,

Do you mean this one, page 20?
http://www.leapsecond.com/museum/z3801a/097-z3801-01-iss-1.pdf

Erez

-Original Message-
From: Richard Cochran  
Sent: Monday, 19 July 2021 04:13
To: Hal Murray 
Cc: linuxptp-devel@lists.sourceforge.net
Subject: Re: [Linuxptp-devel] [PATCH 4/4] ts2phc: Add serial baudrate option

On Fri, May 14, 2021 at 10:16:02AM -0700, Hal Murray wrote:
> 
> > I did think of that, yet of the many serial devices I have used they 
> > have all been running with the setting 8/N/1 and no HW flow control.
> 
> The HP Z3801A is 19200 baud, 7 data bits, odd parity

Looks like it is configurable on that device?

8n1 is almost universally used.

We can add a second option if people really are stuck with non-configurable 
equipment.

Thanks,
Richard


___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Flinuxptp-develdata=04%7C01%7Cerez.geva.ext%40siemens.com%7C5ec82f622f0748b51e2d08d94a5ae1e0%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637622576481447078%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=XTst8hWxENV43ybSJo%2Bjg%2FvdL5jnf3HzhXS%2BlxkTp6U%3Dreserved=0


___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


Re: [Linuxptp-devel] [PATCH 4/4] ts2phc: Add serial baudrate option

2021-07-19 Thread Geva, Erez
This looks like a call to send the a patch with these options.

Richard, How do you think these options should be implemented?
A single enumerator, separate integer for each?

Erez

-Original Message-
From: Hal Murray  
Sent: Monday, 19 July 2021 12:39
To: Geva, Erez (ext) (DI PA DCP R 3) 
Cc: linuxptp-devel@lists.sourceforge.net; Hal Murray 
Subject: Re: [Linuxptp-devel] [PATCH 4/4] ts2phc: Add serial baudrate option


erez.geva@siemens.com said:
> Do you mean this one, page 20?
> http://www.leapsecond.com/museum/z3801a/097-z3801-01-iss-1.pdf


Yes, but look down on page 93 (or 5-3)

> Baud Rate:  19200--7 data bits, 1 start bit, 1 stop bit, odd parity 
> (fixed configuration).



--
These are my opinions.  I hate spam.





___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


Re: [Linuxptp-devel] [PATCH 4/4] ts2phc: Add serial baudrate option

2021-07-19 Thread Hal Murray


erez.geva@siemens.com said:
> Do you mean this one, page 20?
> http://www.leapsecond.com/museum/z3801a/097-z3801-01-iss-1.pdf 

Yes, but look down on page 93 (or 5-3)

> Baud Rate:  19200--7 data bits, 1 start bit, 1 stop bit, odd parity
> (fixed configuration).



-- 
These are my opinions.  I hate spam.





___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


Re: [Linuxptp-devel] [PATCH 4/4] ts2phc: Add serial baudrate option

2021-07-18 Thread Richard Cochran
On Sun, Jul 18, 2021 at 07:09:54PM -0700, Richard Cochran wrote:
> Otherwise, the patch is fine.  I'll fix the order myself.

Also, I set a minimum of 300.

Thanks,
Richard


___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


Re: [Linuxptp-devel] [PATCH 4/4] ts2phc: Add serial baudrate option

2021-07-18 Thread Richard Cochran
On Fri, May 14, 2021 at 10:16:02AM -0700, Hal Murray wrote:
> 
> > I did think of that, yet of the many serial devices I have used they have 
> > all
> > been running with the setting 8/N/1 and no HW flow control.
> 
> The HP Z3801A is 19200 baud, 7 data bits, odd parity

Looks like it is configurable on that device?

8n1 is almost universally used.

We can add a second option if people really are stuck with
non-configurable equipment.

Thanks,
Richard


___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


Re: [Linuxptp-devel] [PATCH 4/4] ts2phc: Add serial baudrate option

2021-07-18 Thread Richard Cochran
On Fri, May 14, 2021 at 01:33:44PM +0200, Lars Munch wrote:
> Add serial baudrate configuration option. Default to 9600 bps.
> 
> Signed-off-by: Lars Munch 
> ---
>  config.c |  1 +
>  ts2phc.8 | 23 ---
>  ts2phc_nmea_master.c | 10 +-
>  3 files changed, 18 insertions(+), 16 deletions(-)
> 
> diff --git a/config.c b/config.c
> index 4472d3d..a42a57f 100644
> --- a/config.c
> +++ b/config.c
> @@ -319,6 +319,7 @@ struct config_item config_tab[] = {
>   GLOB_ITEM_STR("ts2phc.nmea_remote_host", ""),
>   GLOB_ITEM_STR("ts2phc.nmea_remote_port", ""),
>   GLOB_ITEM_STR("ts2phc.nmea_serialport", "/dev/ttyS0"),
> + PORT_ITEM_INT("ts2phc.nmea_baudrate", 9600, 0, INT_MAX),

In the future, please preserve alphabetical order of the options
strings.

Otherwise, the patch is fine.  I'll fix the order myself.

Thanks,
Richard


___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


Re: [Linuxptp-devel] [PATCH 4/4] ts2phc: Add serial baudrate option

2021-05-14 Thread Hal Murray


> I did think of that, yet of the many serial devices I have used they have all
> been running with the setting 8/N/1 and no HW flow control.

The HP Z3801A is 19200 baud, 7 data bits, odd parity



-- 
These are my opinions.  I hate spam.





___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


Re: [Linuxptp-devel] [PATCH 4/4] ts2phc: Add serial baudrate option

2021-05-14 Thread Lars Munch
On Fri, May 14, 2021 at 4:45 PM Geva, Erez  wrote:
>
> A great idea to add baud-rate.
>
> Just a suggestion,
> As I remember from gtkterm application.
>
> It provide setting: port name, Baud rate, parity, bits, stop bit, and flow 
> control.
>
> What do you think of adding all of the setting?

I did think of that, yet of the many serial devices I have used they
have all been running with the
setting 8/N/1 and no HW flow control. Just checked gpsd and they do
not even provide an option
for it, so I guess it is not really needed. It can always be added
later if need be.

Regards
Lars


___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


Re: [Linuxptp-devel] [PATCH 4/4] ts2phc: Add serial baudrate option

2021-05-14 Thread Geva, Erez
A great idea to add baud-rate.

Just a suggestion, 
As I remember from gtkterm application.

It provide setting: port name, Baud rate, parity, bits, stop bit, and flow 
control.

What do you think of adding all of the setting?

Erez

-Original Message-
From: Lars Munch  
Sent: Friday, 14 May 2021 13:34
To: linuxptp-devel@lists.sourceforge.net
Subject: [Linuxptp-devel] [PATCH 4/4] ts2phc: Add serial baudrate option

Add serial baudrate configuration option. Default to 9600 bps.

Signed-off-by: Lars Munch 
---
 config.c |  1 +
 ts2phc.8 | 23 ---
 ts2phc_nmea_master.c | 10 +-
 3 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/config.c b/config.c
index 4472d3d..a42a57f 100644
--- a/config.c
+++ b/config.c
@@ -319,6 +319,7 @@ struct config_item config_tab[] = {
GLOB_ITEM_STR("ts2phc.nmea_remote_host", ""),
GLOB_ITEM_STR("ts2phc.nmea_remote_port", ""),
GLOB_ITEM_STR("ts2phc.nmea_serialport", "/dev/ttyS0"),
+   PORT_ITEM_INT("ts2phc.nmea_baudrate", 9600, 0, INT_MAX),
PORT_ITEM_INT("ts2phc.pin_index", 0, 0, INT_MAX),
GLOB_ITEM_INT("ts2phc.pulsewidth", 5, 100, 99900),
PORT_ITEM_ENU("tsproc_mode", TSPROC_FILTER, tsproc_enu), diff --git 
a/ts2phc.8 b/ts2phc.8 index 99067c5..690c462 100644
--- a/ts2phc.8
+++ b/ts2phc.8
@@ -146,19 +146,20 @@ set to 0.0, the servo will never step the clock except on 
start.
 The default is 0.0.
 .TP
 .B ts2phc.nmea_remote_host, ts2phc.nmea_remote_port -Specifies the serial port 
character device providing ToD information -when using the "nmea" PPS signal 
source.  Note that if these two -options are both specified, then the given 
remote connection will be -used in preference to the configured serial port.
-These options default to the empty string, that is, not specified.
-.TP
-.B ts2phc.nmea_serialport
-Specifies the serial port character device providing ToD information -when 
using the "nmea" PPS signal source.  Note that if the options, 
-ts2phc.nmea_remote_host and ts2phc.nmea_remote_port, are both
+Specifies the remote host providing ToD information when using the 
+"nmea" PPS signal source.  Note that if these two options are both
 specified, then the given remote connection will be used in preference  to the 
configured serial port.
-The default is "/dev/ttyS0".
+These options default to the empty string, that is, not specified.
+.TP
+.B ts2phc.nmea_serialport, ts2phc.nmea_baudrate Specifies the serial 
+port and baudrate in bps for character device providing ToD information 
+when using the "nmea" PPS signal source. Note that if the options, 
+ts2phc.nmea_remote_host and ts2phc.nmea_remote_port, are both 
+specified, then the given remote connection will be used in preference 
+to the configured serial port.
+The default serial port is "/dev/ttyS0".
+The default baudrate is 9600 bps.
 .TP
 .B ts2phc.pulsewidth
 The expected pulse width of the external PPS signal in nanoseconds.
diff --git a/ts2phc_nmea_master.c b/ts2phc_nmea_master.c index 2fc460d..a383429 
100644
--- a/ts2phc_nmea_master.c
+++ b/ts2phc_nmea_master.c
@@ -23,7 +23,6 @@
 #include "ts2phc_nmea_master.h"
 #include "util.h"
 
-#define BAUD   9600
 #define MAX_RMC_AGE50ULL
 #define NMEA_TMO   2000 /*milliseconds*/
 
@@ -45,7 +44,7 @@ struct ts2phc_nmea_master {  };
 
 static int open_nmea_connection(const char *host, const char *port,
-   const char *serialport)
+   const char *serialport, int baud)
 {
int fd;
 
@@ -56,7 +55,7 @@ static int open_nmea_connection(const char *host, const char 
*port,
}
return fd;
}
-   fd = serial_open(serialport, BAUD, 0, 0);
+   fd = serial_open(serialport, baud, 0, 0);
if (fd == -1) {
pr_err("failed to open nmea source %s", serialport);
}
@@ -70,7 +69,7 @@ static void *monitor_nmea_status(void *arg)
char *host, input[256], *port, *ptr, *uart;
struct ts2phc_nmea_master *master = arg;
struct timespec rxtime, tmo = { 2, 0 };
-   int cnt, num, parsed;
+   int cnt, num, parsed, baud;
struct nmea_rmc rmc;
struct timex ntx;
 
@@ -81,12 +80,13 @@ static void *monitor_nmea_status(void *arg)
host = config_get_string(master->config, NULL, 
"ts2phc.nmea_remote_host");
port = config_get_string(master->config, NULL, 
"ts2phc.nmea_remote_port");
uart = config_get_string(master->config, NULL, 
"ts2phc.nmea_serialport");
+   baud = config_get_int(master->config, NULL, "ts2phc.nmea_baudrate");
memset(, 0, sizeof(ntx));
ntx.modes = ADJ_NANO;
 
while (is_running()) {
if (pfd.fd == -1) {
-   pfd.fd = open_nmea_connection(host, port, uart);
+   pfd.fd = open_nmea_connection(host, port, uart, baud);
if (pfd.fd == -1) {