Interpret the 7th bit of the event byte correctly.

In the OSTC3 data format, the 7th bit of the event byte is used to
indicate whether another event byte is present or not. For the OSTC2,
this 7th bit remained unused, and I assumed it would eventually get used
in the same way as the OSTC3 does. But that assumption turns out to be
wrong. Starting with firmware v2.66 the 7th bit is used for a new
bailout event.

This patch leaves the existing logic intact, but except for the OSTC3
format (version 0x23), the maximum number of events bytes is now limited
to just one byte.
This commit is contained in:
Jef Driesen 2013-06-17 22:09:28 +02:00
parent 6ad8d61253
commit b1574848b2

View File

@ -482,6 +482,8 @@ hw_ostc_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t call
unsigned int nbits = 0;
unsigned int events = 0;
while (data[offset - 1] & 0x80) {
if (nbits && version != 0x23)
break;
if (offset + 1 > size)
return DC_STATUS_DATAFORMAT;
events |= data[offset] << nbits;