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 31D36DC03BB for ; Thu, 7 May 2015 07:31:28 +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 8AEF7DC0099 for ; Thu, 7 May 2015 07:31:21 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2B/HgATFEtV/43AsIBcgwxUXgGzWQ8BAQEBAQEFAT9DkRACAV5Uhy5MAQEBAQEBgQuFb4ECiCwECaFrozGGF45bBYsnixWHaD2DGYJUhGOCSYc/I2FmAQsBEoISbYJFAQEB X-IPAS-Result: A2B/HgATFEtV/43AsIBcgwxUXgGzWQ8BAQEBAQEFAT9DkRACAV5Uhy5MAQEBAQEBgQuFb4ECiCwECaFrozGGF45bBYsnixWHaD2DGYJUhGOCSYc/I2FmAQsBEoISbYJFAQEB X-IronPort-AV: E=Sophos;i="5.13,383,1427752800"; d="scan'208";a="76485135" Received: from secmail.uni-muenster.de ([128.176.192.141]) by zivm-relay2.uni-muenster.de with ESMTP; 07 May 2015 09:31:21 +0200 Received: from pibplus.fritz.box (dslb-188-109-058-067.188.109.pools.vodafone-ip.de [188.109.58.67]) by SECMAIL.UNI-MUENSTER.DE (Postfix) with ESMTP id 72681BF403 for ; Thu, 7 May 2015 09:31:19 +0200 (CEST) From: Marian Buschsieweke To: alpine-aports@lists.alpinelinux.org Subject: [alpine-aports] [PATCH] testing/raspicom-module: new aport Date: Thu, 7 May 2015 09:31:11 +0200 Message-Id: <1430983871-915-1-git-send-email-mari.hahn@wwu.de> X-Mailer: git-send-email 2.4.0 X-Virus-Scanned: ClamAV using ClamSMTP X-Mailinglist: alpine-aports Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: http://www.amescon.com/products/raspicomm/ Kernel module for RS-485 Port and OpenRC services to set up RTC, Joystick and LEDs of Amescon's RasPiComm module *fixed Patch --- testing/raspicomm-module/APKBUILD | 83 ++++++++++++++++++++++ testing/raspicomm-module/raspicomm-joystick | 46 ++++++++++++ testing/raspicomm-module/raspicomm-leds | 40 +++++++++++ testing/raspicomm-module/raspicomm-module.8 | 45 ++++++++++++ .../raspicomm-module/raspicomm-module.pre-install | 2 + testing/raspicomm-module/raspicomm-rtc | 14 ++++ 6 files changed, 230 insertions(+) create mode 100644 testing/raspicomm-module/APKBUILD create mode 100644 testing/raspicomm-module/raspicomm-joystick create mode 100644 testing/raspicomm-module/raspicomm-leds create mode 100644 testing/raspicomm-module/raspicomm-module.8 create mode 100644 testing/raspicomm-module/raspicomm-module.pre-install create mode 100644 testing/raspicomm-module/raspicomm-rtc diff --git a/testing/raspicomm-module/APKBUILD b/testing/raspicomm-module/APKBUILD new file mode 100644 index 0000000..bf3dd99 --- /dev/null +++ b/testing/raspicomm-module/APKBUILD @@ -0,0 +1,83 @@ +# Contributor: Marian Buschsieweke + +_flavor=rpi +_kpkg=linux-$_flavor +_kver=3.18.12 +_kpkgrel=0 +_mypkgrel=0 +_realname=raspicomm-module + +# verify the kernel version before entering chroot +if [ -f ../../main/linux-${_flavor}/APKBUILD ]; then + . ../../main/linux-${_flavor}/APKBUILD + [ "$_kver" != "$pkgver" ] && die "${_realname}: please update _kver to $pkgver" + [ "$_kpkgrel" != "$pkgrel" ] && die "${_realname}: please update _kpkgrel to $pkgrel" +fi + +_kpkgver="$_kver-r$_kpkgrel" +_abi_release=${_kver}-${_kpkgrel}-${_flavor} + +pkgname=${_realname} # This package is only useful on the Raspberry Pi, so no need to tag pkgname with kernel flavor +pkgver=$_kver +# when chaning _raspicommver we *must* bump _mypkgrel +_raspicommver=1.12 +pkgrel=$(( $_kpkgrel + $_mypkgrel )) + +pkgdesc="Kernel module for RS-485 Port and OpenRC services to set up RTC, Joystick and LEDs of Amescon's RasPiComm module" +url="http://www.amescon.com/products/raspicomm/" +arch="all" +license="GPL2" # See module.h line 7 +depends="linux-${_flavor}=${_kpkgver}" +depends_dev="linux-${_flavor}-dev=${_kpkgver}" +makedepends="$depends_dev" +install="${pkgname}.pre-install" +subpackages="$pkgname-doc" +source="saveas-http://github.com/amescon/${_realname}/archive/v${_raspicommver}.tar.gz/raspicomm-module-v${_raspicommver}.tar.gz + raspicomm-rtc + raspicomm-joystick + raspicomm-leds + ${pkgname}.8" +pkggroups="gpio" + +_builddir="${srcdir}/${_realname}-${_raspicommver}" +_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" + export GCC_SPECS=hardenednopie.specs + make -f Makefile_rpi +} + +package() { + cd "$_builddir" + install -Dm644 ${_module_name}.ko "${pkgdir}/lib/modules/${_abi_release}/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" + install -Dm644 "../${pkgname}.8" "${pkgdir}/usr/share/man/man8/${pkgname}.8" +} +md5sums="8d42142190e5e2794e74a244322bf8b2 raspicomm-module-v1.12.tar.gz +31897ade3059f4835711f5e7239977bf raspicomm-rtc +6bb85ad9e849f5774688be96166dd1d4 raspicomm-joystick +afcda01e94f534e807255ffd2806782b raspicomm-leds +4d4dc6caa33c81f8a0fb5ce94bf8b814 raspicomm-module.8" +sha256sums="b55de7e3a0304a6868a5bed6f15cea0f62cb99bc2f07474b563d413ea5787ebb raspicomm-module-v1.12.tar.gz +964e7a9c459cfcb6f46c92e8a20bd35409b271d680f62734342803df94a61557 raspicomm-rtc +c1c78ee6e759fb64c190a6227607e997f8f5889af4507c70046de2805cc2f7e9 raspicomm-joystick +9c9226439e7ca3ae3a7f144488df56e13de07537ca4b0473807d5919f377d2e7 raspicomm-leds +e722858a4d440192bf20d5665a18299f94d1f95f909fc10639d98a846ad4e81f raspicomm-module.8" +sha512sums="d088d62536690b9abfcdf73b2ff2fb45a8fdbfa03a50108bafa66fde07cea221cb882f999cb88e28f8c51538b515dbd13ae33f435267018d6458a2dca5fc38fa raspicomm-module-v1.12.tar.gz +445759da30783a1aeb32f88b0fc3241417028fbd2b2ff510817bdbff49be653839f8d7cb460805999e1c943dea7b66ad1dfe37c43f47cf5736690ed5e239b467 raspicomm-rtc +5d76fd8121574993ef6710a80d54ce2dcd8a7a55609c00f3394322f90ac58b72f311ee0b02251679758ac7f6bd9ac9db226676dc55bafc3857df6f64550d409d raspicomm-joystick +12c791a27f38db94bc7e2222d5a517d79f6ee495122d50c3687e94a29dc0126291fb0f17327b704d0be4549e2b85b5d5ac9be1f7cb3e96e5e497c7ac91f40a41 raspicomm-leds +25ae7b0356f866c3e74b4f447f5121c868bfaa154266752d29658ef3640866037fa08607833364c463566b46e61281e02212dc02f70779fc00561d81b30e37f6 raspicomm-module.8" diff --git a/testing/raspicomm-module/raspicomm-joystick b/testing/raspicomm-module/raspicomm-joystick new file mode 100644 index 0000000..f7d342c --- /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 joystick" + 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 100644 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.8 b/testing/raspicomm-module/raspicomm-module.8 new file mode 100644 index 0000000..d1fe242 --- /dev/null +++ b/testing/raspicomm-module/raspicomm-module.8 @@ -0,0 +1,45 @@ +.TH "raspicomm-module" "8" "May 06, 2015" +.SH +NAME +.PP +raspicomm\-module \- A alpine package containing a kernel module and OpenRC +services to access Ameson's RasPiComm module +.SH +DESCRIPTION +.PP +With this packet all features of the RaspiComm Module are available. +.SS +RS\-232 port +.PP +The RS\-232 port is supported out of the box by Alpine Linux's kernel. The +device is found at \f[C]/dev/ttyAMA0\f[]\&. +.SS +i2c connector +.PP +The i2c connector is supported out of the box \- it just connects a fancy plug +to the Raspberry Pis i2c pins. +.SS +RS\-485 port +.PP +The RS\-485 port is supported by the kernel module \f[C]raspicommrs485\f[] included +in this package. The device is found at \f[C]/dev/ttyRPC0\f[]\&. +.SS +Real time clock +.PP +The real time clock can be set up with the OpenRC service \f[C]raspicomm\-rtc\f[]\&. You +can "unexport" the clock by stopping the service. +.SS +Joystick +.PP +The joysticks GPIO pins can be set up with the OpenRC service +\f[C]raspicomm\-joystick\f[]\&. For convenience the GPIOs can be accessed by users in +the group \f[C]gpio\f[] and symlinks to the GPIO's value will be stored at +\f[C]/dev/raspicomm\f[] with human readable names. By stopping the service the GPIOs +will be unexported. +.SS +LEDs +.PP +The LEDs GPIO pins can be set up with the OpenRC service \f[C]raspicomm\-leds\f[]\&. For +convenience the GPIOs can be accessed by users in the group \f[C]gpio\f[] and symlinks +to the GPIO's value will be stored at \f[C]/dev/raspicomm\f[] with human readable +names. By stopping the service the GPIOs will be unexported. diff --git a/testing/raspicomm-module/raspicomm-module.pre-install b/testing/raspicomm-module/raspicomm-module.pre-install new file mode 100644 index 0000000..5f42b5b --- /dev/null +++ b/testing/raspicomm-module/raspicomm-module.pre-install @@ -0,0 +1,2 @@ +#!/bin/sh +adduser -S gpio 2>/dev/null diff --git a/testing/raspicomm-module/raspicomm-rtc b/testing/raspicomm-module/raspicomm-rtc new file mode 100644 index 0000000..fbcf45c --- /dev/null +++ b/testing/raspicomm-module/raspicomm-rtc @@ -0,0 +1,14 @@ +#!/sbin/openrc-run +# Enable the real time clock on Amescon's RasPiComm module + +start() { + ebegin "Setting up RaspiComm's real time clock" + echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device + eend $? +} + +stop() { + ebegin "Disabling RaspiComm's real time clock" + echo 0x68 > /sys/class/i2c-adapter/i2c-1/delete_device + eend $? +} -- 2.4.0 --- Unsubscribe: alpine-aports+unsubscribe@lists.alpinelinux.org Help: alpine-aports+help@lists.alpinelinux.org ---