Ok, this is a re-done set of patches that uses DC_FIELD_STRING instead of DC_FIELD_DEVINFO.
I've also changed "eon_steel" to "eonsteel" throughout (unless I missed something) as per Jef.
Also, to show how DC_FIELD_STRING allows other things, I added "Deco algorithm", "Battery before dive" and "Battery after dive" parsing to the EON Steel backend, although right now my subsurface patch just simply ignores that extra data. We'll need a way to show it, or at least save/restore it sanely, so that will take a bit of effort. But it's there, and it works (tested by printing the values out to stderr - that "debugging" is not in this series of patches, though).
Anyway, I think Dirk was right, the DC_FIELD_STRING model is nicer than showing it as samples, although it did make the subsurface interface a bit different: since we don't get all the version and dive ID data together as one "devinfo", we actually need to save them off individually and then at the end add it to our dive computer database. But that's probably a good idea anyway, since we very likely *should* save at least fw version per-dive rather than per divecomputer (since the same dive computer can have multiple firmware versions over time).
Whatever. The subsurface patch is still pretty small and straightforward, although to save/show generic strings will definitely take more effort. But battery information is apparently something people have been asking for, so I think it's all good.
I could have done inter-diffs from the previous version, but with the big renames of "eon_steel" to "eonsteel", that diff wouldn't really have been very useful anyway, and it's not like the previous version was applied, so this is an all-new series. Three patches for libdivecomputer, and one patch for subsurface.
Linus
Hey Linus,
I like where this is going. Sadly I don't have my EON Steel, yet, so I can't really test it.
One small comment, you forgot to add the fix for the broken headers on some Windows builds. We need something like this:
#ifdef HAVE_LIBUSB
#ifdef _WIN32 #define NOGDI #endif
#include <libusb-1.0/libusb.h>
With that applied (and a reasonably recent libusb - you're using a couple of interfaces that are somewhat new, they were added early last year and on one of my cross build setup I still had an older one...) it cross builds fine for Windows for me.
There are a few warnings about pointers targets differing in signedness (you pass char * to a send_receive which expects const unsigned char *, and then the other way around with alloc_dirent(); finally strcpy doesn't like unsigned char *, either). But in all these cases a quick glance at the function shows that these are not a problem.
On Wed, Oct 29, 2014 at 09:20:57AM -0700, Linus Torvalds wrote:
Also, to show how DC_FIELD_STRING allows other things, I added "Deco algorithm", "Battery before dive" and "Battery after dive" parsing to the EON Steel backend, although right now my subsurface patch just simply ignores that extra data. We'll need a way to show it, or at least save/restore it sanely, so that will take a bit of effort.
Neat. I'll implement a simplistic way to show these soon. I'll wait for Jef's feedback on the DC_FIELD_STRING ;-)
Whatever. The subsurface patch is still pretty small and straightforward, although to save/show generic strings will definitely take more effort. But battery information is apparently something people have been asking for, so I think it's all good.
Yes, this is awesome.
I could have done inter-diffs from the previous version, but with the big renames of "eon_steel" to "eonsteel", that diff wouldn't really have been very useful anyway, and it's not like the previous version was applied, so this is an all-new series. Three patches for libdivecomputer, and one patch for subsurface.
Not speaking for Jef, I prefer new patches in situations like this. No point to add the previous version to the git history.
/D