[PATCH 1/2] Update the OSTC dive computer configuration to use the generic 'timesync' interface

Linus Torvalds torvalds at linux-foundation.org
Sun Aug 20 20:50:41 PDT 2017


From: Linus Torvalds <torvalds at linux-foundation.org>
Date: Sun, 20 Aug 2017 20:39:52 -0700
Subject: [PATCH 1/2] Update the OSTC dive computer configuration to use the generic 'timesync' interface

Jef made the OSTC interface be a generic 'dc_device_timesync()' and so
the old OSTC-specific code doesn't exist any more.

Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---

This is the patch I actually want you to apply in order to build 
subsurface once you've pulled the libdivecomputer update.

 core/configuredivecomputerthreads.cpp | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/core/configuredivecomputerthreads.cpp b/core/configuredivecomputerthreads.cpp
index 9499332d..5ef7e5eb 100644
--- a/core/configuredivecomputerthreads.cpp
+++ b/core/configuredivecomputerthreads.cpp
@@ -85,7 +85,6 @@
 // Fake io to ostc memory banks
 #define hw_ostc_device_eeprom_read local_hw_ostc_device_eeprom_read
 #define hw_ostc_device_eeprom_write local_hw_ostc_device_eeprom_write
-#define hw_ostc_device_clock local_hw_ostc_device_clock
 #define OSTC_FILE "../OSTC-data-dump.bin"
 
 // Fake the open function.
@@ -125,10 +124,6 @@ static dc_status_t local_hw_ostc_device_eeprom_write(void *ignored, unsigned cha
 	return DC_STATUS_SUCCESS;
 }
 
-static dc_status_t local_hw_ostc_device_clock(void *ignored, dc_datetime_t *time)
-{
-	return DC_STATUS_SUCCESS;
-}
 #endif
 
 static int read_ostc_cf(unsigned char data[], unsigned char cf)
@@ -892,7 +887,7 @@ static dc_status_t write_ostc4_settings(dc_device_t *device, DeviceDetails *m_de
 		dc_datetime_t now;
 		dc_datetime_localtime(&now, dc_datetime_now());
 
-		rc = hw_ostc3_device_clock(device, &now);
+		rc = dc_device_timesync(device, &now);
 	}
 
 	EMIT_PROGRESS();
@@ -1435,7 +1430,7 @@ static dc_status_t write_ostc3_settings(dc_device_t *device, DeviceDetails *m_de
 		dc_datetime_t now;
 		dc_datetime_localtime(&now, dc_datetime_now());
 
-		rc = hw_ostc3_device_clock(device, &now);
+		rc = dc_device_timesync(device, &now);
 	}
 	EMIT_PROGRESS();
 
@@ -2079,14 +2074,15 @@ static dc_status_t write_ostc_settings(dc_device_t *device, DeviceDetails *m_dev
 	//sync date and time
 	if (m_deviceDetails->syncTime) {
 		QDateTime timeToSet = QDateTime::currentDateTime();
-		dc_datetime_t time;
+		dc_datetime_t time = { 0 };
 		time.year = timeToSet.date().year();
 		time.month = timeToSet.date().month();
 		time.day = timeToSet.date().day();
 		time.hour = timeToSet.time().hour();
 		time.minute = timeToSet.time().minute();
 		time.second = timeToSet.time().second();
-		rc = hw_ostc_device_clock(device, &time);
+		time.timezone == DC_TIMEZONE_NONE;
+		rc = dc_device_timesync(device, &time);
 	}
 	EMIT_PROGRESS();
 	return rc;
-- 
2.14.0.rc1.2.g4c8247ec3



More information about the subsurface mailing list