>From 856b0c27983e201601020f6db881a17102ee9d26 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 26 Sep 2014 10:58:15 -0700 Subject: [PATCH 1/5] Fix multipage algorithm to create aligned reads At least the A300CS requires that reads are aligned to the pagesize that is read. Signed-off-by: Dirk Hohndel --- src/oceanic_common.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/oceanic_common.c b/src/oceanic_common.c index f5f37a149596..d5313d563eb7 100644 --- a/src/oceanic_common.c +++ b/src/oceanic_common.c @@ -536,6 +536,15 @@ oceanic_common_device_foreach (dc_device_t *abstract, dc_dive_callback_t callbac if (nbytes + len > remaining) len = remaining - nbytes; // End of profile. + // if we are able to read multiple pages, make sure we have an aligned address + if (device->multipage > 1 && len == PAGESIZE * device->multipage) { + if (address % (PAGESIZE * device->multipage)) { + // this wouldn't be an aligned read + // let's read a smaller subset first which should have the remaining + // reads be aligned + len = address % (PAGESIZE * device->multipage); + } + } // Move to the start of the current page. address -= len; offset -= len; -- 1.8.0.rc0.18.gf84667d