mirror of
git://git.yoctoproject.org/meta-raspberrypi.git
synced 2025-07-19 21:09:03 +02:00
udev: Create rules file to generate serial0/1
Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
This commit is contained in:
parent
45638700dd
commit
1df7181396
12
recipes-core/udev/udev-rules-rpi.bb
Normal file
12
recipes-core/udev/udev-rules-rpi.bb
Normal file
|
@ -0,0 +1,12 @@
|
|||
DESCRIPTION = "udev rules for Raspberry Pi Boards"
|
||||
LICENSE = "MIT"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
|
||||
|
||||
SRC_URI = " file://99-com.rules"
|
||||
|
||||
S = "${WORKDIR}"
|
||||
|
||||
do_install () {
|
||||
install -d ${D}${sysconfdir}/udev/rules.d
|
||||
install -m 0644 ${WORKDIR}/99-com.rules ${D}${sysconfdir}/udev/rules.d/
|
||||
}
|
21
recipes-core/udev/udev-rules-rpi/99-com.rules
Normal file
21
recipes-core/udev/udev-rules-rpi/99-com.rules
Normal file
|
@ -0,0 +1,21 @@
|
|||
KERNEL=="ttyAMA[01]", PROGRAM="/bin/sh -c '\
|
||||
ALIASES=/proc/device-tree/aliases; \
|
||||
if cmp -s $ALIASES/uart0 $ALIASES/serial0; then \
|
||||
echo 0;\
|
||||
elif cmp -s $ALIASES/uart0 $ALIASES/serial1; then \
|
||||
echo 1; \
|
||||
else \
|
||||
exit 1; \
|
||||
fi\
|
||||
'", SYMLINK+="serial%c"
|
||||
|
||||
KERNEL=="ttyS0", PROGRAM="/bin/sh -c '\
|
||||
ALIASES=/proc/device-tree/aliases; \
|
||||
if cmp -s $ALIASES/uart1 $ALIASES/serial0; then \
|
||||
echo 0; \
|
||||
elif cmp -s $ALIASES/uart1 $ALIASES/serial1; then \
|
||||
echo 1; \
|
||||
else \
|
||||
exit 1; \
|
||||
fi \
|
||||
'", SYMLINK+="serial%c"
|
Loading…
Reference in New Issue
Block a user