From 6ee9556f2fea231303a488f07a8b0e0a9f552dc4 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sat, 31 Jan 2015 15:16:55 -0500 Subject: Back out the attempt to use VTIME. According to Matthias Drochner at http://lists.lysator.liu.se/pipermail/lsh-bugs/2003q4/000151.html: I thought I'd give lsh a try, just to see how it compares to openssh... The client didn't work well on NetBSD, got a message like "unexpected EWOULDBLOCK" on each keystroke. Looked a bit deeper and found that stdin is set to O_NONBLOCK and a raw tty mode with c_cc[VMIN] > 1 and c_cc[VTIME] > 0. I'll append a little test program which does the same. I've tried it on 3 operating systems (Linux, NetBSD, Digital UNIX), and it behaves differently on each: -on Linux, if a key is pressed, the read returns immediately with that one character -on NetBSD, the read returns with no data but EWOULDBLOCK -on D'UNIX, the poll() doesn't teturn before 4 keypresses are done; the read() returns these 4 characters Indeed, in SUSv2's termios page is a sentence which says that if both O_NONBLOCK and VTIME>0 are set, the behaviour is more or less undefined. I've solved my immediate problems by setting VMIN to 1 instead of 4 in unix_interact.c:do_make_raw(), but VTIME is still pointless, so I wouldn't call this a clean solution. All regression tests pass. --- drivers.c | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'drivers.c') diff --git a/drivers.c b/drivers.c index b5c898dc..0003ad11 100644 --- a/drivers.c +++ b/drivers.c @@ -16,8 +16,6 @@ #include "bits.h" /* for getbeu16(), to extract big-endian words */ #include "strfuncs.h" -#define NMEA_MINLENGTH 16 /* minimum length of NMEA0183 packet */ - ssize_t generic_get(struct gps_device_t *session) { return packet_get(session->gpsdata.gps_fd, &session->lexer); @@ -104,7 +102,6 @@ const struct gps_type_t driver_unknown = { #ifdef TIMEHINT_ENABLE .time_offset = NULL, /* no method for NTP fudge factor */ #endif /* TIMEHINT_ENABLE */ - .minlength = 0, /* minimum packet length is unknown */ }; /* *INDENT-ON* */ @@ -275,7 +272,6 @@ const struct gps_type_t driver_nmea0183 = { #ifdef TIMEHINT_ENABLE .time_offset = NULL, /* no method for NTP fudge factor */ #endif /* TIMEHINT_ENABLE */ - .minlength = NMEA_MINLENGTH, /* min packet length for chunked I/O */ }; /* *INDENT-ON* */ @@ -378,7 +374,6 @@ const struct gps_type_t driver_garmin = { #ifdef TIMEHINT_ENABLE .time_offset = NULL, /* no method for NTP fudge factor */ #endif /* TIMEHINT_ENABLE */ - .minlength = NMEA_MINLENGTH, /* min packet length for chunked I/O */ }; /* *INDENT-ON* */ #endif /* GARMIN_ENABLE && NMEA_ENABLE */ @@ -442,7 +437,6 @@ const struct gps_type_t driver_ashtech = { #ifdef TIMEHINT_ENABLE .time_offset = NULL, /* no method for NTP fudge factor */ #endif /* TIMEHINT_ENABLE */ - .minlength = 0, /* minimum packet length is unknown */ }; /* *INDENT-ON* */ #endif /* ASHTECH_ENABLE */ @@ -495,7 +489,6 @@ const struct gps_type_t driver_fv18 = { #ifdef TIMEHINT_ENABLE .time_offset = NULL, /* no method for NTP fudge factor */ #endif /* TIMEHINT_ENABLE */ - .minlength = NMEA_MINLENGTH, /* use NMEA minimum length */ }; /* *INDENT-ON* */ #endif /* FV18_ENABLE */ @@ -551,7 +544,6 @@ const struct gps_type_t driver_gpsclock = { #ifdef TIMEHINT_ENABLE .time_offset = NULL, /* no method for NTP fudge factor */ #endif /* TIMEHINT_ENABLE */ - .minlength = NMEA_MINLENGTH, /* use NMEA minimum length */ }; /* *INDENT-ON* */ #endif /* GPSCLOCK_ENABLE */ @@ -608,7 +600,6 @@ static const struct gps_type_t driver_tripmate = { #ifdef TIMEHINT_ENABLE .time_offset = NULL, /* no method for NTP fudge factor */ #endif /* TIMEHINT_ENABLE */ - .minlength = NMEA_MINLENGTH, /* use NME0183 minimum langth */ }; /* *INDENT-ON* */ #endif /* TRIPMATE_ENABLE */ @@ -660,7 +651,6 @@ static const struct gps_type_t driver_earthmate = { #endif /* CONTROLSEND_ENABLE */ #ifdef TIMEHINT_ENABLE .time_offset = NULL, /* no method for NTP fudge factor */ - .minlength = 40, /* use Zodiac minimum langth */ #endif /* TIMEHINT_ENABLE */ }; /*@ -redef @*/ @@ -788,7 +778,6 @@ const struct gps_type_t driver_trueNorth = { #ifdef TIMEHINT_ENABLE .time_offset = NULL, #endif /* TIMEHINT_ENABLE */ - .minlength = NMEA_MINLENGTH, /* use NME0183 minimum langth */ }; /* *INDENT-ON* */ #endif @@ -869,7 +858,6 @@ static const struct gps_type_t driver_oceanServer = { #ifdef TIMEHINT_ENABLE .time_offset = NULL, #endif /* TIMEHINT_ENABLE */ - .minlength = NMEA_MINLENGTH, /* use NME0183 minimum langth */ }; /* *INDENT-ON* */ #endif @@ -938,7 +926,6 @@ static const struct gps_type_t driver_fury = { #ifdef TIMEHINT_ENABLE .time_offset = NULL, #endif /* TIMEHINT_ENABLE */ - .minlength = NMEA_MINLENGTH, /* use NME0183 minimum langth */ }; /* *INDENT-ON* */ @@ -994,7 +981,6 @@ static const struct gps_type_t driver_rtcm104v2 = { #ifdef TIMEHINT_ENABLE .time_offset = NULL, #endif /* TIMEHINT_ENABLE */ - .minlength = 0, /* raw I/O - could probably be tuned */ }; /* *INDENT-ON* */ #endif /* RTCM104V2_ENABLE */ @@ -1042,7 +1028,6 @@ static const struct gps_type_t driver_rtcm104v3 = { #ifdef TIMEHINT_ENABLE .time_offset = NULL, #endif /* TIMEHINT_ENABLE */ - .minlength = 0, /* raw I/O - could probably be tuned */ }; /* *INDENT-ON* */ #endif /* RTCM104V3_ENABLE */ @@ -1079,7 +1064,6 @@ static const struct gps_type_t driver_garmintxt = { #ifdef TIMEHINT_ENABLE .time_offset = NULL, #endif /* TIMEHINT_ENABLE */ - .minlength = 0, /* min packet length unknown */ }; /* *INDENT-ON* */ #endif /* GARMINTXT_ENABLE */ @@ -1176,7 +1160,6 @@ const struct gps_type_t driver_mtk3301 = { #ifdef TIMEHINT_ENABLE .time_offset = NULL, #endif /* TIMEHINT_ENABLE */ - .minlength = NMEA_MINLENGTH, /* use NME0183 minimum langth */ }; /* *INDENT-ON* */ #endif /* MTK3301_ENABLE */ @@ -1420,7 +1403,6 @@ const struct gps_type_t driver_aivdm = { #ifdef TIMEHINT_ENABLE .time_offset = NULL, /* no NTP communication */ #endif /* TIMEHINT_ENABLE */ - .minlength = 23, /* minimum AIVDM packet length */ }; /* *INDENT-ON* */ #endif /* AIVDM_ENABLE */ @@ -1525,7 +1507,6 @@ const struct gps_type_t driver_json_passthrough = { #ifdef TIMEHINT_ENABLE .time_offset = NULL, /* no method for NTP fudge factor */ #endif /* TIMEHINT_ENABLE */ - .minlength = 43, /* minimum JSON packet length */ }; /* *INDENT-ON* */ -- cgit v1.2.1