From 26f4cae47c3cdea1b8c70434d261683bee2fb63c Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Thu, 19 Apr 2018 09:45:08 +0200 Subject: [PATCH] Fix a critical mistake in the OSTC3 code Instead of reading data packets, the code is actually sending some random data to the dive computer! A small typo with bad consequences! This is a critical bug because it not only causes the download to fail, but also appears to change random settings on the dive computer. I suspect that the garbage data that gets send to the dive computer happens to contain some valid write settings commands. --- src/hw_ostc3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hw_ostc3.c b/src/hw_ostc3.c index d018e07..1bdac9c 100644 --- a/src/hw_ostc3.c +++ b/src/hw_ostc3.c @@ -212,7 +212,7 @@ hw_ostc3_read (hw_ostc3_device_t *device, dc_event_progress_t *progress, unsigne device->offset += length; } else { // Read the packet. - rc = dc_iostream_write (device->iostream, data + nbytes, length, NULL); + rc = dc_iostream_read (device->iostream, data + nbytes, length, NULL); if (rc != DC_STATUS_SUCCESS) return rc; }