From a734f40604644bb307aa99d94d9fad451193ce05 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Thu, 15 Apr 2010 12:25:42 +0000 Subject: [PATCH] Limit the init response to 13 bytes. Not all devices appear to send the last zero byte, resulting in a timeout. If a device does send this zero byte, it is automatically flushed when sending the next command. --- src/oceanic_veo250.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/oceanic_veo250.c b/src/oceanic_veo250.c index 9b03af3..8ad8ab2 100644 --- a/src/oceanic_veo250.c +++ b/src/oceanic_veo250.c @@ -171,7 +171,7 @@ oceanic_veo250_init (oceanic_veo250_device_t *device) } // Receive the answer of the dive computer. - unsigned char answer[14] = {0}; + unsigned char answer[13] = {0}; n = serial_read (device->port, answer, sizeof (answer)); if (n != sizeof (answer)) { WARNING ("Failed to receive the answer."); @@ -179,9 +179,9 @@ oceanic_veo250_init (oceanic_veo250_device_t *device) } // Verify the answer. - const unsigned char response[14] = { + const unsigned char response[13] = { 0x50, 0x50, 0x53, 0x2D, 0x2D, 0x4F, 0x4B, - 0x5F, 0x56, 0x32, 0x2E, 0x30, 0x30, 0x00}; + 0x5F, 0x56, 0x32, 0x2E, 0x30, 0x30}; if (memcmp (answer, response, sizeof (response)) != 0) { WARNING ("Unexpected answer byte(s)."); return DEVICE_STATUS_PROTOCOL;