]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/ipdbg-la/protocol.c
ipdbg-la: data_available(): Return gboolean.
[libsigrok.git] / src / hardware / ipdbg-la / protocol.c
index c9fc45a472629f1792b5d5a24afa6480bd9baeee..69c461ff6fa06d5f6995ef2f89b13cc135c324e7 100644 (file)
@@ -68,7 +68,7 @@
 /* LA subfunction command opcodes */
 #define CMD_LA_DELAY               0x1F
 
-SR_PRIV int data_available(struct ipdbg_la_tcp *tcp)
+SR_PRIV gboolean data_available(struct ipdbg_la_tcp *tcp)
 {
 #ifdef __WIN32__
        ioctlsocket(tcp->socket, FIONREAD, &bytes_available);
@@ -76,11 +76,11 @@ SR_PRIV int data_available(struct ipdbg_la_tcp *tcp)
        int status;
 
        if (ioctl(tcp->socket, FIONREAD, &status) < 0) {        // TIOCMGET
-               sr_err("FIONREAD failed: %s\n", strerror(errno));
-               return 0;
+               sr_err("FIONREAD failed: %s\n", g_strerror(errno));
+               return FALSE;
        }
 
-       return (status < 1) ? 0 : 1;
+       return (status < 1) ? FALSE : TRUE;
 #endif  // __WIN32__
 }
 
@@ -89,7 +89,6 @@ SR_PRIV struct ipdbg_la_tcp *ipdbg_la_tcp_new(void)
        struct ipdbg_la_tcp *tcp;
 
        tcp = g_malloc0(sizeof(struct ipdbg_la_tcp));
-
        tcp->address = NULL;
        tcp->port = NULL;
        tcp->socket = -1;
@@ -308,7 +307,7 @@ SR_PRIV int ipdbg_la_receive_data(int fd, int revents, void *cb_data)
                devc->raw_sample_buf =
                        g_try_malloc(devc->limit_samples * devc->DATA_WIDTH_BYTES);
                if (!devc->raw_sample_buf) {
-                       sr_warn("Sample buffer malloc failed.");
+                       sr_err("Sample buffer malloc failed.");
                        return FALSE;
                }
        }