<feed xmlns='http://www.w3.org/2005/Atom'>
<title>subsurface.git/smtk-import, branch v5.0.3</title>
<subtitle>forked from https://github.com/subsurface/subsurface</subtitle>
<id>https://git.tsegers.com/subsurface.git/atom?h=v5.0.3</id>
<link rel='self' href='https://git.tsegers.com/subsurface.git/atom?h=v5.0.3'/>
<link rel='alternate' type='text/html' href='https://git.tsegers.com/subsurface.git/'/>
<updated>2021-08-18T20:22:02Z</updated>
<entry>
<title>Clean up divecomputer 'device' handling</title>
<updated>2021-08-18T20:22:02Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2021-08-16T22:50:11Z</published>
<link rel='alternate' type='text/html' href='https://git.tsegers.com/subsurface.git/commit/?id=6c4e890960036b127eab513ca967e9454bc63d54'/>
<id>urn:sha1:6c4e890960036b127eab513ca967e9454bc63d54</id>
<content type='text'>
We have this odd legacy notion of a divecomputer 'device', that was
originally just basically the libdivecomputer 'EVENT_DEVINFO' report
that was associated with each dive.  So it had firmware version,
deviceid, and serial number.

It had also gotten extended to do 'nickname' handling, and it was all
confusing, ugly and bad.  It was particularly bad because it wasn't
actually a 'per device' thing at all: due to the firmware field, a dive
computer that got a firmware update forced a new 'device'.

To make matters worse, the 'deviceid' was also almost random, because
we've calculated it a couple of different ways, and libdivecomputer
itself has changed how the legacy 32-bit 'serial number' is expressed.

Finally, because of all these issues, we didn't even try to make the
thing unique, so it really ended up being a random snapshot of the state
of the dive computer at the time of a dive, and sometimes we'd pick one,
and sometimes another, since they weren't really well-defined.

So get rid of all this confusion.

The new rules:

 - the actual random dive computer state at the time of a dive is kept
   in the dive data. So if you want to know the firmware version, it
   should be in the 'extra data'

 - the only serial number that matters is the string one in the extra
   data, because that's the one that actually matches what the dive
   computer reports, and isn't some random 32-bit integer with ambiguous
   formatting.

 - the 'device id' - the thing we match with (together with the model
   name, eg "Suunto EON Steel") is purely a hash of the real serial
   number.

   The device ID that libdivecomputer reports in EVENT_DEVINFO is
   ignored, as is the device ID we've saved in the XML or git files. If
   we have a serial number, the device ID will be uniquely associated
   with that serial number, and if we don't have one, the device ID will
   be zero (for 'match anything').

   So now 'deviceid' is literally just a shorthand for the serial number
   string, and the two are joined at the hip.

 - the 'device' managament is _only_ used to track devices that have
   serial numbers _and_ nicknames. So no more different device
   structures just because one had a nickname and the other didn't etc.

   Without a serial number, the device is 'anonymous' and fundamentally
   cannot be distinguished from other devices of the same model, so a
   nickname is meaningless. And without a nickname, there is no point in
   creating a device data structure, since all the data is in the dive
   itself and the device structure wouldn't add any value..

These rules mean that we no longer have ambiguous 'device' structures,
and we can never have duplicates that can confuse us.

This does mean that you can't give a nickname to a device that cannot be
uniquely identified with a serial number, but those are happily fairly
rare (and mostly older ones).  Dirk said he'd look at what it takes to
give more dive computers proper serial numbers, and I already did it for
the Garmin Descent family yesterday.

(Honesty in advertizing: right now you can't add a nickname to a dive
computer that doesn't already have one, because such a dive computer
will not have a device structure.  But that's a UI issue, and I'll sort
that out separately)

Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>smtk-import: Add support for new devices model</title>
<updated>2020-11-01T22:52:34Z</updated>
<author>
<name>Salvador Cuñat</name>
<email>salvador.cunat@gmail.com</email>
</author>
<published>2020-11-01T21:32:43Z</published>
<link rel='alternate' type='text/html' href='https://git.tsegers.com/subsurface.git/commit/?id=1ff488a4392f4d9a41cf1652c351e7b59bc03928'/>
<id>urn:sha1:1ff488a4392f4d9a41cf1652c351e7b59bc03928</id>
<content type='text'>
Include devices Ids in the DC data.
Ensure we always set a DC model string for manual dives or unsupported devices.

