]> sigrok.org Git - libsigrok.git/commitdiff
Use sp_get_port_handle to get an fd for adding/removing serial sources.
authorMartin Ling <redacted>
Sat, 7 Dec 2013 19:19:20 +0000 (19:19 +0000)
committerMartin Ling <redacted>
Sat, 7 Dec 2013 19:43:47 +0000 (19:43 +0000)
hardware/common/serial.c

index af80356a3cc72a714627a272e0a420c1a22e28d0..781edc19fc9d37e4af396b137a3b07b8c6a856fa 100644 (file)
@@ -642,10 +642,22 @@ SR_PRIV int sr_serial_extract_options(GSList *options, const char **serial_devic
 SR_PRIV int serial_source_add(struct sr_serial_dev_inst *serial, int events,
                int timeout, sr_receive_data_callback_t cb, void *cb_data)
 {
-       return sr_source_add(serial->fd, events, timeout, cb, cb_data);
+#ifdef _WIN32
+       return SR_ERR;
+#else
+       int fd;
+       sp_get_port_handle(serial->data, &fd);
+       return sr_source_add(fd, events, timeout, cb, cb_data);
+#endif
 }
 
 SR_PRIV int serial_source_remove(struct sr_serial_dev_inst *serial)
 {
-       return sr_source_remove(serial->fd);
+#ifdef _WIN32
+       return SR_ERR;
+#else
+       int fd;
+       sp_get_port_handle(serial->data, &fd);
+       return sr_source_remove(fd);
+#endif
 }