How would you go about reverse engineering a set of binary data pulled from a device?
Asked Answered
Y

8

8

A friend of mine brought up this questiont he other day, he's recently bought a garmin heart rate moniter device which keeps track of his heart rate and allows him to upload his heart rate stats for a day to his computer.

The only problem is there are no linux drivers for the garmin USB device, he's managed to interpret some of the data, such as the model number and his user details and has identified that there are some binary datatables essentially which we assume represent a series of recordings of his heart rate and the time the recording was taken.

Where does one start when reverse engineering data when you know nothing about the structure?

Yuriyuria answered 22/9, 2008 at 16:18 Comment(0)
E
4

I had the same problem and initially found this project at Google Code that aims to complete a cross-platform version of tools for the Garmin devices ... see: http://code.google.com/p/garmintools/. There's a link on the front page of that project to the protocols you need, which Garmin was thoughtful enough to release publically.

And here's a direct link to the Garmin I/O specification: http://www.garmin.com/support/pdf/IOSDK.zip

Erg answered 22/9, 2008 at 16:22 Comment(1)
That's lucky and fortunate that google has provided an answer for the particular problem of the Garmin device. The QUESTION however, is not answered here. Perhaps the question should be reworded so that it matches the answer.Aromaticity
H
1

I'd start looking at the data in a hexadecimal editor, hopefully a good one which knows the most common encodings (ASCII, Unicode, etc.) and then try to make sense of it out of the data you know it has stored.

Hashum answered 22/9, 2008 at 16:21 Comment(0)
O
1

As another poster mentioned, reverse engineering can be hairy, not in practice but in legality.

That being said, you may be able to find everything related to your root question at hand by checking out this project and its' code...and they do handle the runner's heart rate/GPS combo data as well

http://www.gpsbabel.org/

Overfly answered 22/9, 2008 at 16:24 Comment(0)
A
0

I'd suggest you start with checking the legality of reverse engineering in your country of origin. Most countries have very strict laws about what is allowed and what isn't regarding reverse engineering devices and code.

Antiparallel answered 22/9, 2008 at 16:19 Comment(1)
Typically, in the US, it's allowed, which is why it's expressly forbidden on a lot of licenses. If you think you might be in trouble if you violate the law, consult a lawyer (who knows the law for what jurisdiction you're in).Kirt
M
0

I would start by seeing what data is being sent by the device, then consider how such data could be represented and packed.

I would first capture many samples, and see if any pattern presents itself, since heart beat is something which is regular and that would suggest it is measurement related to the heart itself. I would also look for bit fields which are monotonically increasing, as that would suggest some sort of time stamp.

Having formed a hypothesis for what is where, I would write a program to test it and graph the results and see if it makes sense. If it does but not quite, then closer inspection would probably reveal you need some scaling factors here or there. It is also entirely possible I need to process the data first before it looks anything like what their program is showing, i.e. might need to integrate the data points. If I get garbage, then it is back to the drawing board :-)

I would also check the manufacturer's website, or maybe run strings on their binaries. Finding someone who works in the field of biomedical engineering would also be on my list, as they would probably know what protocols are typically used, if any. I would also look for these protocols and see if any could be applied to the data I am seeing.

Millenary answered 22/9, 2008 at 16:28 Comment(0)
W
0

I'd start by creating a hex dump of the data. Figure it's probably blocked in some power-of-two-sized chunks. Start looking for repeating patterns. Think about what kind of data they're probably sending. Either they're recording each heart beat individually, or they're recording whatever the sensor is sending at fixed intervals. If it's individual beats, then there's going to be a time delta (since the last beat), a duration, and a max or avg strength of some sort. If it's fixed intervals, then it'll probably be a simple vector of readings. There'll probably be a preamble of some sort, with a start timestamp and the sampling rate. You can try decoding the timestamp yourself, or you might try simply feeding it to ctime() and see if they're using standard absolute time format.

Keep in mind that lots of cheap A/D converters only produce 12-bit outputs, so your readings are unlikely to be larger than 16 bits (and the high-order 4 bits may be used for flags). I'd recommend resetting the device so that it's "blank", dumping and storing the contents, then take a set of readings, record the results (whatever the device normally reports), then dump the contents again and try to correlate the recorded results with whatever data appeared after the "blank" dump.

Walkway answered 5/3, 2010 at 19:39 Comment(0)
C
0

Unsure if this is what you're looking for but Garmin has created an API that runs with your browser. It seems OSX is supported, as well as Windows browsers... I would try it from Google Chromium to see if it can be used instead of this reverse engineering...

http://developer.garmin.com/web-device/garmin-communicator-plugin/

API Features

Auto-detection of devices connected to a computer Access to device product information like product name and software version Read tracks, routes and waypoints from supported recreational, fitness and navigation devices Write tracks, routes and waypoints to supported recreational, fitness and navigation devices Read fitness data from supported fitness devices Geo-code address and save to a device as a waypoint or favorite Read and write Garmin XML files (GPX and TCX) as well as binary files. Support for most Garmin devices (USB, USB mass-storage, most serial devices) Support for Internet Explorer, Firefox and Chrome on Microsoft Windows. Support for Safari, Firefox and Chrome on Mac OS X.

Compaction answered 17/9, 2013 at 21:28 Comment(0)
M
-1

Can you synthesize a heart beat using something like a computer speaker? (I have no idea how such devices actually work). Watch how the binary results change based on different inputs.

Ripping apart the device and checking out what's inside would probably help too.

Masturbate answered 22/9, 2008 at 16:21 Comment(1)
You could always put the heartrate monitor next to your heart and use that... Yours is a great idea though :)Detestable

© 2022 - 2024 — McMap. All rights reserved.