From: Yu Watanabe Date: Mon, 6 Dec 2021 07:05:35 +0000 (+0900) Subject: udev/path-id: comment why USB host number is dropped from the PATH_ID X-Git-Tag: v250-rc1~64^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6885a857e4071536d3e378f0bf41c02e959a7681;p=thirdparty%2Fsystemd.git 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. --- 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"); }