From aceffe4729536292889be2e5e472349265626507 Mon Sep 17 00:00:00 2001 From: Alexandre Ratchov Date: Fri, 30 Aug 2019 17:02:54 +0200 Subject: [PATCH] siomix_sun: poll the mixer fd to detect when device is gone. This doesn't work yet, as the audio(4) driver doesn't properly wakeup processes waiting in the poll syscall, see audio_detach() --- libsndio/siomix_sun.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libsndio/siomix_sun.c b/libsndio/siomix_sun.c index 066fe8a..2ac79d7 100644 --- a/libsndio/siomix_sun.c +++ b/libsndio/siomix_sun.c @@ -392,7 +392,7 @@ siomix_sun_setctl(struct siomix_hdl *arg, unsigned int addr, unsigned int val) static int siomix_sun_nfds(struct siomix_hdl *addr) { - return 0; + return 1; } static int @@ -401,6 +401,8 @@ siomix_sun_pollfd(struct siomix_hdl *addr, struct pollfd *pfd, int events) struct siomix_sun_hdl *hdl = (struct siomix_sun_hdl *)addr; hdl->events = events; + pfd->events = 0; + pfd->fd = hdl->fd; return 0; } @@ -409,6 +411,6 @@ siomix_sun_revents(struct siomix_hdl *addr, struct pollfd *pfd) { struct siomix_sun_hdl *hdl = (struct siomix_sun_hdl *)addr; - return hdl->events & POLLOUT; + return pfd->revents | (hdl->events & POLLOUT); } #endif