On Thu, May 21, 2015 at 1:25 PM, Dirk Hohndel <[email protected]> wrote:
>
> subsurface.exe -version should show the libdivecomputer git hash...
> I'm somewhat optimistic that your first patch from yesterday is in the
> latest Windows build, but I haven't verified this, yet.
So I tried to force the "read ends on a packet boundary" by changing
the blocking size we use for reads. I can actually reproduce the
ERROR: incomplete read interrupt transfer [in suunto_eonsteel.c:139
(receive_data)]
ERROR: short command reply (-1) [in suunto_eonsteel.c:243 (send_receive)]
ERROR: unable to read 0:/dives/54C2286A.LOG [in
suunto_eonsteel.c:321 (read_file)]
error case with that.
Its' not *exactly* the same thing that Guenther sees (end-of-file vs
file-read-block-size), but it's close. From a single command/reply
request standpoint it should be identical.
And my patch from yesterday fixes it for that case, so I somewhat
suspect that maybe the nightly build ended up using the normal
libdivecomputer branch, and didn't actually get that fix.
> I'm on it. And this time I'll verify that the Windows binary contains the
> correct libdivecomputer bits.
Well, with the logging improvements in that patch, it will also be
very obvious from the log output if the changes are there or not..
I do have a small cleanup patch that further improves the error case
messages, and that removes a now-unnecessary change from the first
patch. It's not really a big deal, and should not matter for this all,
but I'm attaching it just for completeness.
Linus
From 42c4aa9970fd605f62d0ff0e0ba126f230d80a6a Mon Sep 17 00:00:00 2001
From: Linus Torvalds <[email protected]>
Date: Thu, 21 May 2015 14:20:16 -0700
Subject: [PATCH 3/3] suunto eon steel: clean up size limits and error
reporting
This is some small cleanup after the whole reply size rewrite. It
further improves on the error log reporting a bit, and it undoes the
"read exact size" thing introduced in "suunto eon steel: fix file
reading special case", because it is no longer necessary.
Signed-off-by: Linus Torvalds <[email protected]>
---
src/suunto_eonsteel.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/suunto_eonsteel.c b/src/suunto_eonsteel.c
index 5713aa43d9d5..feb01a3a060a 100644
--- a/src/suunto_eonsteel.c
+++ b/src/suunto_eonsteel.c
@@ -144,8 +144,12 @@ static int receive_packet(suunto_eonsteel_device_t *eon, unsigned char *buffer,
/* 5000 = 5s timeout */
rc = libusb_interrupt_transfer(eon->handle, InEndpoint, buf, PACKET_SIZE, &transferred, 5000);
- if (rc || transferred != PACKET_SIZE) {
- ERROR(eon->base.context, "incomplete read interrupt transfer");
+ if (rc) {
+ ERROR(eon->base.context, "read interrupt transfer failed (%s)", libusb_error_name(rc));
+ return -1;
+ }
+ if (transferred != PACKET_SIZE) {
+ ERROR(eon->base.context, "incomplete read interrupt transfer (got %d, expected %d)", transferred, PACKET_SIZE);
return -1;
}
if (buf[0] != 0x3f) {
@@ -384,7 +388,7 @@ static int read_file(suunto_eonsteel_device_t *eon, const char *filename, dc_buf
put_le32(ask, cmdbuf+4); // Size of read
rc = send_receive(eon, FILE_READ_CMD,
8, cmdbuf,
- ask+8, result);
+ sizeof(result), result);
if (rc < 0) {
ERROR(eon->base.context, "unable to read %s", filename);
return -1;
--
2.4.0.53.g8440f74
_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface