lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070314205732.GI22466@csclub.uwaterloo.ca>
Date:	Wed, 14 Mar 2007 16:57:32 -0400
From:	lsorense@...lub.uwaterloo.ca (Lennart Sorensen)
To:	Rodolfo Giometti <giometti@...eenne.com>
Cc:	linux-kernel@...r.kernel.org, linuxpps@...enneenne.com,
	Russell King <rmk+lkml@....linux.org.uk>,
	Jan Dittmer <jdi@....org>, Pavel Machek <pavel@....cz>
Subject: Re: [PATCH 1/1] LinuxPPS: Pulse per Second support for Linux

On Wed, Mar 14, 2007 at 04:47:32PM +0100, Rodolfo Giometti wrote:
> On Wed, Mar 14, 2007 at 11:37:05AM -0400, Lennart Sorensen wrote:
> > Well here is my current version of the refclock_nmea.c.patch for
> > LinuxPPS.  It now uses /dev/gps# for the nmea messages and /dev/pps# for
> > the PPS device (which in my case is of course the same device).  I am
> > running some more tests on it, but I think it is OK.
> 
> Thanks, published. :)

Well it does work for our GPS receiver at least.  Of course I have to
change the baud rate in the driver since our unit doens't use the NNEA
standard 4800.  And the configure script for ntp doesn't recognize the
v2 PPSAPI, so I have to manually explain to it that I have the PPS API
and it should actually include it.

Here is my utility for enabling PPS on my serial port now.  Seems less
of a pain that patching setserial and including that (with 256MB flash
space, setserial seems wasteful).

ppsctl.c
--------
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <linux/serial.h>

void usage(char *name) {
	fprintf(stderr,"Usage: %s /dev/port [0|1]\n",name);
	fprintf(stderr,"Where 0 means disable PPS and 1 means enable PPS\n");
}

int main(int argc, char *argv[]) {
	int fd;
	char *state;

	if(argc<3) {
		usage(argv[0]);
		return 1;
	}
	fd = open(argv[1],O_RDWR);
	if (fd>=0) {
		struct serial_struct  ss;
		if (ioctl(fd, TIOCGSERIAL, &ss) < 0 ) {
			perror("TIOCGSERIAL");
			return 1;
		} else {
			if(strcmp(argv[2],"1")==0) {
				ss.flags |= ASYNC_HARDPPS_CD;
				state="enabled";
			} else if(strcmp(argv[2],"0")==0) {
				ss.flags &= ~ASYNC_HARDPPS_CD;
				state="disabled";
			} else {
				fprintf(stderr,"Invalid state argument \"%s\"\n",argv[2]);
				return 1;
			}
			if (ioctl(fd, TIOCSSERIAL, &ss) < 0) {
				perror("TIOCSSERIAL");
			} else {
				fprintf(stderr,"PPS on %s is now %s\n",argv[1],state);
			}
		}
	} else {
		fprintf(stderr,"Can't open \"%s\":",argv[1]);
		perror("");
	}
	return 0;
}

/* vim:ts=4:shiftwidth=4:
 * */

--
Len Sorensen
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