From 6885a857e4071536d3e378f0bf41c02e959a7681 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 6 Dec 2021 16:05:35 +0900 Subject: [PATCH] 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. --- src/udev/udev-builtin-path_id.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c index 9f71fadeea8..6fdd3eceea3 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"); } -- 2.47.3