summaryrefslogtreecommitdiffstats
path: root/import-layers/meta-raspberrypi/recipes-core
diff options
context:
space:
mode:
Diffstat (limited to 'import-layers/meta-raspberrypi/recipes-core')
-rw-r--r--import-layers/meta-raspberrypi/recipes-core/udev/udev-rules-rpi.bb12
-rw-r--r--import-layers/meta-raspberrypi/recipes-core/udev/udev-rules-rpi/99-com.rules21
2 files changed, 33 insertions, 0 deletions
diff --git a/import-layers/meta-raspberrypi/recipes-core/udev/udev-rules-rpi.bb b/import-layers/meta-raspberrypi/recipes-core/udev/udev-rules-rpi.bb
new file mode 100644
index 000000000..20443d322
--- /dev/null
+++ b/import-layers/meta-raspberrypi/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/import-layers/meta-raspberrypi/recipes-core/udev/udev-rules-rpi/99-com.rules b/import-layers/meta-raspberrypi/recipes-core/udev/udev-rules-rpi/99-com.rules
new file mode 100644
index 000000000..6bf019bd1
--- /dev/null
+++ b/import-layers/meta-raspberrypi/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"
OpenPOWER on IntegriCloud