From 71635cacea0c5069753d6405bdd771fa008d8208 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 27 Oct 2023 09:34:19 +0100 Subject: [PATCH] 99-com.rules: Improve serial matching on older Pis See: https://github.com/RPi-Distro/raspberrypi-sys-mods/issues/84 --- etc.armhf/udev/rules.d/99-com.rules | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/etc.armhf/udev/rules.d/99-com.rules b/etc.armhf/udev/rules.d/99-com.rules index 1931d3d..7ad5f38 100644 --- a/etc.armhf/udev/rules.d/99-com.rules +++ b/etc.armhf/udev/rules.d/99-com.rules @@ -17,11 +17,11 @@ SUBSYSTEM=="pwm", ACTION!="remove", PROGRAM="/bin/sh -c 'chgrp -R gpio /sys%p && KERNEL=="ttyAMA[0-9]*|ttyS[0-9]*", PROGRAM="/bin/sh -c '\ ALIASES=/proc/device-tree/aliases; \ TTYNODE=$$(readlink /sys/class/tty/%k/device/of_node | sed 's/base/:/' | cut -d: -f2); \ - if [ -e $$ALIASES/bluetooth ] && [ $$TTYNODE/bluetooth = $$(strings $$ALIASES/bluetooth) ]; then \ - echo 1; \ - elif [ -e $$ALIASES/console ]; then \ + if [ -e $$ALIASES/console ]; then \ if [ $$TTYNODE = $$(strings $$ALIASES/console) ]; then \ - echo 0;\ + echo 0; \ + elif [ -e $$ALIASES/bluetooth ] && [ $$TTYNODE/bluetooth = $$(strings $$ALIASES/bluetooth) ]; then \ + echo 1; \ else \ exit 1; \ fi \