From 93fb29642286df305fd9f68830dad34a12fca5b5 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Wed, 26 Dec 2012 17:30:37 +0100 Subject: remove devices when it has been unplugged from system --- inputdev.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/inputdev.c b/inputdev.c index 8c2c82c..2a168e4 100644 --- a/inputdev.c +++ b/inputdev.c @@ -295,7 +295,14 @@ void cInputDevice::handle(void) rc = read(fd_, &ev, sizeof ev); if (rc < 0 && errno == EINTR) return; - + + if (rc < 0 && errno == ENODEV) { + isyslog("%s: device '%s' removed\n", + controller_.plugin_name(), get_dev_path()); + controller_.remove_device(this); + return; + } + if (rc < 0) { esyslog("%s: failed to read from %s: %s\n", controller_.plugin_name(), get_dev_path(), -- cgit v1.2.3