Comments (6)
@pelwell, is this something that has been or will be fixed with newer firmware/kernel or just expected behaviour?
from raspberrypi-sys-mods.
It's definitely not expected behaviour, and it may have been fixed with the latest firmware (coming to an apt upgrade soon) - knowing which Pi it was would help.
from raspberrypi-sys-mods.
Reproduced on a Pi 400.
from raspberrypi-sys-mods.
Serial Device Alias Fault Diagnosis
The problem is the line:
readlink /sys/class/tty/ttyS[0-9]*/device/of_node | sed 's/base/:/' | cut -d: -f2
in
/etc/udev/rules.d/99-com.rules
On Pi5 it works.
On Pi4 it does not.
The problem is the format of the descriptor for ttyS0 is different.
On Pi5:
$ echo cat /proc/device-tree/model
Raspberry Pi 5 Model B Rev 1.0
$ tail -2 /boot/firmware/config.txt
enable_uart=1
dtoverlay=disable-bt
$ readlink /sys/class/tty/ttyS0/device/of_node
../../../../firmware/devicetree/base/soc/serial@7d50c000
On Pi4:
$ echo cat /proc/device-tree/model
Raspberry Pi 4 Model B Rev 1.4
$ tail -2 /boot/firmware/config.txt
enable_uart=1
dtoverlay=disable-bt
$ readlink /sys/class/tty/ttyS0/device/of_node
$ ls /sys/class/tty/ttyS0/device/
driver driver_override modalias power subsystem tty uevent
Bottom line:
/etc/udev/rules.d/99-com.rules
requires modification to work on models other than Pi5. The test on of_node fails on Pi4 because it does not exist.
from raspberrypi-sys-mods.
The real problem is that the use of the bluetooth alias to determine which UART is which should be conditional on the existence of the console alias, not vice-versa:
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 \
Doing so with dtoverlay=disable-bt
results in:
/dev/serial0 -> ttyAMA0
which is arguably more correct than:
/dev/serial0 -> ttyAMA0
/dev/serial1 -> ttyS0
since /dev/ttyS0 doesn't actually work (try it - the device node is disabled, and yet somehow the driver is creating a /dev/ entry for it, perhaps because of 8250.nr_uarts=1
on the command line).
from raspberrypi-sys-mods.
There's now a PR with this change: #85
from raspberrypi-sys-mods.
Related Issues (20)
- Dedicated LTS Raspberry Pi OS image for Compute Modules. HOT 3
- Raspberry Pi OS Image is missing Microsoft Repository HOT 1
- [Bullseye] postinst script contains every auto-added block four times HOT 3
- Post-installation script subprocess returned error exit status 126 HOT 5
- Remove 010_pi-nopasswd HOT 7
- New postinst flush code fails if vfat partition not found HOT 3
- [bullseye] FIRSTBOOT exits prematurely on NOOBS/PINN sd card HOT 4
- `init_config` python module named 'toml' is missing in Raspberry Pi OS lite 64bit HOT 2
- missing license HOT 2
- Introduce the ability to limit rootfs size at first boot HOT 16
- firstboot script hangs if image contains already kernel 6.1
- "imager_custom set_wlan" generates script but does not escape special characters properly HOT 1
- Abstract boot partition path HOT 5
- Exit status of grep HOT 2
- Firstboot fix_partuuid issues
- How to update wifi after first boot? HOT 13
- imager_set_custom using uuid which is not always available HOT 1
- Initrd rootfs resize fails on RPi5 HOT 12
- Recent removal of /boot/cmdline.txt link to /boot/firmware/cmdline.txt HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from raspberrypi-sys-mods.