X-Original-To: alpine-aports@mail.alpinelinux.org Delivered-To: alpine-aports@mail.alpinelinux.org Received: from mail.alpinelinux.org (dallas-a1.alpinelinux.org [127.0.0.1]) by mail.alpinelinux.org (Postfix) with ESMTP id D9D4FDCA552 for ; Fri, 1 May 2015 18:19:06 +0000 (UTC) Received: from zivm-wwu2.uni-muenster.de (ZIVM-WWU2-1.UNI-MUENSTER.DE [128.176.192.5]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by mail.alpinelinux.org (Postfix) with ESMTPS id 39DA4DCA292 for ; Fri, 1 May 2015 18:19:00 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2DdDADOwkNV/43AsIBcgwxTtCwPAQEBAQEBBQE/Q5EOAV1Th2BMAQEBAQEBgQuFb4ktBAmkNqMkhhaOWwWVeYgghVuEWIlqI2BmAQsBEoIRgzIBAQE X-IPAS-Result: A2DdDADOwkNV/43AsIBcgwxTtCwPAQEBAQEBBQE/Q5EOAV1Th2BMAQEBAQEBgQuFb4ktBAmkNqMkhhaOWwWVeYgghVuEWIlqI2BmAQsBEoIRgzIBAQE X-IronPort-AV: E=Sophos;i="5.13,351,1427752800"; d="scan'208";a="76132162" Received: from secmail.uni-muenster.de ([128.176.192.141]) by zivm-relay2.uni-muenster.de with ESMTP; 01 May 2015 20:18:58 +0200 Received: from pibplus.fritz.box (i59F5C63B.versanet.de [89.245.198.59]) by SECMAIL.UNI-MUENSTER.DE (Postfix) with ESMTP id AA0B5BF402 for ; Fri, 1 May 2015 20:18:57 +0200 (CEST) From: Marian Buschsieweke To: alpine-aports@lists.alpinelinux.org Subject: [alpine-aports] [PATCH] testing/raspicomm-module: new aport Date: Fri, 1 May 2015 20:18:44 +0200 Message-Id: <1430504324-5520-1-git-send-email-mari.hahn@wwu.de> X-Mailer: git-send-email 2.3.7 X-Virus-Scanned: ClamAV using ClamSMTP X-Mailinglist: alpine-aports Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: $pkgurl "http://www.amescon.com/products/raspicomm/" $pkgdesc "Support Amescon's RasPiComm module: Kernel module for RS-485 Port and OpenRC services to set up RTC, Joystick and LEDs" The RasPiConn module is a board to attach on a Raspberry Pis GPIO PINs that provides an RS-232 Port, RS-485 Port, a real time clock, a joystick (digital), and two LEDs. --- testing/raspicomm-module/APKBUILD | 58 ++++++++++++++++++++++ testing/raspicomm-module/raspicomm-joystick | 46 +++++++++++++++++ testing/raspicomm-module/raspicomm-leds | 40 +++++++++++++++ .../raspicomm-module.post-deinstall | 3 ++ .../raspicomm-module/raspicomm-module.post-install | 13 +++++ .../raspicomm-module/raspicomm-module.post-upgrade | 3 ++ testing/raspicomm-module/raspicomm-rtc | 8 +++ 7 files changed, 171 insertions(+) create mode 100644 testing/raspicomm-module/APKBUILD create mode 100755 testing/raspicomm-module/raspicomm-joystick create mode 100755 testing/raspicomm-module/raspicomm-leds create mode 100755 testing/raspicomm-module/raspicomm-module.post-deinstall create mode 100755 testing/raspicomm-module/raspicomm-module.post-install create mode 100755 testing/raspicomm-module/raspicomm-module.post-upgrade create mode 100755 testing/raspicomm-module/raspicomm-rtc diff --git a/testing/raspicomm-module/APKBUILD b/testing/raspicomm-module/APKBUILD new file mode 100644 index 0000000..e8ca347 --- /dev/null +++ b/testing/raspicomm-module/APKBUILD @@ -0,0 +1,58 @@ +# Contributor: Marian Buschsieweke (mari (dot) hahn (at) wwu (dot) de) +# Maintainer: +pkgname=raspicomm-module +pkgver=1.4 +pkgrel=0 +pkgdesc="Support Amescon's RasPiComm module: Kernel module for RS-485 Port and OpenRC services to set up RTC, Joystick and LEDs" +url="http://www.amescon.com/products/raspicomm/" +arch="all" +license="unknown" +depends="linux-rpi" +depends_dev="linux-rpi-dev" +makedepends="$depends_dev" +install="${pkgname}.post-install ${pkgname}.post-upgrade ${pkgname}.post-deinstall" +subpackages="" #"$pkgname-dev $pkgname-doc" +source="saveas-http://github.com/amescon/${pkgname}/archive/v${pkgver}.tar.gz/raspicomm-module-v${pkgver}.tar.gz + raspicomm-rtc + raspicomm-joystick + raspicomm-leds" + +_builddir="${srcdir}/${pkgname}-${pkgver}" +_module_dir="/lib/modules/$(apk info linux-rpi | grep description | sed -e 's/ description://' -e 's/linux-rpi-//' -e 's/r//')-rpi" +_module_name="raspicommrs485" + +prepare() { + local i + cd "$_builddir" + for i in $source; do + case $i in + *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;; + esac + done +} + +build() { + cd "$_builddir" + make -f Makefile_rpi +} + +package() { + cd "$_builddir" + install -Dm644 ${_module_name}.ko "${pkgdir}/${_module_dir}/kernel/custom/${_module_name}.ko" + install -Dm755 ../raspicomm-rtc "${pkgdir}/etc/init.d/raspicomm-rtc" + install -Dm755 ../raspicomm-joystick "${pkgdir}/etc/init.d/raspicomm-joystick" + install -Dm755 ../raspicomm-leds "${pkgdir}/etc/init.d/raspicomm-leds" +} + +md5sums="a1ce78aabf54ff34910f51d6df552080 raspicomm-module-v1.4.tar.gz +40c281e5b2f90b424c013a8159e9b00b raspicomm-rtc +f65fd74ca42ed979a306f6c4f793f331 raspicomm-joystick +afcda01e94f534e807255ffd2806782b raspicomm-leds" +sha256sums="dc21b43e9c663a4d3b2fdc39ed20cace2e1e1901f2476cc9305ec3f3a1722895 raspicomm-module-v1.4.tar.gz +443c89dddf6d0c97e152ec8cbade9e275fe552c020a1007e4c64e555f9fa90ee raspicomm-rtc +7a0396b53c6b2f72d294d46bf9769a43301f253a401d8fe69d74d21df3e534ef raspicomm-joystick +9c9226439e7ca3ae3a7f144488df56e13de07537ca4b0473807d5919f377d2e7 raspicomm-leds" +sha512sums="2c8b1516362cf0c88e3fe9caedabe48a4d5f459407974f040b24f79b782b4f43a64738b2ea4a4b43b0397cfbfe7d7a333d31a018334cb55d4bd84ec4aa8010b2 raspicomm-module-v1.4.tar.gz +04e62603ea8667625d37e45b09b031d84e7d0b77e47fd9eeef86d5b39374c922a78cad8f55b11140931a65f4225f347da2c7a2ec3b7d4a14af85cab5b8b50392 raspicomm-rtc +11cd2c8bfa000f1af301960d97a234f50a5fbb77355a00c09c6cb3c16ae14afb562caaa4d339e9faeac255f22474c55e0b7726ad3e469a88dae01d8b392b80c2 raspicomm-joystick +12c791a27f38db94bc7e2222d5a517d79f6ee495122d50c3687e94a29dc0126291fb0f17327b704d0be4549e2b85b5d5ac9be1f7cb3e96e5e497c7ac91f40a41 raspicomm-leds" diff --git a/testing/raspicomm-module/raspicomm-joystick b/testing/raspicomm-module/raspicomm-joystick new file mode 100755 index 0000000..fe5cf1a --- /dev/null +++ b/testing/raspicomm-module/raspicomm-joystick @@ -0,0 +1,46 @@ +#!/sbin/openrc-run +# Enable the joystick on Amescon's RasPiComm module + +gpio_up() { + if [ ! -e "/sys/class/gpio/gpio$1" ]; then + echo $1 > /sys/class/gpio/export + fi + echo $2 > "/sys/class/gpio/gpio$1/direction" + + chmod 664 "/sys/class/gpio/gpio$1/value" + chown root:gpio "/sys/class/gpio/gpio$1/value" + ln -s "/sys/class/gpio/gpio$1/value" "/dev/raspicomm/$3" +} + +gpio_down() { + if [ -e "/sys/class/gpio/gpio$1" ]; then + echo $1 > /sys/class/gpio/unexport + fi + + rm -f "/dev/raspicomm/$2" +} + +prepare_folder() { + mkdir -p "/dev/raspicomm" +} + +start() { + ebegin "Exporting RasPiComm's joystick" + prepare_folder + gpio_up "4" "in" "js_right" + gpio_up "22" "in" "js_push" + gpio_up "23" "in" "js_down" + gpio_up "24" "in" "js_left" + gpio_up "25" "in" "js_up" + eend $? +} + +stop() { + ebegin "Unexporting RasPiComm's jaystick" + gpio_down "4" "js_right" + gpio_down "22" "js_push" + gpio_down "23" "js_down" + gpio_down "24" "js_left" + gpio_down "25" "js_up" + eend $? +} diff --git a/testing/raspicomm-module/raspicomm-leds b/testing/raspicomm-module/raspicomm-leds new file mode 100755 index 0000000..ecbd003 --- /dev/null +++ b/testing/raspicomm-module/raspicomm-leds @@ -0,0 +1,40 @@ +#!/sbin/openrc-run +# Enable the joystick on Amescon's RasPiComm module + +gpio_up() { + if [ ! -e "/sys/class/gpio/gpio$1" ]; then + echo $1 > /sys/class/gpio/export + fi + echo $2 > "/sys/class/gpio/gpio$1/direction" + + chmod 664 "/sys/class/gpio/gpio$1/value" + chown root:gpio "/sys/class/gpio/gpio$1/value" + ln -s "/sys/class/gpio/gpio$1/value" "/dev/raspicomm/$3" +} + +gpio_down() { + if [ -e "/sys/class/gpio/gpio$1" ]; then + echo $1 > /sys/class/gpio/unexport + fi + + rm -f "/dev/raspicomm/$2" +} + +prepare_folder() { + mkdir -p "/dev/raspicomm" +} + +start() { + ebegin "Exporting RasPiComm's LEDs" + prepare_folder + gpio_up "18" "out" "led_1" + gpio_up "27" "out" "led_2" + eend $? +} + +stop() { + ebegin "Unexporting RasPiComm's LEDs" + gpio_down "18" "led_1" + gpio_down "27" "led_2" + eend $? +} diff --git a/testing/raspicomm-module/raspicomm-module.post-deinstall b/testing/raspicomm-module/raspicomm-module.post-deinstall new file mode 100755 index 0000000..578448c --- /dev/null +++ b/testing/raspicomm-module/raspicomm-module.post-deinstall @@ -0,0 +1,3 @@ +#!/bin/sh +echo "Deleting group \"gpio\"" +delgroup gpio diff --git a/testing/raspicomm-module/raspicomm-module.post-install b/testing/raspicomm-module/raspicomm-module.post-install new file mode 100755 index 0000000..8bb6441 --- /dev/null +++ b/testing/raspicomm-module/raspicomm-module.post-install @@ -0,0 +1,13 @@ +#!/bin/sh +echo "Running depmod" +depmod +echo "Creating group \"gpio\"" +addgroup gpio +echo "The follwing OpenRC Services were installed:" +echo " - \"raspicomm-rtc\": Sets up the real time clock" +echo " - \"raspicomm-joystick\": (Un-)Exports the joystick's GPIOs" +echo " - \"raspicomm-leds\": (Un-)Exports the LEDs GPIOs" +echo +echo "For convenience \"raspicomm-joystick\" and \"raspicomm-leds\" create" +echo "symlinks to corret GPIOs under \"/dev/raspicomm\". The GPIOs will be " +echo "readable and writable by users in group \"gpio\"." diff --git a/testing/raspicomm-module/raspicomm-module.post-upgrade b/testing/raspicomm-module/raspicomm-module.post-upgrade new file mode 100755 index 0000000..cf83677 --- /dev/null +++ b/testing/raspicomm-module/raspicomm-module.post-upgrade @@ -0,0 +1,3 @@ +#!/bin/sh +echo "Running depmod" +depmod diff --git a/testing/raspicomm-module/raspicomm-rtc b/testing/raspicomm-module/raspicomm-rtc new file mode 100755 index 0000000..741989a --- /dev/null +++ b/testing/raspicomm-module/raspicomm-rtc @@ -0,0 +1,8 @@ +#!/sbin/openrc-run +# Enable the real time clock on Amescon's RasPiComm module + +start() { + ebegin "Starting dropbear" + echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device + eend $? +} -- 2.3.7 --- Unsubscribe: alpine-aports+unsubscribe@lists.alpinelinux.org Help: alpine-aports+help@lists.alpinelinux.org ---