From: Uwe Hermann Date: Thu, 17 Nov 2011 21:54:17 +0000 (+0100) Subject: libsigrok: Use sr_err() et al instead of printf. X-Git-Tag: libsigrok-0.1.0~228 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=a562c3a2e5e54dbb7e0553422ac0e0c845b180ad;p=libsigrok.git libsigrok: Use sr_err() et al instead of printf. --- diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c index e7d6f783..71cb2fdd 100644 --- a/hardware/asix-sigma/asix-sigma.c +++ b/hardware/asix-sigma/asix-sigma.c @@ -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; } diff --git a/hardware/zeroplus-logic-cube/gl_usb.c b/hardware/zeroplus-logic-cube/gl_usb.c index b371ba59..c84e61c4 100644 --- a/hardware/zeroplus-logic-cube/gl_usb.c +++ b/hardware/zeroplus-logic-cube/gl_usb.c @@ -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; } diff --git a/strutil.c b/strutil.c index 8b0203b0..9bdf4336 100644 --- a/strutil.c +++ b/strutil.c @@ -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;