From rick.balsano at gmail.com Mon Jun 11 06:56:22 2018 From: rick.balsano at gmail.com (Rick Balsano) Date: Mon, 11 Jun 2018 00:56:22 -0400 Subject: Issue with parsing Mares Quad Air dump file Message-ID: Hello - I'm having an issue downloading dives from my Mares Quad Air in Subsurface, so I tried to see what I could find out more directly with libdivecomputer. The only issue I've found with libdivecomputer is the inability to parse a dump file for the Quad Air. I don't think this is related to my Subsurface issue, but figured I'd flag it anyway. I have downloaded and built livdivecomputer on OS X (10.13.4). I generated the attached dump file with: ./dctool -f iconhd -m 35 dump -o mares_quad_air.dump /dev/tty.SLAB_USBtoUART > dctool.log 2>&1 Parsing of the dump file fails: ./dctool -f iconhd -m 35 parse -o mares_quad_air_parsed.xml mares_quad_air.dump Creating the parser. Registering the data. Parsing the dive data. Parsing the datetime. ERROR: Buffer overflow detected! [in mares_iconhd_parser.c:149 (mares_iconhd_parser_cache)] ERROR: Error parsing the datetime. [in output_xml.c:229 (dctool_xml_output_write)] ERROR: Error parsing the dive data. [in dctool_parse.c:73 (parse)] ERROR: Data format error However, direct download of dives works (dive download attached): $ ./dctool -f iconhd -m 35 download -o mares_quad_air_dives.xml /dev/tty.SLAB_USBtoUART I see that dctool_parse calls dc_parser_new2 while dctool_download calls dc_parser_new. Am I wrong in thinking that dctool should be able to parse the dump file and produce the same results as a direct download? Regards, Rick -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: mares_quad_air.dump Type: application/octet-stream Size: 1048576 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: mares_quad_air_dives.xml Type: text/xml Size: 793739 bytes Desc: not available URL: From jef at libdivecomputer.org Mon Jun 11 09:30:07 2018 From: jef at libdivecomputer.org (Jef Driesen) Date: Mon, 11 Jun 2018 09:30:07 +0200 Subject: Issue with parsing Mares Quad Air dump file In-Reply-To: References: Message-ID: <03842f8ccfbcb351f6e55075355622b1@libdivecomputer.org> On 2018-06-11 06:56, Rick Balsano wrote: > I'm having an issue downloading dives from my Mares Quad Air in > Subsurface, > so I tried to see what I could find out more directly with > libdivecomputer. > The only issue I've found with libdivecomputer is the inability to > parse a > dump file for the Quad Air. I don't think this is related to my > Subsurface > issue, but figured I'd flag it anyway. > > I have downloaded and built livdivecomputer on OS X (10.13.4). > > I generated the attached dump file with: > > ./dctool -f iconhd -m 35 dump -o mares_quad_air.dump > /dev/tty.SLAB_USBtoUART > dctool.log 2>&1 > > Parsing of the dump file fails: > > ./dctool -f iconhd -m 35 parse -o mares_quad_air_parsed.xml > mares_quad_air.dump > Creating the parser. > Registering the data. > Parsing the dive data. > Parsing the datetime. > ERROR: Buffer overflow detected! [in mares_iconhd_parser.c:149 > (mares_iconhd_parser_cache)] > ERROR: Error parsing the datetime. [in output_xml.c:229 > (dctool_xml_output_write)] > ERROR: Error parsing the dive data. [in dctool_parse.c:73 (parse)] > ERROR: Data format error > > However, direct download of dives works (dive download attached): > > $ ./dctool -f iconhd -m 35 download -o mares_quad_air_dives.xml > /dev/tty.SLAB_USBtoUART > > I see that dctool_parse calls dc_parser_new2 while dctool_download > calls > dc_parser_new. > > Am I wrong in thinking that dctool should be able to parse the dump > file > and produce the same results as a direct download? Yes and no. The dctool parse command expects a single dive, not a full memory dump. You can download the individual dives as follows: ./dctool -l dctool.log -f iconhd -m 35 download -o dive.%n.bin -f raw /dev/tty.SLAB_USBtoUART And then the parse them with: ./dctool -l dctool.log -f iconhd -m 35 parse -o mares_quad_air_parsed.xml dive.*.bin This produces the same result as doing both steps at once with: ./dctool -l dctool.log -f iconhd -m 35 download -o mares_quad_air_parsed.xml /dev/tty.SLAB_USBtoUART To be able to use a memory dump, you'll need the libdivecomputer simulator: https://libdivecomputer.org/simulator.html Jef