Signed-off-by: Salvador Cuñat &lt;salvador.cunat@gmail.com&gt;
</content>
</entry>
<entry>
<title>cleanup: break out event-related code into event.[c|h]</title>
<updated>2020-10-25T20:59:52Z</updated>
<author>
<name>Berthold Stoeger</name>
<email>bstoeger@mail.tuwien.ac.at</email>
</author>
<published>2020-10-25T08:14:16Z</published>
<link rel='alternate' type='text/html' href='https://git.tsegers.com/subsurface.git/commit/?id=8212acc9925b28ecd546b01047c6a8fc574326ef'/>
<id>urn:sha1:8212acc9925b28ecd546b01047c6a8fc574326ef</id>
<content type='text'>
In an effort to reduce the size of dive.h and dive.c, break out
the event related functions. Moreover event-names were handled
by the profile-code, collect that also in the new source files.

Signed-off-by: Berthold Stoeger &lt;bstoeger@mail.tuwien.ac.at&gt;
</content>
</entry>
<entry>
<title>build-system: switch to using C++17 as default C++ dialect</title>
<updated>2020-10-24T22:21:55Z</updated>
<author>
<name>Berthold Stoeger</name>
<email>bstoeger@mail.tuwien.ac.at</email>
</author>
<published>2020-10-17T22:08:38Z</published>
<link rel='alternate' type='text/html' href='https://git.tsegers.com/subsurface.git/commit/?id=1211520ca939e53d6880e213dd38053a08b9589e'/>
<id>urn:sha1:1211520ca939e53d6880e213dd38053a08b9589e</id>
<content type='text'>
Signed-off-by: Berthold Stoeger &lt;bstoeger@mail.tuwien.ac.at&gt;
Signed-off-by: Dirk Hohndel &lt;dirk@hohndel.org&gt;
</content>
</entry>
<entry>
<title>smtk-import: Workaround segfault in mdbtools memcpy call</title>
<updated>2020-08-13T17:02:12Z</updated>
<author>
<name>Salvador Cuñat</name>
<email>salvador.cunat@gmail.com</email>
</author>
<published>2020-08-02T08:39:39Z</published>
<link rel='alternate' type='text/html' href='https://git.tsegers.com/subsurface.git/commit/?id=e3a158624bd5b15451626907a30185ec4aaf0d87'/>
<id>urn:sha1:e3a158624bd5b15451626907a30185ec4aaf0d87</id>
<content type='text'>
Smtk2ssrf has a segfault which matches quite well glibc's
CVE-2019-6488 (except for the x32 part).
It came from a call to memcpy in mdb_ole_read() func, used to get the
header and the profile of a dive from the database.
May be it could be fixed in libmdb but Mdbtools project has been stalled
for the past 5 years so ...

The segfault seems to be triggered by an empty profile in the first dive
in the database (a pretty common case in older Aladin DCs due to their
little memmory). The only special thing here is the fact it's the first
dive in the database structure (not the first by its index).

We can avoid the crash if we don't call mdb_ole_read_full() func on zero
sized profile field.

The problem here is we can't get the size of the fields and build the
MdbColumn in the same roud.  Happily we just need the MdbColumn struct
for the dive profile and header.  So, we can change the previous approach
using MdbColumns through almost all functions to a simpler one using the
already bounded strings by smtk_open_table() and just using the
col[n]-&gt;bind_pointer in the main function where the columns are built to
be used by mdb_ole_read_full().

Reported-by: Robert C. Helling &lt;helling@atdotde.de&gt;
Signed-off-by: Salvador Cuñat &lt;salvador.cunat@gmail.com&gt;
</content>
</entry>
<entry>
<title>build-system/MXE: build with more up to date MXE tools.</title>
<updated>2020-06-25T18:00:51Z</updated>
<author>
<name>Paul Buxton</name>
<email>paulbuxton.mail@googlemail.com</email>
</author>
<published>2020-05-30T11:21:22Z</published>
<link rel='alternate' type='text/html' href='https://git.tsegers.com/subsurface.git/commit/?id=a753845d5acd6d25ff74dc969a9ea6307d8abe6a'/>
<id>urn:sha1:a753845d5acd6d25ff74dc969a9ea6307d8abe6a</id>
<content type='text'>
- use hidapi grantlee and mdbtools from MXE
- update MXE version to use QT 5.15, and pull in libzstd and  CMake 3.17.3
- fix linking of winmm on windows build with new mxe
- add some instructions on building the container
- add some new dependancies from QT 5.15 to the packaging
- add a patch to MXE to Build qtconnectivity with native-win32-bluetooth

