libsigrok: Use sr_err() et al instead of printf.
This commit is contained in:
parent
805e9640ff
commit
a562c3a2e5
|
@ -724,7 +724,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
|
|||
void *info = NULL;
|
||||
|
||||
if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
|
||||
fprintf(stderr, "It's NULL.\n");
|
||||
sr_err("It's NULL.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ int gl_write_address(libusb_device_handle *devh, unsigned int address)
|
|||
ret = libusb_control_transfer(devh, CTRL_OUT, 0xc, REQ_WRITEADDR,
|
||||
0, packet, 1, TIMEOUT);
|
||||
if (ret != 1)
|
||||
printf("%s: libusb_control_transfer returned %d\n",
|
||||
sr_err("%s: libusb_control_transfer returned %d\n",
|
||||
__FUNCTION__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ int gl_write_data(libusb_device_handle *devh, unsigned int val)
|
|||
ret = libusb_control_transfer(devh, CTRL_OUT, 0xc, REQ_WRITEDATA,
|
||||
0, packet, 1, TIMEOUT);
|
||||
if (ret != 1)
|
||||
printf("%s: libusb_control_transfer returned %d\n",
|
||||
sr_err("%s: libusb_control_transfer returned %d\n",
|
||||
__FUNCTION__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ int gl_read_data(libusb_device_handle *devh)
|
|||
ret = libusb_control_transfer(devh, CTRL_IN, 0xc, REQ_READDATA,
|
||||
0, packet, 1, TIMEOUT);
|
||||
if (ret != 1)
|
||||
printf("%s: libusb_control_transfer returned %d, val=%hhx\n",
|
||||
sr_err("%s: libusb_control_transfer returned %d, val=%hhx\n",
|
||||
__FUNCTION__, ret, packet[0]);
|
||||
return (ret == 1) ? packet[0] : ret;
|
||||
}
|
||||
|
@ -106,13 +106,13 @@ int gl_read_bulk(libusb_device_handle *devh, void *buffer, unsigned int size)
|
|||
ret = libusb_control_transfer(devh, CTRL_OUT, 0x4, REQ_READBULK,
|
||||
0, packet, 8, TIMEOUT);
|
||||
if (ret != 8)
|
||||
printf("%s: libusb_control_transfer returned %d\n",
|
||||
sr_err("%s: libusb_control_transfer returned %d\n",
|
||||
__FUNCTION__, ret);
|
||||
|
||||
ret = libusb_bulk_transfer(devh, ENDPOINT_BULK_IN, buffer, size,
|
||||
&transferred, TIMEOUT);
|
||||
if (ret < 0)
|
||||
fprintf(stderr, "Bulk read error %d\n", ret);
|
||||
sr_err("Bulk read error %d\n", ret);
|
||||
return transferred;
|
||||
}
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ char **sr_parse_triggerstring(struct sr_device *device,
|
|||
}
|
||||
|
||||
if (probenum < 1 || probenum > max_probes) {
|
||||
printf("Invalid probe.\n");
|
||||
sr_err("Invalid probe.\n");
|
||||
error = TRUE;
|
||||
break;
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ char **sr_parse_triggerstring(struct sr_device *device,
|
|||
if ((trigger = strchr(tokens[i], '='))) {
|
||||
for (tc = ++trigger; *tc; tc++) {
|
||||
if (strchr(trigger_types, *tc) == NULL) {
|
||||
printf("Unsupported trigger type "
|
||||
sr_err("Unsupported trigger type "
|
||||
"'%c'\n", *tc);
|
||||
error = TRUE;
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue