Skip to content

Commit 42cdfb0

Browse files
committed
Fix udev rules to support Linux kernels 6.8+
Linux kernels before had devpath containing `usbN-portM`. Newer kernels just use `port` symlink instead, which breaks our udev rules. Changing glob from `*-port*` to `*port*` makes it work for both old and new kernels. Closes issues #608, #609.
1 parent c74755b commit 42cdfb0

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ Then, add udev rules like below to file `/etc/udev/rules.d/52-usb.rules`
250250
SUBSYSTEM=="usb", DRIVER=="usb", MODE="0666", ATTR{idVendor}=="2001"
251251
# Linux 6.0 or later (its ok to have this block present for older Linux kernels):
252252
SUBSYSTEM=="usb", DRIVER=="usb", \
253-
RUN="/bin/sh -c \"chmod -f 666 $sys$devpath/*-port*/disable || true\""
253+
RUN="/bin/sh -c \"chmod -f 666 $sys$devpath/*port*/disable || true\""
254254

255255
Note that for USB3 hubs, some hubs use different vendor ID for USB2 vs USB3 components of the same chip,
256256
and both need permissions to make uhubctl work properly.
@@ -264,8 +264,8 @@ If you don't like wide open mode `0666`, you can restrict access by group like t
264264
SUBSYSTEM=="usb", DRIVER=="usb", MODE="0664", GROUP="dialout"
265265
# Linux 6.0 or later (its ok to have this block present for older Linux kernels):
266266
SUBSYSTEM=="usb", DRIVER=="usb", \
267-
RUN+="/bin/sh -c \"chown -f root:dialout $sys$devpath/*-port*/disable || true\"" \
268-
RUN+="/bin/sh -c \"chmod -f 660 $sys$devpath/*-port*/disable || true\""
267+
RUN+="/bin/sh -c \"chown -f root:dialout $sys$devpath/*port*/disable || true\"" \
268+
RUN+="/bin/sh -c \"chmod -f 660 $sys$devpath/*port*/disable || true\""
269269

270270
and then add permitted users to `dialout` group:
271271

udev/rules.d/52-usb.rules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ SUBSYSTEM=="usb", DRIVER=="usb", MODE="0664", GROUP="dialout"
2020

2121
# This is for Linux 6.0 or later (ok to keep this block present for older Linux kernels):
2222
SUBSYSTEM=="usb", DRIVER=="usb", \
23-
RUN+="/bin/sh -c \"chown -f root:dialout $sys$devpath/*-port*/disable || true\"" \
24-
RUN+="/bin/sh -c \"chmod -f 660 $sys$devpath/*-port*/disable || true\""
23+
RUN+="/bin/sh -c \"chown -f root:dialout $sys$devpath/*port*/disable || true\"" \
24+
RUN+="/bin/sh -c \"chmod -f 660 $sys$devpath/*port*/disable || true\""

0 commit comments

Comments
 (0)