[Dirk Hohndel: small refactor]

Signed-off-by: Paul Buxton &lt;paulbuxton.mail@googlemail.com&gt;
Signed-off-by: Dirk Hohndel &lt;dirk@hohndel.org&gt;
</content>
</entry>
<entry>
<title>cleanup: move dive_table from dive.h to divelist.h</title>
<updated>2020-05-01T16:42:31Z</updated>
<author>
<name>Berthold Stoeger</name>
<email>bstoeger@mail.tuwien.ac.at</email>
</author>
<published>2020-05-01T11:43:52Z</published>
<link rel='alternate' type='text/html' href='https://git.tsegers.com/subsurface.git/commit/?id=95284c026e763482ef581c8b6298012d2c1fd941'/>
<id>urn:sha1:95284c026e763482ef581c8b6298012d2c1fd941</id>
<content type='text'>
This allows us to decouple dive.h and divelist.h, a small step in
include disentangling.

Signed-off-by: Berthold Stoeger &lt;bstoeger@mail.tuwien.ac.at&gt;
</content>
</entry>
<entry>
<title>[smtk-import] Fix useless NULL check and white space issues</title>
<updated>2020-04-19T17:59:12Z</updated>
<author>
<name>Salvador Cuñat</name>
<email>salvador.cunat@gmail.com</email>
</author>
<published>2020-04-19T16:44:24Z</published>
<link rel='alternate' type='text/html' href='https://git.tsegers.com/subsurface.git/commit/?id=5a0f2fc2ccadd97e5394f2f7ac879a191e44771b'/>
<id>urn:sha1:5a0f2fc2ccadd97e5394f2f7ac879a191e44771b</id>
<content type='text'>
As commented by Berthold and Dirk for previous patches.

Signed-off-by: Salvador Cuñat &lt;salvador.cunat@gmail.com&gt;
</content>
</entry>
<entry>
<title>[smtk-import] add some sanity checks</title>
<updated>2020-04-19T17:59:12Z</updated>
<author>
<name>Salvador Cuñat</name>
<email>salvador.cunat@gmail.com</email>
</author>
<published>2020-04-19T05:54:35Z</published>
<link rel='alternate' type='text/html' href='https://git.tsegers.com/subsurface.git/commit/?id=e139b7b15fbffba6cf302ec49a67239663144a5b'/>
<id>urn:sha1:e139b7b15fbffba6cf302ec49a67239663144a5b</id>
<content type='text'>
Under some circustances values stored in this arrays may be NULL or even
previously freed.  Check them to avoid further crashes.

Signed-off-by: Salvador Cuñat &lt;salvador.cunat@gmail.com&gt;
</content>
</entry>
<entry>
<title>[smtk-import] Do not create cylinders structure before libdc parsing</title>
<updated>2020-04-19T17:59:12Z</updated>
<author>
<name>Salvador Cuñat</name>
<email>salvador.cunat@gmail.com</email>
</author>
<published>2020-04-19T05:38:19Z</published>
<link rel='alternate' type='text/html' href='https://git.tsegers.com/subsurface.git/commit/?id=6c9a9b2fb5ff1d8e3aab9b041617349917ac5061'/>
<id>urn:sha1:6c9a9b2fb5ff1d8e3aab9b041617349917ac5061</id>
<content type='text'>
The d-&gt;cylinders created will be overriden by libdivecomputer parsing,
resulting in 0, 1 , may be 2 cylinders depending on DC data. This is not
what we want when importing a divelog, because we will miss all hand
entered tanks.
BTW, using get_cylinder() on tank number bigger than created, results in
a NULL pointer and a crash.
As we can't foresee how many tanks (or even it's positional numbers in
log) a diver has used, the full 10 tanks supported by SmarTrak can be
easily created and parsed using get_or_create_cylinder(), and unused
cleaned later.

Signed-off-by: Salvador Cuñat &lt;salvador.cunat@gmail.com&gt;
</content>
</entry>
</feed>
