[Pcsclite-cvs-commit] r5793 - /trunk/PCSC/src/hotplug_libudev.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Wed Jun 15 14:10:45 UTC 2011


Author: rousseau
Date: Wed Jun 15 14:10:45 2011
New Revision: 5793

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5793
Log:
HPEstablishUSBNotifications(): wait for a udev event before calling
udev_monitor_receive_device()

Fix Alioth bug [#313165] "libudev-support broken with udev-171:
udev_monitor_receive_device() error"

Modified:
    trunk/PCSC/src/hotplug_libudev.c

Modified: trunk/PCSC/src/hotplug_libudev.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/hotplug_libudev.c?rev=5793&op=diff
==============================================================================
--- trunk/PCSC/src/hotplug_libudev.c (original)
+++ trunk/PCSC/src/hotplug_libudev.c Wed Jun 15 14:10:45 2011
@@ -524,6 +524,8 @@
 {
 	struct udev_monitor *udev_monitor;
 	int r, i;
+	int fd;
+	fd_set fds;
 
 	udev_monitor = udev_monitor_new_from_netlink(udev, "udev");
 
@@ -543,6 +545,9 @@
 		return;
 	}
 
+	/* udev monitor file descriptor */
+	fd = udev_monitor_get_fd(udev_monitor);
+
 	while (!AraKiriHotPlug)
 	{
 		struct udev_device *dev, *parent;
@@ -551,6 +556,17 @@
 #ifdef DEBUG_HOTPLUG
 		Log0(PCSC_LOG_INFO);
 #endif
+
+		FD_ZERO(&fds);
+		FD_SET(fd, &fds);
+
+		/* wait for a udev event */
+		r = select(fd+1, &fds, NULL, NULL, NULL);
+		if (r < 0)
+		{
+			Log2(PCSC_LOG_ERROR, "select(): %s", strerror(errno));
+			return;
+		}
 
 		dev = udev_monitor_receive_device(udev_monitor);
 		if (!dev)




More information about the Pcsclite-cvs-commit mailing list