aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2017-03-28 00:50:29 +0300
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2017-04-04 08:46:37 +0000
commitddd3b0c6dc3705502b1d620093674ace3f08773a (patch)
tree04eece568969e5c325d0f3227f8a14d7c89b3319
parent8fc617944db680bcc77564b339bb6c44eca24044 (diff)
lightmediascanner: add udev scan rule
Initialize a scan on media insertion, and trigger an dbus event on media removal. AGL-Issue: SPEC-483 Change-Id: I7cd79401938f7671dc642647848381259cf87915 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
-rw-r--r--meta-agl/recipes-multimedia/lightmediascanner/files/lightmediascanner.rules2
-rw-r--r--meta-agl/recipes-multimedia/lightmediascanner/files/lightmediascanner.sh9
-rw-r--r--meta-agl/recipes-multimedia/lightmediascanner/lightmediascanner_%.bbappend7
3 files changed, 18 insertions, 0 deletions
diff --git a/meta-agl/recipes-multimedia/lightmediascanner/files/lightmediascanner.rules b/meta-agl/recipes-multimedia/lightmediascanner/files/lightmediascanner.rules
new file mode 100644
index 000000000..86c39e463
--- /dev/null
+++ b/meta-agl/recipes-multimedia/lightmediascanner/files/lightmediascanner.rules
@@ -0,0 +1,2 @@
+SUBSYSTEM=="block", ACTION=="add" RUN+="/etc/udev/scripts/lightmediascanner.sh"
+SUBSYSTEM=="block", ACTION=="remove" RUN+="/etc/udev/scripts/lightmediascanner.sh"
diff --git a/meta-agl/recipes-multimedia/lightmediascanner/files/lightmediascanner.sh b/meta-agl/recipes-multimedia/lightmediascanner/files/lightmediascanner.sh
new file mode 100644
index 000000000..8aa397eee
--- /dev/null
+++ b/meta-agl/recipes-multimedia/lightmediascanner/files/lightmediascanner.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# Call from udev
+#
+# Attempt to scan any new inserted media
+
+name="`basename "$DEVNAME"`"
+
+/usr/bin/lightmediascannerctl scan audio:/run/media/$(basename "$DEVNAME")
diff --git a/meta-agl/recipes-multimedia/lightmediascanner/lightmediascanner_%.bbappend b/meta-agl/recipes-multimedia/lightmediascanner/lightmediascanner_%.bbappend
index 231b3e665..4ad8abbbb 100644
--- a/meta-agl/recipes-multimedia/lightmediascanner/lightmediascanner_%.bbappend
+++ b/meta-agl/recipes-multimedia/lightmediascanner/lightmediascanner_%.bbappend
@@ -5,6 +5,8 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://lightmediascanner.service \
file://plugin-ogg-fix-chucksize-issue.patch \
+ file://lightmediascanner.rules \
+ file://lightmediascanner.sh \
"
inherit systemd
@@ -20,6 +22,11 @@ do_install_append() {
ln -sf ${systemd_user_unitdir}/lightmediascanner.service ${D}/etc/systemd/user/dbus-org.lightmediascanner.service
ln -sf ${systemd_user_unitdir}/lightmediascanner.service ${D}/etc/systemd/user/default.target.wants/lightmediascanner.service
fi
+
+ if ${@bb.utils.contains('DISTRO_FEATURES', 'automount', 'true', 'false', d)}; then
+ install -m 644 -p -D ${WORKDIR}/lightmediascanner.rules ${D}/etc/udev/rules.d/lightmediascanner.rules
+ install -m 755 -p -D ${WORKDIR}/lightmediascanner.sh ${D}/etc/udev/scripts/lightmediascanner.sh
+ fi
}
FILES_${PN} += " \