2aacef
From 03bb31bbb875e20da7ae37eb44e98d244823e0e7 Mon Sep 17 00:00:00 2001
2aacef
From: Yu Watanabe <watanabe.yu+github@gmail.com>
2aacef
Date: Thu, 3 Nov 2022 09:52:23 +0900
2aacef
Subject: [PATCH] udev: add safe guard for setting by-id symlink
2aacef
2aacef
The ID_BUS property is necessary for creating by-id symlinks.
2aacef
2aacef
(cherry picked from commit 5286da064c97d2ac934cb301066aaa8605a3c8f9)
2aacef
2aacef
Related #2138081
2aacef
---
2aacef
 rules.d/60-serial.rules | 1 +
2aacef
 1 file changed, 1 insertion(+)
2aacef
2aacef
diff --git a/rules.d/60-serial.rules b/rules.d/60-serial.rules
2aacef
index 2c1488e930..a0e66323a9 100644
2aacef
--- a/rules.d/60-serial.rules
2aacef
+++ b/rules.d/60-serial.rules
2aacef
@@ -17,6 +17,7 @@ IMPORT{builtin}="path_id"
2aacef
 ENV{ID_PATH}=="?*", ENV{.ID_PORT}=="", SYMLINK+="serial/by-path/$env{ID_PATH}"
2aacef
 ENV{ID_PATH}=="?*", ENV{.ID_PORT}=="?*", SYMLINK+="serial/by-path/$env{ID_PATH}-port$env{.ID_PORT}"
2aacef
 
2aacef
+ENV{ID_BUS}=="", GOTO="serial_end"
2aacef
 ENV{ID_SERIAL}=="", GOTO="serial_end"
2aacef
 ENV{ID_USB_INTERFACE_NUM}=="", GOTO="serial_end"
2aacef
 ENV{.ID_PORT}=="", SYMLINK+="serial/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$env{ID_USB_INTERFACE_NUM}"