From eb7cd0a2fbb41dff9476d0ce8b2a36783c2930b0 Mon Sep 17 00:00:00 2001 From: Roberto Neri Date: Fri, 9 Sep 2011 16:24:27 -0400 Subject: [PATCH] system/avermedia-a867: Added (AVerMedia A867 DVB-T kernel module) Signed-off-by: dsomero --- system/avermedia-a867/2.6.39.patch | 97 +++++++++++++++++++ system/avermedia-a867/Makefile.diff | 20 ++++ system/avermedia-a867/README | 7 ++ system/avermedia-a867/af903x-drv.c.patch | 34 +++++++ .../avermedia-a867/avermedia-a867.SlackBuild | 69 +++++++++++++ system/avermedia-a867/avermedia-a867.info | 10 ++ system/avermedia-a867/doinst.sh | 4 + system/avermedia-a867/slack-desc | 19 ++++ 8 files changed, 260 insertions(+) create mode 100644 system/avermedia-a867/2.6.39.patch create mode 100644 system/avermedia-a867/Makefile.diff create mode 100644 system/avermedia-a867/README create mode 100644 system/avermedia-a867/af903x-drv.c.patch create mode 100644 system/avermedia-a867/avermedia-a867.SlackBuild create mode 100644 system/avermedia-a867/avermedia-a867.info create mode 100644 system/avermedia-a867/doinst.sh create mode 100644 system/avermedia-a867/slack-desc diff --git a/system/avermedia-a867/2.6.39.patch b/system/avermedia-a867/2.6.39.patch new file mode 100644 index 0000000000..2f8860313c --- /dev/null +++ b/system/avermedia-a867/2.6.39.patch @@ -0,0 +1,97 @@ +From 01dbc609534dc68b8890267b95c8a1efcd17437d Mon Sep 17 00:00:00 2001 +From: FLN +Date: Mon, 23 May 2011 01:02:20 +0200 +Subject: [PATCH] use mutex instead of BKL if kernel version is greater than + 2.6.38 + +the BKL got removed with kernel version 2.6.39 +and therefore we have to use a proper locking mechanism +--- + af903x-fe.c | 12 +++++++++--- + af903x.h | 6 +++++- + usb2impl.c | 1 - + 3 files changed, 14 insertions(+), 5 deletions(-) + +diff --git a/af903x-fe.c b/af903x-fe.c +index 6f36a68..a1d1077 100644 +--- a/af903x-fe.c ++++ b/af903x-fe.c +@@ -1,5 +1,4 @@ + #include +-#include + #include + #include + #include +@@ -11,7 +10,7 @@ + #define A333_FREQ_MIN 44250000 + #define A333_FREQ_MAX 867250000 + +- ++DEFINE_MUTEX(mutex); + + static int alwayslock; // default to 0 + module_param(alwayslock, int, 0644); +@@ -678,7 +677,11 @@ static int af903x_monitor_thread_func(void *data) + deb_data("- Enter %s Function -\n",__FUNCTION__); + if( !state ) return -1; + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39) + lock_kernel(); ++#else ++ mutex_lock(&mutex); ++#endif + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,61) + daemonize(); + sigfillset(¤t->blocked); +@@ -689,8 +692,11 @@ static int af903x_monitor_thread_func(void *data) + #endif + siginitsetinv(¤t->blocked, sigmask(SIGKILL)|sigmask(SIGINT)|\ + sigmask(SIGTERM)); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39) + unlock_kernel(); +- ++#else ++ mutex_unlock(&mutex); ++#endif + while(!state->thread_should_stop && !signal_pending(current)) { + + DWORD dwError; +diff --git a/af903x.h b/af903x.h +index 203ff51..b2b35e3 100644 +--- a/af903x.h ++++ b/af903x.h +@@ -9,7 +9,12 @@ + #include + #include + #include ++#include ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39) + #include ++#else ++#include ++#endif + #include + #include + #include +@@ -19,7 +24,6 @@ + #include "firmware.h" + #include "type.h" + #include "Common.h" +-#include + #include "debug.h" + + #define ENABLE_TEST_FUNCTION 0 +diff --git a/usb2impl.c b/usb2impl.c +index a3a30f9..3cf8b64 100644 +--- a/usb2impl.c ++++ b/usb2impl.c +@@ -10,7 +10,6 @@ + #include + #include + #include +-#include + #include + #include + #include +-- +1.7.5.2 diff --git a/system/avermedia-a867/Makefile.diff b/system/avermedia-a867/Makefile.diff new file mode 100644 index 0000000000..833fbe38b4 --- /dev/null +++ b/system/avermedia-a867/Makefile.diff @@ -0,0 +1,20 @@ +--- Makefile.orig 2010-11-10 04:46:22.000000000 +0100 ++++ Makefile 2011-08-29 11:15:04.979000013 +0200 +@@ -26,7 +26,7 @@ + #DEST = $(DESTDIR)/lib/modules/$(CURRENT)/kernel/$(MDIR) + #KFIRMWARM = $(DESTDIR)/lib/firmware/ + INSTALL := $(shell which install) +-DEPMOD := $(shell which depmod || which /sbin/depmod || echo "true You should now run depmod") ++#DEPMOD := $(shell which depmod || which /sbin/depmod || echo "true You should now run depmod") + + # SYSTEM DVB setting + DVB_FLAGS += -I$(KSRC)/drivers/media/dvb/dvb-core/ +@@ -55,7 +55,7 @@ + install: + @install -d $(DESTDIR)/lib/modules/$(CURRENT)/kernel/drivers/media/dvb/a867 + $(INSTALL) -c -D -m 644 -c a867.ko $(DESTDIR)/lib/modules/$(CURRENT)/kernel/drivers/media/dvb/a867/ +- /sbin/depmod -a ++# /sbin/depmod -a + + remove: + diff --git a/system/avermedia-a867/README b/system/avermedia-a867/README new file mode 100644 index 0000000000..43662f4f83 --- /dev/null +++ b/system/avermedia-a867/README @@ -0,0 +1,7 @@ +This is the kernel module for the AVerMedia AVerTV A867 DVB-T Receiver +USB device + +If you wish to build the package for a kernel different from the running +one, pass its release no. to the script in the KERNEL variable, e.g. +KERNEL=2.6.38.8 ./avermedia-a867.SlackBuild + diff --git a/system/avermedia-a867/af903x-drv.c.patch b/system/avermedia-a867/af903x-drv.c.patch new file mode 100644 index 0000000000..d8ec9301c3 --- /dev/null +++ b/system/avermedia-a867/af903x-drv.c.patch @@ -0,0 +1,34 @@ +--- af903x-drv.c.orig 2011-01-23 23:04:35.113333652 +0100 ++++ af903x-drv.c 2011-01-23 22:47:28.676666674 +0100 +@@ -1103,8 +1103,11 @@ + PDC->StreamType = StreamType_DVBT_DATAGRAM; + PDC->UsbCtrlTimeOut = 1; + +- init_MUTEX(&PDC->powerLock); +- init_MUTEX(&PDC->tunerLock); ++ //init_MUTEX(&PDC->powerLock); ++ //init_MUTEX(&PDC->tunerLock); ++ sema_init(&PDC->powerLock, 1); ++ sema_init(&PDC->tunerLock, 1); ++ + PDC->power_use_count = 0; + + PDC->idVendor = udev->descriptor.idVendor; +@@ -1116,7 +1119,8 @@ + PDC->fc[0].AVerFlags = 0x00; + PDC->fc[1].AVerFlags = 0x00; + +- init_MUTEX(&PDC->regLock); ++ //init_MUTEX(&PDC->regLock); ++ sema_init(&PDC->regLock, 1); + } + else { + PDC->UsbCtrlTimeOut = 5; +@@ -1208,5 +1212,4 @@ + + return (error); + } +-//EXPORT_SYMBOL(Device_init); +- ++//EXPORT_SYMBOL(Device_init); +\ Manca newline alla fine del file diff --git a/system/avermedia-a867/avermedia-a867.SlackBuild b/system/avermedia-a867/avermedia-a867.SlackBuild new file mode 100644 index 0000000000..dad6bbfb18 --- /dev/null +++ b/system/avermedia-a867/avermedia-a867.SlackBuild @@ -0,0 +1,69 @@ +#!/bin/sh + +# Slackware build script for avermedia-a867 + +# Written by Roberto Neri + +PRGNAM=avermedia-a867 +VERSION=${VERSION:-1.0.28} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +KERNEL=${KERNEL:-$(uname -r)} +KOBJ=${KOBJ:-/lib/modules/$KERNEL/build} +KSRC=${KSRC:-/lib/modules/$KERNEL/source} +PKGVERSION=${VERSION}_$(echo $KERNEL | tr - _) + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i486 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf a867_drv_v$VERSION +tar xvf $CWD/a867_drv_v$VERSION.tar.bz2 +cd a867_drv_v$VERSION + +# Do not run depmod after installation +patch -p0 < $CWD/Makefile.diff + +# Patches retrieved from http://aur.archlinux.org/packages.php?ID=45704 +# They resolve compilation issues with recent kernels +patch -p1 < $CWD/2.6.39.patch +patch -p0 < $CWD/af903x-drv.c.patch + +chown -R root:root . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \; + +# It is necessary to pass both KOBJ and KSRC +# to avoid incorrect assumptions and errors +make KOBJ=$KOBJ KSRC=$KSRC +make KOBJ=$KOBJ KSRC=$KSRC DESTDIR=$PKG install + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a LICENSE Releasenotes.txt \ + $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +sed "s%@KERNEL@%$KERNEL%" $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$PKGVERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/system/avermedia-a867/avermedia-a867.info b/system/avermedia-a867/avermedia-a867.info new file mode 100644 index 0000000000..bbc276f749 --- /dev/null +++ b/system/avermedia-a867/avermedia-a867.info @@ -0,0 +1,10 @@ +PRGNAM="avermedia-a867" +VERSION="1.0.28" +HOMEPAGE="http://www.avermedia.com/" +DOWNLOAD="http://www.avermedia.com/avertv/Upload/Download/a867_drv_v1.0.28.tar.bz2" +MD5SUM="532053387fd840def6bc384c543c024d" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +MAINTAINER="Roberto Neri" +EMAIL="rneri@libero.it" +APPROVED="dsomero" diff --git a/system/avermedia-a867/doinst.sh b/system/avermedia-a867/doinst.sh new file mode 100644 index 0000000000..92839e4b39 --- /dev/null +++ b/system/avermedia-a867/doinst.sh @@ -0,0 +1,4 @@ +if [ -x sbin/depmod ]; then + /sbin/depmod -a @KERNEL@ 1> /dev/null 2> /dev/null +fi + diff --git a/system/avermedia-a867/slack-desc b/system/avermedia-a867/slack-desc new file mode 100644 index 0000000000..71eda27610 --- /dev/null +++ b/system/avermedia-a867/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +avermedia-a867: avermedia-a867 (AVerMedia A867 DVB-T Receiver kernel module) +avermedia-a867: +avermedia-a867: Kernel module for the AVerMedia AVerTV A867 DVB-T Receiver USB device +avermedia-a867: +avermedia-a867: Homepage: http://www.avermedia.com/ +avermedia-a867: +avermedia-a867: +avermedia-a867: +avermedia-a867: +avermedia-a867: +avermedia-a867: