diff options
author | Andrei Gherzan <andrei@gherzan.ro> | 2017-04-18 16:34:59 +0100 |
---|---|---|
committer | Andrei Gherzan <andrei@gherzan.ro> | 2017-04-19 17:47:39 +0100 |
commit | 668446e2835b3d48f9eda6648a09a825fe61c04c (patch) | |
tree | f2410674c78529d7469af16c51cdf7a671e9b501 | |
parent | 8a450f0a8a9b9c421eef1a8a97432e7c93b0bb8e (diff) | |
download | meta-raspberrypi-668446e2835b3d48f9eda6648a09a825fe61c04c.tar.gz |
udev: Create rules file to generate serial0/1
Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
-rw-r--r-- | recipes-core/udev/udev-rules-rpi.bb | 12 | ||||
-rw-r--r-- | recipes-core/udev/udev-rules-rpi/99-com.rules | 21 |
2 files changed, 33 insertions, 0 deletions
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 @@ | |||
1 | DESCRIPTION = "udev rules for Raspberry Pi Boards" | ||
2 | LICENSE = "MIT" | ||
3 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" | ||
4 | |||
5 | SRC_URI = " file://99-com.rules" | ||
6 | |||
7 | S = "${WORKDIR}" | ||
8 | |||
9 | do_install () { | ||
10 | install -d ${D}${sysconfdir}/udev/rules.d | ||
11 | install -m 0644 ${WORKDIR}/99-com.rules ${D}${sysconfdir}/udev/rules.d/ | ||
12 | } | ||
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 @@ | |||
1 | KERNEL=="ttyAMA[01]", PROGRAM="/bin/sh -c '\ | ||
2 | ALIASES=/proc/device-tree/aliases; \ | ||
3 | if cmp -s $ALIASES/uart0 $ALIASES/serial0; then \ | ||
4 | echo 0;\ | ||
5 | elif cmp -s $ALIASES/uart0 $ALIASES/serial1; then \ | ||
6 | echo 1; \ | ||
7 | else \ | ||
8 | exit 1; \ | ||
9 | fi\ | ||
10 | '", SYMLINK+="serial%c" | ||
11 | |||
12 | KERNEL=="ttyS0", PROGRAM="/bin/sh -c '\ | ||
13 | ALIASES=/proc/device-tree/aliases; \ | ||
14 | if cmp -s $ALIASES/uart1 $ALIASES/serial0; then \ | ||
15 | echo 0; \ | ||
16 | elif cmp -s $ALIASES/uart1 $ALIASES/serial1; then \ | ||
17 | echo 1; \ | ||
18 | else \ | ||
19 | exit 1; \ | ||
20 | fi \ | ||
21 | '", SYMLINK+="serial%c" | ||