#endif
#include <glib.h>
#include <sigrok.h>
+#include <sigrok-internal.h>
+
+#ifdef _WIN32
+#define O_NONBLOCK FIONBIO
+#endif
#define NUM_PROBES 32
#define NUM_TRIGGER_STAGES 4
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;
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;
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))
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;
{
struct datafeed_packet packet;
- /* QUICK HACK */
+ /* Avoid compiler warnings. */
device_index = device_index;
packet.type = DF_END;