mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-02-21 01:42:18 +00:00
detect when USB serial adapters have been pulled on OSX
(was spinning in poll())
This commit is contained in:
parent
05d4c14188
commit
bca0145b13
@ -303,7 +303,12 @@ int fd_poll()
|
||||
if (fds[i].revents) {
|
||||
int fd = fds[i].fd;
|
||||
/* Call the alarm callback with the socket in non-blocking mode */
|
||||
errno=0;
|
||||
set_nonblock(fd);
|
||||
// Work around OSX behaviour that doesn't set POLLERR on
|
||||
// devices that have been deconfigured, e.g., a USB serial adapter
|
||||
// that has been removed.
|
||||
if (errno == ENXIO) fds[i].revents|=POLLERR;
|
||||
call_alarm(fd_callbacks[i], fds[i].revents);
|
||||
/* The alarm may have closed and unwatched the descriptor, make sure this descriptor still matches */
|
||||
if (i<fdcount && fds[i].fd == fd)
|
||||
|
Loading…
x
Reference in New Issue
Block a user