2aacef
From 080747ee6685b9c5877073c5120375e7a04d8216 Mon Sep 17 00:00:00 2001
2aacef
From: Yu Watanabe <watanabe.yu+github@gmail.com>
2aacef
Date: Thu, 3 Nov 2022 09:39:36 +0900
2aacef
Subject: [PATCH] udev: first set properties based on usb subsystem
2aacef
2aacef
After 479da1107a0d4e2f7ef5cd938512b87a0e45f180, the usb_id builtin
2aacef
command does not set ID_SERIAL if ID_BUS is already set.
2aacef
Before the commit, all properties set based on pci bus were overwritten
2aacef
by the usb_id, hence now it is sufficient setting them only when ID_BUS is
2aacef
not set yet.
2aacef
2aacef
Fixes #25238.
2aacef
2aacef
(cherry picked from commit 01e704eba982fbc1517287cd261d229ff8e0a779)
2aacef
2aacef
Related #2138081
2aacef
---
2aacef
 rules.d/60-serial.rules | 5 +++--
2aacef
 1 file changed, 3 insertions(+), 2 deletions(-)
2aacef
2aacef
diff --git a/rules.d/60-serial.rules b/rules.d/60-serial.rules
2aacef
index f303e27fd5..c133f26109 100644
2aacef
--- a/rules.d/60-serial.rules
2aacef
+++ b/rules.d/60-serial.rules
2aacef
@@ -3,9 +3,10 @@
2aacef
 ACTION=="remove", GOTO="serial_end"
2aacef
 SUBSYSTEM!="tty", GOTO="serial_end"
2aacef
 
2aacef
-SUBSYSTEMS=="pci", ENV{ID_BUS}="pci", ENV{ID_VENDOR_ID}="$attr{vendor}", ENV{ID_MODEL_ID}="$attr{device}"
2aacef
-SUBSYSTEMS=="pci", IMPORT{builtin}="hwdb --subsystem=pci"
2aacef
 SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id", IMPORT{builtin}="hwdb --subsystem=usb"
2aacef
+SUBSYSTEMS=="pci", ENV{ID_BUS}=="", ENV{ID_BUS}="pci", \
2aacef
+  ENV{ID_VENDOR_ID}="$attr{vendor}", ENV{ID_MODEL_ID}="$attr{device}", \
2aacef
+  IMPORT{builtin}="hwdb --subsystem=pci"
2aacef
 
2aacef
 # /dev/serial/by-path/, /dev/serial/by-id/ for USB devices
2aacef
 KERNEL!="ttyUSB[0-9]*|ttyACM[0-9]*", GOTO="serial_end"