]> sigrok.org Git - libsigrok.git/commitdiff
libsigrok: Use sr_err() et al instead of printf.
authorUwe Hermann <redacted>
Thu, 17 Nov 2011 21:54:17 +0000 (22:54 +0100)
committerUwe Hermann <redacted>
Thu, 17 Nov 2011 22:47:45 +0000 (23:47 +0100)
hardware/asix-sigma/asix-sigma.c
hardware/zeroplus-logic-cube/gl_usb.c
strutil.c

index e7d6f7833103bd608a4a29344bbec7ec2ad9f4ea..71cb2fddcdd7b9d41eeb4e2325a0e0e2a6b9e914 100644 (file)
@@ -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;
        }
 
index b371ba5979c8afe1d6292febbd9cc2f28b83ad0d..c84e61c4c980d911223ce43e9b0632cd7c568b3e 100644 (file)
@@ -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;
 }
 
index 8b0203b01765cd06ff8fb35b07fb0df0309f0a1c..9bdf4336e4394cc1ac851b4f3b50cbe6fc4cee31 100644 (file)
--- 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;