From dd03036667a5fe159cc5ef2a4c06e7ddae3812fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Sun, 7 Jan 2024 02:39:48 +0100 Subject: [PATCH] spa: alsa: handle `IN_IGNORED` instead of `IN_DELETE_SELF` `IN_IGNORED` event is sent whenever the watch is removed, which includes when the entity is deleted among other things, so watch that instead of the more specific `IN_DELETE_SELF`. (cherry picked from commit 04b8a0c2153d2eeda19151ae502cdad473df0a71) --- spa/plugins/alsa/alsa-udev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spa/plugins/alsa/alsa-udev.c b/spa/plugins/alsa/alsa-udev.c index aa480780e..ca6ce6702 100644 --- a/spa/plugins/alsa/alsa-udev.c +++ b/spa/plugins/alsa/alsa-udev.c @@ -857,7 +857,7 @@ static void impl_on_notify_events(struct spa_source *source) process_card(this, ACTION_DISABLE, card->udev_device); } /* /dev/snd/ might have been removed */ - if ((event->mask & (IN_DELETE_SELF | IN_MOVE_SELF))) + if ((event->mask & (IN_IGNORED | IN_MOVE_SELF))) deleted = true; } } @@ -876,7 +876,7 @@ static int start_inotify(struct impl *this) return -errno; res = inotify_add_watch(notify_fd, "/dev/snd", - IN_ATTRIB | IN_CLOSE_WRITE | IN_DELETE_SELF | IN_MOVE_SELF); + IN_ATTRIB | IN_CLOSE_WRITE | IN_MOVE_SELF); if (res < 0) { res = -errno; close(notify_fd);