swc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/swc
Log | Files | Refs | README | LICENSE

commit b8c441e460ee76e94b6b7ce453cc04019a823164
parent ab2d2dbed1f03a3838ce6964ff07c92bd1662cdc
Author: Michael Forney <mforney@mforney.org>
Date:   Wed, 22 Jan 2014 15:51:53 -0800

seat: Remove device if reopening failed

Diffstat:
Mlibswc/evdev_device.c | 3++-
Mlibswc/seat.c | 13++++++++++---
2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/libswc/evdev_device.c b/libswc/evdev_device.c @@ -286,7 +286,8 @@ bool swc_evdev_device_reopen(struct swc_evdev_device * device) if (device->fd == -1) { - ERROR("Failed to open input device at %s\n", device->path); + WARNING("Failed to reopen input device at %s: %s\n", + device->path, strerror(errno)); goto error0; } diff --git a/libswc/seat.c b/libswc/seat.c @@ -141,14 +141,21 @@ static struct wl_listener data_device_listener = { static void handle_launch_event(struct wl_listener * listener, void * data) { struct swc_event * event = data; - struct swc_evdev_device * device; + struct swc_evdev_device * device, * next; switch (event->type) { case SWC_LAUNCH_EVENT_ACTIVATED: /* Re-open all input devices */ - wl_list_for_each(device, &seat.devices, link) - swc_evdev_device_reopen(device); + wl_list_for_each_safe(device, next, &seat.devices, link) + { + if (!swc_evdev_device_reopen(device)) + { + wl_list_remove(&device->link); + swc_evdev_device_destroy(device); + } + } + break; } }