From c63660b9136012df2f25b355a9790aad3e7e9fb5 Mon Sep 17 00:00:00 2001 From: Olivier Guiter Date: Mon, 4 Mar 2013 19:06:13 +0100 Subject: [PATCH] Near Field communication recipe for neard 0.9 The Linux NFC project aims to provide a full NFC support for Linux. It is based on the neard NFC user space stack running on top of the Linux kernel NFC subsystem. The code generated using this recipe was tested on a ARM11 device, with a kernel 3.6, using, for the NFC hardware, a USB dongle with the PN533 chipset (SCL3711) (From OE-Core rev: b2a74ae70725be7efc0226901fd560d3b3b48607) Signed-off-by: Saul Wold Signed-off-by: Richard Purdie --- meta/conf/distro/include/default-distrovars.inc | 2 +- meta/recipes-connectivity/neard/neard/neard | 42 ++++++++++++++++ meta/recipes-connectivity/neard/neard_0.9.bb | 57 ++++++++++++++++++++++ .../packagegroups/packagegroup-base.bb | 14 ++++++ 4 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-connectivity/neard/neard/neard create mode 100644 meta/recipes-connectivity/neard/neard_0.9.bb diff --git a/meta/conf/distro/include/default-distrovars.inc b/meta/conf/distro/include/default-distrovars.inc index 1169ca5..f0fec2a 100644 --- a/meta/conf/distro/include/default-distrovars.inc +++ b/meta/conf/distro/include/default-distrovars.inc @@ -18,7 +18,7 @@ DISTRO_FEATURES_LIBC_DEFAULT ?= "ipv4 ipv6 libc-backtrace libc-big-macros libc-b DISTRO_FEATURES_LIBC ?= "${DISTRO_FEATURES_LIBC_DEFAULT}" DISTRO_FEATURES_LIBC_class-nativesdk = "${DISTRO_FEATURES_LIBC_DEFAULT}" DISTRO_FEATURES_INITMAN ?= "sysvinit" -DISTRO_FEATURES ?= "alsa argp bluetooth ext2 irda largefile pcmcia usbgadget usbhost wifi xattr nfs zeroconf pci 3g x11 ${DISTRO_FEATURES_LIBC} ${DISTRO_FEATURES_INITMAN}" +DISTRO_FEATURES ?= "alsa argp bluetooth ext2 irda largefile pcmcia usbgadget usbhost wifi xattr nfs zeroconf pci 3g nfc x11 ${DISTRO_FEATURES_LIBC} ${DISTRO_FEATURES_INITMAN}" IMAGE_FEATURES ?= "" diff --git a/meta/recipes-connectivity/neard/neard/neard b/meta/recipes-connectivity/neard/neard/neard new file mode 100644 index 0000000..5f36174 --- /dev/null +++ b/meta/recipes-connectivity/neard/neard/neard @@ -0,0 +1,42 @@ +#!/bin/sh + +DAEMON=/usr/sbin/neard +PIDFILE=/var/run/neard.pid +DESC="Linux NFC daemon" + +if [ -f /etc/default/neard ] ; then + . /etc/default/neard +fi + +set -e + +do_start() { + $DAEMON +} + +do_stop() { + start-stop-daemon --stop --name neard --quiet +} + +case "$1" in + start) + echo "Starting $DESC" + do_start + ;; + stop) + echo "Stopping $DESC" + do_stop + ;; + restart|force-reload) + echo "Restarting $DESC" + do_stop + sleep 1 + do_start + ;; + *) + echo "Usage: $0 {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/meta/recipes-connectivity/neard/neard_0.9.bb b/meta/recipes-connectivity/neard/neard_0.9.bb new file mode 100644 index 0000000..61ea58c --- /dev/null +++ b/meta/recipes-connectivity/neard/neard_0.9.bb @@ -0,0 +1,57 @@ +SUMMARY = "Linux NFC daemon" +DESCRIPTION = "A daemon for the Linux Near Field Communication stack" +HOMEPAGE = "http://01.org/linux-nfc" + +LICENSE = "GPLv2" + +DEPENDS = "dbus glib-2.0 libnl" + +inherit autotools pkgconfig update-rc.d + +INITSCRIPT_NAME = "neard" +INITSCRIPT_PARAMS = "defaults 64" + +# This would copy neard start-stop shell and test scripts +do_install_append() { + install -d ${D}${sysconfdir}/init.d/ + install -m 0755 ${WORKDIR}/neard ${D}${sysconfdir}/init.d/neard + + install -d ${D}${libdir}/neard + install -m 0755 ${S}/test/* ${D}${libdir}/neard/ + install -m 0755 ${S}/tools/nfctool/nfctool ${D}${libdir}/neard/ +} + +RDEPENDS_${PN} = "dbus python python-dbus python-pygobject" + +# Bluez & Wifi are not mandatory except for handover " +RRECOMMENDS_${PN} = "\ + ${@base_contains('DISTRO_FEATURES', 'bluetooth', 'bluez4', '', d)} \ + ${@base_contains('DISTRO_FEATURES', 'wifi','wpa-supplicant', '', d)} \ + " + +#Additional +PACKAGES =+ "${PN}-tests" + +FILES_${PN}-tests = "${libdir}/neard/*-test" +RDEPENDS_${PN}-tests = "python python-dbus python-pygobject" + +FILES_${PN}-dbg += "${bindir}/neard/*/.debug" + +##============================= +# This is valid for 0.9+ +LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e \ + file://src/near.h;beginline=1;endline=20;md5=358e4deefef251a4761e1ffacc965d13 \ + " +S = "${WORKDIR}/git" +SRCREV = "7abdb13d106d496e1115fab49e6448a249dfb3c8" +PV = "0.9-git${SRCPV}" +PR = "r1" + +SRC_URI = "git://git.kernel.org/pub/scm/network/nfc/neard.git;protocol=git \ + file://neard \ + " + +EXTRA_OECONF += "--enable-tools \ + " + + diff --git a/meta/recipes-core/packagegroups/packagegroup-base.bb b/meta/recipes-core/packagegroups/packagegroup-base.bb index 100cc88..799e12a 100644 --- a/meta/recipes-core/packagegroups/packagegroup-base.bb +++ b/meta/recipes-core/packagegroups/packagegroup-base.bb @@ -28,6 +28,7 @@ PACKAGES = ' \ ${@base_contains("DISTRO_FEATURES", "bluetooth", "packagegroup-base-bluetooth", "", d)} \ ${@base_contains("DISTRO_FEATURES", "wifi", "packagegroup-base-wifi", "", d)} \ ${@base_contains("DISTRO_FEATURES", "3g", "packagegroup-base-3g", "", d)} \ + ${@base_contains("DISTRO_FEATURES", "nfc", "packagegroup-base-nfc", "", d)} \ ${@base_contains("DISTRO_FEATURES", "cramfs", "packagegroup-base-cramfs", "", d)} \ ${@base_contains("DISTRO_FEATURES", "ipsec", "packagegroup-base-ipsec", "", d)} \ ${@base_contains("DISTRO_FEATURES", "ipv6", "packagegroup-base-ipv6", "", d)} \ @@ -71,6 +72,7 @@ RDEPENDS_packagegroup-base = "\ ${@base_contains('COMBINED_FEATURES', 'bluetooth', 'packagegroup-base-bluetooth', '',d)} \ ${@base_contains('COMBINED_FEATURES', 'wifi', 'packagegroup-base-wifi', '',d)} \ ${@base_contains('COMBINED_FEATURES', '3g', 'packagegroup-base-3g', '',d)} \ + ${@base_contains('COMBINED_FEATURES', 'nfc', 'packagegroup-base-nfc', '',d)} \ \ ${@base_contains('DISTRO_FEATURES', 'nfs', 'packagegroup-base-nfs', '',d)} \ ${@base_contains('DISTRO_FEATURES', 'cramfs', 'packagegroup-base-cramfs', '',d)} \ @@ -96,11 +98,13 @@ RDEPENDS_packagegroup-base-extended = "\ ${ADD_WIFI} \ ${ADD_BT} \ ${ADD_3G} \ + ${ADD_NFC} \ " ADD_WIFI = "" ADD_BT = "" ADD_3G = "" +ADD_NFC = "" python __anonymous () { # If Distro want wifi and machine feature wifi/pci/pcmcia/usbhost (one of them) @@ -118,6 +122,9 @@ python __anonymous () { if "3g" in distro_features and not "3g" in machine_features and ("pcmcia" in machine_features or "pci" in machine_features or "usbhost" in machine_features): d.setVar("ADD_3G", "packagegroup-base-3g") + if "nfc" in distro_features and not "nfc" in machine_features and ("usbhost" in machine_features): + d.setVar("ADD_NFC", "packagegroup-base-nfc") + # For backwards compatibility after rename packages = d.getVar("PACKAGES", True).split() for pkg in packages: @@ -309,6 +316,13 @@ RRECOMMENDS_packagegroup-base-wifi = "\ kernel-module-aes-generic \ kernel-module-aes" +SUMMARY_packagegroup-base-nfc = "Near Field Communication support" +RDEPENDS_packagegroup-base-nfc = "\ + neard" + +RRECOMMENDS_packagegroup-base-nfc = "\ + kernel-module-nfc" + SUMMARY_packagegroup-base-3g = "Cellular data support" RDEPENDS_packagegroup-base-3g = "\ ofono" -- 2.7.4