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.
This commit is contained in:
Maciej S. Szmigiero 2022-10-21 00:33:41 +02:00
parent 81a89385a4
commit dcb4600b33
2 changed files with 23 additions and 2 deletions

View file

@ -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,

View file

@ -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"))