From 9c38fc51f16fd964e27daaa417a93ab77468c614 Mon Sep 17 00:00:00 2001 From: Adam Goode Date: Wed, 16 May 2018 09:52:36 -0400 Subject: [PATCH] Fix detection of USB disconnect for ALSA devices Without this change, jack gets stuck in a tight poll() loop that it never recovers from. This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1416091 --- ChangeLog | 1 + linux/alsa/alsa_driver.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/ChangeLog b/ChangeLog index 197434ed..b19ad7f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -37,6 +37,7 @@ Lars-Peter Clausen Alexandru Tofan Kim Jeong Yeon Filipe Coelho +Google LLC --------------------------- Jackdmp changes log diff --git a/linux/alsa/alsa_driver.c b/linux/alsa/alsa_driver.c index 7460efdc..197d7e0b 100644 --- a/linux/alsa/alsa_driver.c +++ b/linux/alsa/alsa_driver.c @@ -1401,6 +1401,12 @@ alsa_driver_wait (alsa_driver_t *driver, int extra_fd, int *status, float return 0; } + if (revents & POLLNVAL) { + jack_error ("ALSA: playback device disconnected"); + *status = -7; + return 0; + } + if (revents & POLLERR) { xrun_detected = TRUE; } @@ -1424,6 +1430,12 @@ alsa_driver_wait (alsa_driver_t *driver, int extra_fd, int *status, float return 0; } + if (revents & POLLNVAL) { + jack_error ("ALSA: capture device disconnected"); + *status = -7; + return 0; + } + if (revents & POLLERR) { xrun_detected = TRUE; }