summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-12-06 16:05:35 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-12-06 16:06:04 +0900
commit6885a857e4071536d3e378f0bf41c02e959a7681 (patch)
tree63ee90c6a3662d1fbecbe9a00e465c971da1654c
parent56615f203bf78684d05828c2718325016f0d025f (diff)
downloadsystemd-6885a857e4071536d3e378f0bf41c02e959a7681.tar.gz
udev/path-id: comment why USB host number is dropped from the PATH_ID
Closes #21617. The comment is borrowed from https://github.com/systemd/systemd/pull/21620#discussion_r762521508.
-rw-r--r--src/udev/udev-builtin-path_id.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
index 9f71fadeea..6fdd3eceea 100644
--- a/src/udev/udev-builtin-path_id.c
+++ b/src/udev/udev-builtin-path_id.c
@@ -503,6 +503,10 @@ static sd_device *handle_usb(sd_device *parent, char **path) {
return parent;
port++;
+ /* USB host number may change across reboots (and probably even without reboot). The part after
+ * USB host number is determined by device topology and so does not change. Hence, drop the
+ * host number and always use '0' instead. */
+
path_prepend(path, "usb-0:%s", port);
return skip_subsystem(parent, "usb");
}