The Rigol DS1054Z sometimes returns zero bytes in response to a bulk in
request. sigrok ends up reading out of bounds and failing ungracefully
when this happens. Check that libusb returned a full USBTMC header and
fail gracefully if it did not.
return SR_ERR;
}
+ if (transferred < USBTMC_BULK_HEADER_SIZE) {
+ sr_err("USBTMC bulk in returned too little data: %d/%d bytes\n", transferred, size);
+ return SR_ERR;
+ }
+
if (usbtmc_bulk_in_header_read(data, msg_id, uscpi->bTag, &message_size,
transfer_attributes) != SR_OK) {
sr_err("USBTMC invalid bulk in header.");