mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Giuseppe Piscitelli <ooonea@gmail.com>
To: linux-usb@vger.kernel.org
Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	linux-api@vger.kernel.org
Subject: [RFC PATCH] USB: core: emit a device-level modalias
Date: Wed,  7 Oct 2026 18:17:21 +0200	[thread overview]
Message-ID: <20261007161721.60593-1-ooonea@gmail.com> (raw)

USB device drivers can load from interface modaliases after a userspace
client has already configured the device. Loading apple-mfi-fastcharge
then reprobes the generic binding and interrupts usbmuxd transfers.

Emit a modalias on the device event, with unknown interface fields left
as wildcards. The existing udev module loader can load matching modules
before consumers receive the processed device event. Keep interface
modaliases and the driver teardown paths unchanged.

Signed-off-by: Giuseppe Piscitelli <ooonea@gmail.com>
Assisted-by: OpenAI Codex
---
Tested on x86_64 with Linux 7.2.9 and an iPhone (05ac:12a8). With no
Apple module preload, the first insertion after boot loads the module,
keeps configuration 4 and works with iLoader without restarting usbmuxd.
The current usb_uevent function also passes 18 source-extracted cases.

 drivers/usb/core/driver.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 3c3bbaf89..29d1acba9 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -954,6 +954,17 @@ static int usb_uevent(const struct device *dev, struct kobj_uevent_env *env)
 			   usb_dev->descriptor.bDeviceProtocol))
 		return -ENOMEM;
 
+	if (is_usb_device(dev) &&
+	    add_uevent_var(env,
+			   "MODALIAS=usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic*isc*ip*in*",
+			   le16_to_cpu(usb_dev->descriptor.idVendor),
+			   le16_to_cpu(usb_dev->descriptor.idProduct),
+			   le16_to_cpu(usb_dev->descriptor.bcdDevice),
+			   usb_dev->descriptor.bDeviceClass,
+			   usb_dev->descriptor.bDeviceSubClass,
+			   usb_dev->descriptor.bDeviceProtocol))
+		return -ENOMEM;
+
 	return 0;
 }
 

base-commit: 42bcac323cc3b16566fed8c5b250318ad02a0de0

             reply	other threads:[~2026-10-07 16:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-07 16:17 Giuseppe Piscitelli [this message]
2026-10-07 17:55 ` Alan Stern
2026-10-07 19:11   ` [RFC PATCH v2] " Giuseppe Piscitelli
2026-10-07 19:17     ` Alan Stern
2026-10-07 20:41     ` Michal Pecio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261007161721.60593-1-ooonea@gmail.com \
    --to=ooonea@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®