From 668446e2835b3d48f9eda6648a09a825fe61c04c Mon Sep 17 00:00:00 2001 From: Andrei Gherzan Date: Tue, 18 Apr 2017 16:34:59 +0100 Subject: udev: Create rules file to generate serial0/1 Signed-off-by: Andrei Gherzan --- recipes-core/udev/udev-rules-rpi.bb | 12 ++++++++++++ recipes-core/udev/udev-rules-rpi/99-com.rules | 21 +++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 recipes-core/udev/udev-rules-rpi.bb create mode 100644 recipes-core/udev/udev-rules-rpi/99-com.rules (limited to 'recipes-core') diff --git a/recipes-core/udev/udev-rules-rpi.bb b/recipes-core/udev/udev-rules-rpi.bb new file mode 100644 index 0000000..20443d3 --- /dev/null +++ b/recipes-core/udev/udev-rules-rpi.bb @@ -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/ +} diff --git a/recipes-core/udev/udev-rules-rpi/99-com.rules b/recipes-core/udev/udev-rules-rpi/99-com.rules new file mode 100644 index 0000000..6bf019b --- /dev/null +++ b/recipes-core/udev/udev-rules-rpi/99-com.rules @@ -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" -- cgit v1.2.3-54-g00ecf