summaryrefslogtreecommitdiff
path: root/libusb/os/linux_udev.c
diff options
context:
space:
mode:
authorChris Dickens <christopher.a.dickens@gmail.com>2013-06-27 09:14:15 -0700
committerHans de Goede <hdegoede@redhat.com>2013-08-21 15:58:00 +0200
commit6732582bb17662aa02a913008be899ef9ace5870 (patch)
tree6c9534fdff1757f5e94135c4f876b6ecf953904c /libusb/os/linux_udev.c
parenta06eafdc528d5f3ea21a26c34ceaa13e09dfd4f3 (diff)
downloadlibusb-6732582bb17662aa02a913008be899ef9ace5870.tar.gz
linux: Handle device disconnection early when possible
If a device is open, the device's fd will trigger a POLLERR condition once it is removed. Sometimes this can occur well before the udev monitor sends the remove event. This can also be caught early if the device is not currently open but an attempt to open it is made. In both situations, this can be caught early and processed so that the device does not continue to show up in the device list after it has been disconnected but before the udev monitor processes the event. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'libusb/os/linux_udev.c')
-rw-r--r--libusb/os/linux_udev.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libusb/os/linux_udev.c b/libusb/os/linux_udev.c
index 70f632d..99ac943 100644
--- a/libusb/os/linux_udev.c
+++ b/libusb/os/linux_udev.c
@@ -240,7 +240,7 @@ static void udev_hotplug_event(struct udev_device* udev_dev)
if (strncmp(udev_action, "add", 3) == 0) {
linux_hotplug_enumerate(busnum, devaddr, sys_name);
} else if (detached) {
- linux_hotplug_disconnected(busnum, devaddr, sys_name);
+ linux_device_disconnected(busnum, devaddr, sys_name);
} else {
usbi_err(NULL, "ignoring udev action %s", udev_action);
}