From e96a00745152926991433ddc8a2dc52ca85fafaa Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Sun, 12 Sep 2010 21:05:35 +0200 Subject: [PATCH] Discard garbage bytes when opening the session. --- src/mares_puck.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mares_puck.c b/src/mares_puck.c index 1f44ea4..656b2a8 100644 --- a/src/mares_puck.c +++ b/src/mares_puck.c @@ -147,6 +147,9 @@ mares_puck_device_open (device_t **out, const char* name) return DEVICE_STATUS_IO; } + // Make sure everything is in a sane state. + serial_flush (device->port, SERIAL_QUEUE_BOTH); + // Identify the model number. unsigned char header[PACKETSIZE] = {0}; device_status_t status = mares_puck_device_read ((device_t *) device, 0, header, sizeof (header));