Le 15/04/2018 à 21:09, Luke Faraone a écrit :
On Sun, Apr 15, 2018 at 6:01 PM, Ludovic Rousseau
<ludovic.rouss...@free.fr> wrote:
Exact.

Try with this new patch.
You will have to remove the previous patch, or start from the clean sources
first.

Aha, now we have something.

The problem is with the call to udev_device_get_parent_with_subsystem_devtype()
https://salsa.debian.org/rousseau/PCSC/blob/master/src/hotplug_libudev.c#L338

Maybe USB-C ports are different than "normal" USB.


Also please generate a "udevadm monitor" log.
Start "udevadm monitor --property" (no need to be root)
Plug the reader
Unplug the reader
and send me the output.

Thanks

--
 Dr. Ludovic Rousseau
diff --git a/src/hotplug_libudev.c b/src/hotplug_libudev.c
index 184b6b3..1601a95 100644
--- a/src/hotplug_libudev.c
+++ b/src/hotplug_libudev.c
@@ -330,15 +330,25 @@ static void HPRemoveDevice(struct udev_device *dev)
        struct udev_device *parent;
        const char *sysname;
 
+       sysname = udev_device_get_sysname(dev);
+       if (!sysname)
+       {
+               Log1(PCSC_LOG_ERROR, "udev_device_get_sysname() failed");
+               return;
+       }
+       Log2(PCSC_LOG_DEBUG, "removing sysname: %s", sysname);
+
        /* The device pointed to by dev contains information about
           the interface. In order to get information about the USB
           device, get the parent device with the subsystem/devtype pair
           of "usb"/"usb_device". This will be several levels up the
           tree, but the function will find it.*/
-       parent = udev_device_get_parent_with_subsystem_devtype(dev, "usb",
-               "usb_device");
+       parent = udev_device_get_parent_with_subsystem_devtype(dev, "usb", 
NULL);
        if (!parent)
+       {
+               Log0(PCSC_LOG_DEBUG);
                return;
+       }
 
        devpath = udev_device_get_devnode(parent);
        if (!devpath)
@@ -348,13 +358,6 @@ static void HPRemoveDevice(struct udev_device *dev)
                return;
        }
 
-       sysname = udev_device_get_sysname(dev);
-       if (!sysname)
-       {
-               Log1(PCSC_LOG_ERROR, "udev_device_get_sysname() failed");
-               return;
-       }
-
        for (i=0; i<PCSCLITE_MAX_READERS_CONTEXTS; i++)
        {
                if (readerTracker[i].fullName && !strcmp(sysname, 
readerTracker[i].sysname))

Reply via email to