mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
parent
d7f7fd258d
commit
1110dbb7c1
1 changed files with 13 additions and 19 deletions
|
|
@ -393,19 +393,6 @@ static void process_device(struct impl *impl, uint32_t action, struct udev_devic
|
|||
}
|
||||
}
|
||||
|
||||
static int stop_inotify(struct device *dev)
|
||||
{
|
||||
struct impl *impl = dev->impl;
|
||||
if (dev->notify.fd == -1)
|
||||
return 0;
|
||||
spa_log_info(impl->log, "stop inotify for /dev/video%u", dev->id);
|
||||
spa_loop_remove_source(impl->main_loop, &dev->notify);
|
||||
close(dev->notify.fd);
|
||||
dev->notify.fd = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void impl_on_notify_events(struct spa_source *source)
|
||||
{
|
||||
struct device *dev = source->data;
|
||||
|
|
@ -415,12 +402,7 @@ static void impl_on_notify_events(struct spa_source *source)
|
|||
struct inotify_event e; /* for appropriate alignment */
|
||||
} buf;
|
||||
|
||||
if (source->rmask & (SPA_IO_ERR | SPA_IO_HUP)) {
|
||||
spa_log_warn(impl->log, "notify error on /dev/video%u", dev->id);
|
||||
stop_inotify(dev);
|
||||
return;
|
||||
}
|
||||
while (source->rmask & SPA_IO_IN) {
|
||||
while (true) {
|
||||
ssize_t len;
|
||||
const struct inotify_event *event;
|
||||
void *p, *e;
|
||||
|
|
@ -487,6 +469,18 @@ static int start_inotify(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int stop_inotify(struct device *dev)
|
||||
{
|
||||
struct impl *impl = dev->impl;
|
||||
if (dev->notify.fd == -1)
|
||||
return 0;
|
||||
spa_log_info(impl->log, "stop inotify for /dev/video%u", dev->id);
|
||||
spa_loop_remove_source(impl->main_loop, &dev->notify);
|
||||
close(dev->notify.fd);
|
||||
dev->notify.fd = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void impl_on_fd_events(struct spa_source *source)
|
||||
{
|
||||
struct impl *impl = source->data;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue