[PATCH 2/2] Make dive computer download automatically sync the time

2017-08-20 Thread Linus Torvalds

From: Linus Torvalds 
Date: Sun, 20 Aug 2017 20:41:29 -0700
Subject: [PATCH 2/2] Make dive computer download automatically sync the time

This needs a button or a checkbox or something.  This unconditional time
sync is a hack.

Not-yet-signed-off-by: Linus Torvalds 
---

And this is the patch to use the new 'dc_device_timesync()' at download 
time that should *not* be applied, and needs some UI love to make it 
conditional.

Not that applying it will be disastrous (and will only affect EON Steel 
and the OSTC family of dive computers right now anyway, since I think 
those are the only ones that have a working 'timesync' implementation), 
but it sounded like everybody wanted to make it conditional.

 core/libdivecomputer.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/core/libdivecomputer.c b/core/libdivecomputer.c
index 2c5f607d..c610fb67 100644
--- a/core/libdivecomputer.c
+++ b/core/libdivecomputer.c
@@ -1117,6 +1117,11 @@ const char *do_libdivecomputer_import(device_data_t 
*data)
}
 
if (rc == DC_STATUS_SUCCESS) {
+   /* HACK HACK HACK - need some kind of "set device time" 
checkbox */
+   dc_datetime_t now;
+   dc_datetime_localtime(&now, dc_datetime_now());
+   dc_device_timesync(data->device, &now);
+
err = do_device_import(data);
/* TODO: Show the logfile to the user on error. */
dc_device_close(data->device);
-- 
2.14.0.rc1.2.g4c8247ec3

___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


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

2017-08-20 Thread Linus Torvalds

From: Linus Torvalds 
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 
---

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

___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: RATIO iX3M DEEP computers compatibility and connection/configuration problem

2017-08-20 Thread Dirk Hohndel

> On Aug 20, 2017, at 8:43 PM, Gregory Sin  wrote:
> 
> On the stable release (4.6.4) it does not work neither BT or USB.
> Checked yesterday on iDive and IX3M computers and on different Mac/OS.
> iDive is OS 4.0.9/011 and iX3M is OS 4.0.26/013

Let's deal with one problem at a time. I just created a new test build from
the latest sources - this one includes the library that was missing from the
previous build.

Please try

http://subsurface-divelog.org/downloads/test/Subsurface-4.6.4-735-g0bb93c76fd91.dmg

/D


___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: RATIO iX3M DEEP computers compatibility and connection/configuration problem

2017-08-20 Thread Gregory Sin
On the stable release (4.6.4) it does not work neither BT or USB.
Checked yesterday on iDive and IX3M computers and on different Mac/OS.
iDive is OS 4.0.9/011 and iX3M is OS 4.0.26/013

Guide me please how I can help further.

kind regards
Gregory


On 21 Aug, 2017, at 11:30, Linus Torvalds  wrote:

> On Sun, Aug 20, 2017 at 8:14 PM, Benjamin  wrote:
>> 
>> *whistling quietly*
>> 
>> I may need the instructions on the boot-heel to empty the water out of the 
>> boot, but I do try to read the manual when I can't get things to work... :)
> 
> Ok, you have that box checked.,
> 
> This may be some OS X issue - or alternatively a iX3M one. I just
> checked the two dive computers I have that do BT, and they both work
> (both USB and BT). But I don't have a rfcomm device, and I don't have
> OS X..
> 
>Linus



signature.asc
Description: Message signed with OpenPGP using GPGMail
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: RATIO iX3M DEEP computers compatibility and connection/configuration problem

2017-08-20 Thread Linus Torvalds
On Sun, Aug 20, 2017 at 8:14 PM, Benjamin  wrote:
>
> *whistling quietly*
>
> I may need the instructions on the boot-heel to empty the water out of the 
> boot, but I do try to read the manual when I can't get things to work... :)

Ok, you have that box checked.,

This may be some OS X issue - or alternatively a iX3M one. I just
checked the two dive computers I have that do BT, and they both work
(both USB and BT). But I don't have a rfcomm device, and I don't have
OS X..

Linus
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: RATIO iX3M DEEP computers compatibility and connection/configuration problem

2017-08-20 Thread Benjamin
What should be passed there for a bluetooth connection? Because it used to
work up until the G2 support was added to Subsurface :(

On 20 August 2017 at 13:46, Jef Driesen  wrote:

> On 19-08-17 12:00, Benjamin wrote:
>
>> So, after a few trials, I'm getting the following in the subsurface.log
>> file:
>>
>> INFO: Open: name=00:13:43:0C:56:29
>>
>> ERROR: Failed to open the serial port. [in ../../src/shearwater_common.c:46
>> (shearwater_common_open)]
>>
>
> This shows exactly what the problem is! A bluetooth MAC address
> (00:13:43:0C:56:29) is being passed to the dc_serial_open() function. And
> of course that doesn't work!
>
> Jef
>
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: RATIO iX3M DEEP computers compatibility and connection/configuration problem

2017-08-20 Thread Gregory Sin
Hi Robert

Hope you are not in Papua ;) to my memory internet is second issue there, after 
Malaria of course ;)

Ok, let me try it on 3 macs (with different OS) and 2 iX3M (DEEP and Easy 
models), by using BT and cable.
I think its Ratio  OS version, what can make a difference… got some rumors that 
after recent update of their OS, client SW also need to be updated.
Are we talking about this version Subsurface-4.6.4-709-gd77de11a1d2e.dmg?

Give me few days please. Will revert soon.

Have a good trip.

kind regards
Greg



On 20 Aug, 2017, at 18:40, Robert C. Helling  
wrote:

> Gregory,
> 
> I am currently traveling and only rarely have internet connectivity.
> 
>> Am 20.08.2017 um 10:58 schrieb Gregory Sin :
>> 
>> unable to run that test version due to immediate crash on both Mac).
> 
> I tried the latest test version and have no problem to run it. Upon crashing, 
> the mac should offer to send a crash report (to apple not us). Could you 
> please copy and paste that report so we can try to figure out what is going 
> on?
> 
> Best
> Robert
> 
> PS: the ratio computers work for others. So it Must be an unfortunate 
> combination with your setup.



signature.asc
Description: Message signed with OpenPGP using GPGMail
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: RATIO iX3M DEEP computers compatibility and connection/configuration problem

2017-08-20 Thread Jef Driesen

On 19-08-17 12:00, Benjamin wrote:

So, after a few trials, I'm getting the following in the subsurface.log file:

INFO: Open: name=00:13:43:0C:56:29

ERROR: Failed to open the serial port. [in ../../src/shearwater_common.c:46 
(shearwater_common_open)]


This shows exactly what the problem is! A bluetooth MAC address 
(00:13:43:0C:56:29) is being passed to the dc_serial_open() function. And of 
course that doesn't work!


Jef
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: RATIO iX3M DEEP computers compatibility and connection/configuration problem

2017-08-20 Thread Robert C. Helling
Gregory,

I am currently traveling and only rarely have internet connectivity. 

> Am 20.08.2017 um 10:58 schrieb Gregory Sin :
> 
> unable to run that test version due to immediate crash on both Mac).

I tried the latest test version and have no problem to run it. Upon crashing, 
the mac should offer to send a crash report (to apple not us). Could you please 
copy and paste that report so we can try to figure out what is going on?

Best
Robert

PS: the ratio computers work for others. So it Must be an unfortunate 
combination with your setup. 
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface