diff options
author | Gary E. Miller <gem@rellim.com> | 2010-07-21 23:09:52 -0700 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2010-07-21 23:09:52 -0700 |
commit | e40d4560be8bc3b6a9be72187a3664b594195be2 (patch) | |
tree | e9968d35d2982327963db0d4c0ecd0eb5ca12b38 /libgpsd_core.c | |
parent | 8aec7fa3289438bd0a93ce6977f042707fd8bb33 (diff) | |
download | gpsd-e40d4560be8bc3b6a9be72187a3664b594195be2.tar.gz |
Reading the contents of /sys/class/pps/pps?/path now to find right /dev/pps?
Just need to do the actual match next.
Diffstat (limited to 'libgpsd_core.c')
-rw-r--r-- | libgpsd_core.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/libgpsd_core.c b/libgpsd_core.c index 06e5d26b..1bf90731 100644 --- a/libgpsd_core.c +++ b/libgpsd_core.c @@ -161,6 +161,7 @@ static int init_kernel_pps(struct gps_device_t *session) { pps_params_t pp; glob_t globbuf; int i; + char path[20] = ""; if ( !isatty(session->gpsdata.gps_fd) ) { @@ -185,10 +186,17 @@ static int init_kernel_pps(struct gps_device_t *session) { glob("/sys/class/pps/pps?/path", GLOB_DOOFFS, NULL, &globbuf); for ( i = 0; i < globbuf.gl_pathc; i++ ) { - gpsd_report(LOG_INF, "KPPS checking %s\n" - , globbuf.gl_pathv[i]); + int fd = open(globbuf.gl_pathv[i], O_RDONLY); + if ( 0 <= fd ) { + memset( (void *)&path, 0, sizeof(path)); + ssize_t r = read( fd, path, sizeof(path) -1); + close(fd); + } + gpsd_report(LOG_INF, "KPPS checking %s, %s\n" + , globbuf.gl_pathv[i], path); } - char *path = "/dev/pps0"; + memset( (void *)&path, 0, sizeof(path)); + strncpy( path, "/dev/pps0", sizeof(path) -1); /* have the path, clear the blob */ globfree(&globbuf); |