X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=blobdiff_plain;f=src%2Fhardware%2Fbrymen-bm86x%2Fprotocol.c;h=3181fef081c85cbf4380af54c774099b1d9e43af;hp=f6ccc3068fe6445fbd7f0e249d1434afa0494524;hb=d9251a2c9f1ca4380c27240ccca90c9f9ed46d3f;hpb=2ecc745ccb837fd990f3ef83e4aca74cffa948cc diff --git a/src/hardware/brymen-bm86x/protocol.c b/src/hardware/brymen-bm86x/protocol.c index f6ccc306..3181fef0 100644 --- a/src/hardware/brymen-bm86x/protocol.c +++ b/src/hardware/brymen-bm86x/protocol.c @@ -153,11 +153,11 @@ static void brymen_bm86x_parse(unsigned char *buf, float *floatval, buf[15] &= ~0x04; /* SI prefix */ - if (buf[14] & 0x40) { floatval[0] *= 1e-9; digits[0] += 9; } /* n */ - if (buf[15] & 0x08) { floatval[0] *= 1e-6; digits[0] += 6; } /* µ */ - if (buf[15] & 0x04) { floatval[0] *= 1e-3; digits[0] += 3; } /* m */ - if (buf[15] & 0x40) { floatval[0] *= 1e3; digits[0] -= 3; } /* k */ - if (buf[15] & 0x20) { floatval[0] *= 1e6; digits[0] -= 6; } /* M */ + if (buf[14] & 0x40) { floatval[0] *= 1e-9; digits[0] += 9; } /* n */ + if (buf[15] & 0x08) { floatval[0] *= 1e-6; digits[0] += 6; } /* µ */ + if (buf[15] & 0x04) { floatval[0] *= 1e-3; digits[0] += 3; } /* m */ + if (buf[15] & 0x40) { floatval[0] *= 1e3; digits[0] -= 3; } /* k */ + if (buf[15] & 0x20) { floatval[0] *= 1e6; digits[0] -= 6; } /* M */ if (over_limit) floatval[0] = INFINITY; @@ -192,10 +192,10 @@ static void brymen_bm86x_parse(unsigned char *buf, float *floatval, if (buf[9] & 0x20) analog[1].meaning->mqflags |= SR_MQFLAG_AC; /* SI prefix */ - if (buf[ 9] & 0x01) { floatval[1] *= 1e-6; digits[1] += 6; } /* µ */ - if (buf[ 9] & 0x02) { floatval[1] *= 1e-3; digits[1] += 3; } /* m */ - if (buf[14] & 0x02) { floatval[1] *= 1e3; digits[1] -= 3; } /* k */ - if (buf[14] & 0x01) { floatval[1] *= 1e6; digits[1] -= 6; } /* M */ + if (buf[ 9] & 0x01) { floatval[1] *= 1e-6; digits[1] += 6; } /* µ */ + if (buf[ 9] & 0x02) { floatval[1] *= 1e-3; digits[1] += 3; } /* m */ + if (buf[14] & 0x02) { floatval[1] *= 1e3; digits[1] -= 3; } /* k */ + if (buf[14] & 0x01) { floatval[1] *= 1e6; digits[1] -= 6; } /* M */ analog[1].encoding->digits = digits[1]; analog[1].spec->spec_digits = digits[1]; @@ -260,7 +260,7 @@ static int brymen_bm86x_send_command(const struct sr_dev_inst *sdi) sr_dbg("Sending HID set report."); ret = libusb_control_transfer(usb->devhdl, - LIBUSB_REQUEST_TYPE_CLASS | + LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE | LIBUSB_ENDPOINT_OUT, 9, /* bRequest: HID set_report */