spa: v4l2: handle IN_IGNORED events from inotify

This commit is contained in:
Barnabás Pőcze 2024-01-09 18:25:39 +01:00
parent 69f9e75458
commit 0158b5dcb6

View file

@ -441,8 +441,6 @@ static void impl_on_notify_events(struct spa_source *source)
for (p = &buf; p < e; for (p = &buf; p < e;
p = SPA_PTROFF(p, sizeof(struct inotify_event) + event->len, void)) { p = SPA_PTROFF(p, sizeof(struct inotify_event) + event->len, void)) {
event = (const struct inotify_event *) p; event = (const struct inotify_event *) p;
if ((event->mask & IN_ATTRIB)) {
struct device *device = NULL; struct device *device = NULL;
for (size_t i = 0; i < this->n_devices; i++) { for (size_t i = 0; i < this->n_devices; i++) {
@ -452,14 +450,19 @@ static void impl_on_notify_events(struct spa_source *source)
} }
} }
spa_assert(device); if (!device)
continue;
if (event->mask & IN_ATTRIB) {
bool access = check_access(this, device); bool access = check_access(this, device);
if (access && !device->emitted) if (access && !device->emitted)
process_device(this, ACTION_ADD, device); process_device(this, ACTION_ADD, device);
else if (!access && device->emitted) else if (!access && device->emitted)
process_device(this, ACTION_DISABLE, device); process_device(this, ACTION_DISABLE, device);
} }
if (event->mask & IN_IGNORED)
device->inotify_wd = -1;
} }
} }
} }