On 20 November, 2014 - Dirk Hohndel wrote: > So Anton brought this up on trac. And I have been bitten by this myself... > > Linus, this code has been around forever, I think this was a very early > design decision that you made: > > devdata->deviceid = calculate_sha1(devinfo->model, devinfo->firmware, serial); > > Can you remind us, why the firmware version was included in this? > > The problem is, of course, that with every firmware update (and those are > becoming much more frequent, as you are seeing yourself), you get a new > deviceid and we redownload all dives :-( > > Now of course we can't simply change this, because then EVERYONE gets to > download everything again... So I wonder if there's some scheme that would > allow us not to fail for the common case, but also to get things right in > the future. > > The only idea I came up with so far is to add a new field > > deviceid2 = calculate_sha(devinfo->model, serial); > > If an existing dive doesn't have a deviceid2 stored, we compare with the > old deviceid (so if the firmware didn't change, all is well). And for all > newly downloaded dives, we store both numbers - and if deviceid2 is > available we compare that. > > What am I missing with this idea? >
I wrote it down in trac so i wouldn't forget it and just get annoyed the next time i run into it... One quick hack could be to calculate a "new" version of the deviceid, and if no such exists, calculate a "old" style deviceid and see if that gets you a divecomputer. If so, change that deviceid to the new-style and you're migrated. It will mess up switching back to older versions of Subsurface and download dives from your divecomputer, but hey, who actually downgrades? ... //Anton -- Anton Lundin +46702-161604 _______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
