X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fopenbench-logic-sniffer%2Fols.c;h=582a258c9b881abc3d7f427dc554028dae082232;hb=1483577eed7ac27b8107b1b76e1adc5369745c29;hp=7f44788e4a012d2a2742aaaaee894dffdc0f13c6;hpb=c2616fb9faca19945154974884a0816359cec1df;p=libsigrok.git diff --git a/hardware/openbench-logic-sniffer/ols.c b/hardware/openbench-logic-sniffer/ols.c index 7f44788e..582a258c 100644 --- a/hardware/openbench-logic-sniffer/ols.c +++ b/hardware/openbench-logic-sniffer/ols.c @@ -37,6 +37,11 @@ #endif #include #include +#include + +#ifdef _WIN32 +#define O_NONBLOCK FIONBIO +#endif #define NUM_PROBES 32 #define NUM_TRIGGER_STAGES 4 @@ -115,7 +120,7 @@ static int send_shortcommand(int fd, uint8_t command) g_debug("ols: sending cmd 0x%.2x", command); buf[0] = command; - if (write(fd, buf, 1) != 1) + if (serial_write(fd, buf, 1) != 1) return SIGROK_ERR; return SIGROK_OK; @@ -131,7 +136,7 @@ static int send_longcommand(int fd, uint8_t command, uint32_t data) buf[2] = (data & 0xff0000) >> 16; buf[3] = (data & 0xff00) >> 8; buf[4] = data & 0xff; - if (write(fd, buf, 5) != 5) + if (serial_write(fd, buf, 5) != 5) return SIGROK_ERR; return SIGROK_OK; @@ -276,7 +281,7 @@ static int hw_init(char *deviceinfo) g_poll(fds, devcnt, 1); for (i = 0; i < devcnt; i++) { if (fds[i].revents == G_IO_IN) { - if (read(fds[i].fd, buf, 4) == 4) { + if (serial_read(fds[i].fd, buf, 4) == 4) { if (!strncmp(buf, "1SLO", 4) || !strncmp(buf, "1ALS", 4)) { if (!strncmp(buf, "1SLO", 4)) @@ -511,7 +516,7 @@ static int receive_data(int fd, int revents, void *user_data) if (revents == G_IO_IN && num_transfers / num_channels <= limit_samples) { - if (read(fd, &byte, 1) != 1) + if (serial_read(fd, &byte, 1) != 1) return FALSE; sample[num_bytes++] = byte; @@ -773,7 +778,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id) { struct datafeed_packet packet; - /* QUICK HACK */ + /* Avoid compiler warnings. */ device_index = device_index; packet.type = DF_END;