ols: Get fd from sp_get_port_handle() rather than serial struct.

This commit is contained in:
Martin Ling 2013-12-07 19:35:13 +00:00
parent 64ecf7ee52
commit bf72f64999
2 changed files with 6 additions and 2 deletions

View File

@ -18,6 +18,7 @@
*/
#include "protocol.h"
#include <libserialport.h>
#define SERIALCOMM "115200/8n1"
@ -152,7 +153,7 @@ static GSList *scan(GSList *options)
/* Wait 10ms for a response. */
g_usleep(10000);
probefd.fd = serial->fd;
sp_get_port_handle(serial->data, &probefd.fd);
probefd.events = G_IO_IN;
g_poll(&probefd, 1, 1);

View File

@ -18,6 +18,7 @@
*/
#include "protocol.h"
#include <libserialport.h>
extern SR_PRIV struct sr_dev_driver ols_driver_info;
static struct sr_dev_driver *di = &ols_driver_info;
@ -354,6 +355,7 @@ SR_PRIV int ols_receive_data(int fd, int revents, void *cb_data)
int num_channels, offset, j;
unsigned int i;
unsigned char byte;
int serial_fd;
drvc = di->priv;
@ -363,7 +365,8 @@ SR_PRIV int ols_receive_data(int fd, int revents, void *cb_data)
sdi = l->data;
devc = sdi->priv;
serial = sdi->conn;
if (serial->fd == fd)
sp_get_port_handle(serial->data, &serial_fd);
if (serial_fd == fd)
break;
devc = NULL;
}