diff options
author | Maciej S. Szmigiero <mail@maciej.szmigiero.name> | 2022-10-21 00:33:41 +0200 |
---|---|---|
committer | Maciej S. Szmigiero <mail@maciej.szmigiero.name> | 2022-10-29 15:32:04 +0200 |
commit | dcb4600b3302d0f9e225a0db4c836f0a9725195a (patch) | |
tree | 487fc9f47309e007b10b7a093f4da8a5d8fb06d4 | |
parent | 81a89385a45d3de1028bcd86b3688fb465b4035c (diff) | |
download | upower-dcb4600b3302d0f9e225a0db4c836f0a9725195a.tar.gz |
enumerator-udev: also check for an idevice on "usb" subsystem
Commit 1550d50f ("linux: Remove "usb" subsystem match") broke detection of
some idevices, since it left just the "usbmisc" subsystem match while some
idevice / kernel combinations (at least an iPhone 11 on a 6.0 kernel) don't
present any such udev usbmisc devices.
However, they do present "usb" subsystem ones, so add this match back.
Leave idevice detection also for the "usbmisc" match since that's what the
original (known working) code before aforementioned commit did - it is
possible that it is required for some kernel / idevice combinations.
-rwxr-xr-x | src/linux/integration-test.py | 8 | ||||
-rw-r--r-- | src/linux/up-enumerator-udev.c | 17 |
2 files changed, 23 insertions, 2 deletions
diff --git a/src/linux/integration-test.py b/src/linux/integration-test.py index 1e48fa2..db5058c 100755 --- a/src/linux/integration-test.py +++ b/src/linux/integration-test.py @@ -2291,6 +2291,14 @@ class Tests(dbusmock.DBusTestCase): 'remove') self.testbed.uevent('/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.2/0003:056A:0084.0021/input/input129', 'remove') + self.testbed.uevent('/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.0', + 'remove') + self.testbed.uevent('/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.1', + 'remove') + self.testbed.uevent('/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.2', + 'remove') + self.testbed.uevent('/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1', + 'remove') self.daemon_log.check_line('No devices with parent /sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1 left', timeout=2) # Ensure the object is really gone from the bus, diff --git a/src/linux/up-enumerator-udev.c b/src/linux/up-enumerator-udev.c index 1182bdf..3077d11 100644 --- a/src/linux/up-enumerator-udev.c +++ b/src/linux/up-enumerator-udev.c @@ -120,6 +120,19 @@ device_new (UpEnumeratorUdev *self, GUdevDevice *native) "native", native, NULL); + } else if (g_strcmp0 (subsys, "usb") == 0) { +#ifdef HAVE_IDEVICE + UpDevice *device; + + device = g_initable_new (UP_TYPE_DEVICE_IDEVICE, NULL, NULL, + "daemon", daemon, + "native", native, + NULL); + if (device) + return device; +#endif /* HAVE_IDEVICE */ + + return NULL; } else if (g_strcmp0 (subsys, "usbmisc") == 0) { #ifdef HAVE_IDEVICE UpDevice *device; @@ -289,8 +302,8 @@ up_enumerator_udev_initable_init (UpEnumerator *enumerator) guint i; const gchar **subsystems; /* List "input" first just to avoid some sibling hotplugging later */ - const gchar *subsystems_no_wup[] = {"input", "power_supply", "usbmisc", NULL}; - const gchar *subsystems_wup[] = {"input", "power_supply", "usbmisc", "tty", NULL}; + const gchar *subsystems_no_wup[] = {"input", "power_supply", "usb", "usbmisc", NULL}; + const gchar *subsystems_wup[] = {"input", "power_supply", "usb", "usbmisc", "tty", NULL}; config = up_config_new (); if (up_config_get_boolean (config, "EnableWattsUpPro")) |