X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fgenericdmm%2Fvictor-70c.c;h=3b40c1bd80efa875a97f2a763ac1ce5100ce7841;hb=161a8a272699a7b818ddab01043838f07d7cf6eb;hp=169f48acf9718ee8cb5021fc2c295c58de15c91d;hpb=b84c13d700eff9eceb12463b0ed17f5b984b2582;p=libsigrok.git diff --git a/hardware/genericdmm/victor-70c.c b/hardware/genericdmm/victor-70c.c index 169f48ac..3b40c1bd 100644 --- a/hardware/genericdmm/victor-70c.c +++ b/hardware/genericdmm/victor-70c.c @@ -57,6 +57,7 @@ static void decode_buf(struct dev_context *devc, unsigned char *data) digits[1] = decode_digit(data[11]); digits[2] = decode_digit(data[10]); digits[3] = decode_digit(data[9]); + if (digits[0] == 0x0f && digits[1] == 0x00 && digits[2] == 0x0a && digits[3] == 0x0f) /* The "over limit" (OL) display comes through like this */ @@ -206,6 +207,8 @@ static void decode_buf(struct dev_context *devc, unsigned char *data) } else { analog.mq = SR_MQ_RESISTANCE; analog.unit = SR_UNIT_OHM; + if (ivalue < 0) + fvalue = INFINITY; } break; case 0x08: @@ -214,7 +217,7 @@ static void decode_buf(struct dev_context *devc, unsigned char *data) break; case 0x10: analog.mq = SR_MQ_FREQUENCY; - analog.mq = SR_UNIT_HERTZ; + analog.unit = SR_UNIT_HERTZ; break; case 0x20: analog.mq = SR_MQ_CAPACITANCE; @@ -270,8 +273,12 @@ static int victor70c_data(struct sr_dev_inst *sdi) if (sdi->status == SR_ST_INACTIVE) { /* First time through. */ - if (libusb_kernel_driver_active(devc->usb->devhdl, 0) == 1) - libusb_detach_kernel_driver(devc->usb->devhdl, 0); + if (libusb_kernel_driver_active(devc->usb->devhdl, 0) == 1) { + if (libusb_detach_kernel_driver(devc->usb->devhdl, 0) < 0) { + sr_err("genericdmm/victor-70c: failed to detach kernel driver"); + return SR_ERR; + } + } if (libusb_claim_interface(devc->usb->devhdl, 0)) { sr_err("genericdmm/victor-70c: failed to claim interface 0");