diff -ruw qc-usb-0.6.4.org/Makefile qc-usb-0.6.4/Makefile --- qc-usb-0.6.4.org/Makefile 2006-05-02 15:18:30.000000000 +0200 +++ qc-usb-0.6.4/Makefile 2006-10-23 23:29:15.000000000 +0200 @@ -41,7 +41,14 @@ MODULE_DIR := /lib/modules/$(shell uname -r) else # Note: the brackets on line below contain a space and a _tab_! -RELEASE := $(shell awk -F \" '/[ ]*\#[ ]*define[ ]*UTS_RELEASE[ ]*/ { print $$2 }' $(LINUX_DIR)/include/linux/version.h|tail -n 1) +#RELEASE := $(shell awk -F \" '/[ ]*\#[ ]*define[ ]*UTS_RELEASE[ ]*/ { print $$2 }' $(LINUX_DIR)/include/linux/version.h|tail -n 1) +# This seem to work better +#LINUX_DIR := /usr/src/linux +RELEASE := $(shell if test -r $(LINUX_DIR)/include/linux/version.h && fgrep -q UTS_RELEASE $(LINUX_DIR)/include/linux/version.h; then \ + ((echo "\#include " ; echo "kernsrcver=UTS_RELEASE") | cpp -I $(LINUX_DIR)/include | grep "^kernsrcver=" | cut -d \" -f 2); \ + elif test -r $(LINUX_DIR)/include/linux/utsrelease.h && fgrep -q UTS_RELEASE $(LINUX_DIR)/include/linux/utsrelease.h; then \ + ((echo "\#include "; echo "kernsrcver=UTS_RELEASE") | cpp -I $(LINUX_DIR)/include | grep "^kernsrcver=" | cut -d \" -f 2); \ + fi) MODULE_DIR := /lib/modules/$(RELEASE) endif endif @@ -51,8 +58,16 @@ LINUX_DIR := $(MODULE_DIR)/build endif +HAVE_UTSRELEASE_H := $(shell if test -r $(LINUX_DIR)/include/linux/version.h && fgrep -q UTS_RELEASE $(LINUX_DIR)/include/linux/version.h; then \ + echo 0; \ + elif test -r $(LINUX_DIR)/include/linux/utsrelease.h && fgrep -q UTS_RELEASE $(LINUX_DIR)/include/linux/utsrelease.h; then \ + echo 1; \ + fi) + ifndef USER_OPT -USER_OPT := +USER_OPT := -DHAVE_UTSRELEASE_H=$(HAVE_UTSRELEASE_H) +else +USER_OPT := $(USER_OPT) -DHAVE_UTSRELEASE_H=$(HAVE_UTSRELEASE_H) endif ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/) diff -ruw qc-usb-0.6.4.org/qc-driver.c qc-usb-0.6.4/qc-driver.c --- qc-usb-0.6.4.org/qc-driver.c 2006-05-06 04:51:50.000000000 +0200 +++ qc-usb-0.6.4/qc-driver.c 2006-10-23 23:37:22.000000000 +0200 @@ -48,6 +48,10 @@ #else #include #endif +#include +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)) || (HAVE_UTSRELEASE_H == 1) +#include +#endif #include #include "qc-memory.h" @@ -74,6 +78,14 @@ #include #endif /* }}} */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) +/* Make this a bit backwards compatible... hack hack... */ +#ifndef module_param +#define module_param(a, b, c) MODULE_PARM(a, "i") +#endif +#endif + /* {{{ [fold] Module parameters */ MODULE_PARM_DESC(qcdebug, "Sets the debug output (bitfield)"); int qcdebug = DEBUGLEVEL; diff -ruw qc-usb-0.6.4.org/quickcam.h qc-usb-0.6.4/quickcam.h --- qc-usb-0.6.4.org/quickcam.h 2006-05-06 05:00:26.000000000 +0200 +++ qc-usb-0.6.4/quickcam.h 2006-10-23 23:29:15.000000000 +0200 @@ -93,6 +93,9 @@ #endif #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) +#include +#endif #include #include /* This is required for testing pte_offset_map */ #include diff -ruw qc-usb-0.6.4.org/quickcam.sh qc-usb-0.6.4/quickcam.sh --- qc-usb-0.6.4.org/quickcam.sh 2004-07-28 12:15:37.000000000 +0200 +++ qc-usb-0.6.4/quickcam.sh 2006-10-23 23:29:15.000000000 +0200 @@ -434,12 +434,33 @@ fi fi +HAVE_UTSRELEASE_H=0 +UTS_FILE="" +if test -r $KERNEL_SOURCE/include/linux/version.h && fgrep -q UTS_RELEASE $KERNEL_SOURCE/include/linux/version.h; then + kernsrcver=`(echo "#include "; echo "kernsrcver=UTS_RELEASE") | cpp -I $KERNEL_SOURCE/include | grep "^kernsrcver=" | cut -d \" -f 2` + UTS_FILE=$KERNEL_SOURCE/include/linux/version.h +elif test -r $KERNEL_SOURCE/include/linux/utsrelease.h && fgrep -q UTS_RELEASE $KERNEL_SOURCE/include/linux/utsrelease.h; then + kernsrcver=`(echo "#include "; echo "kernsrcver=UTS_RELEASE") | cpp -I $KERNEL_SOURCE/include | grep "^kernsrcver=" | cut -d \" -f 2` + HAVE_UTSRELEASE_H=1 + UTS_FILE=$KERNEL_SOURCE/include/linux/utsrelease.h +fi +if test -z "$kernsrcver"; then + echo "Couldn't find KERNEL_UTS version" + exit 1 +fi +# export USER_OPT="$USER_OPT -DHAVE_UTSRELEASE_H=$HAVE_UTSRELEASE_H" + KERNEL_VERSION="`make | grep 'Kernel version code' | tail -n 1 | awk -F : '{print $2}' | awk '{print $1}'`" -KERNEL_UTS=`awk -F \" '/[ ]*\#[ ]*define[ ]*UTS_RELEASE[ ]*/ { print $2 }' "$KERNEL_SOURCE/include/linux/version.h"|tail -n 1` +#KERNEL_UTS=`awk -F \" '/[ ]*\#[ ]*define[ ]*UTS_RELEASE[ ]*/ { print $2 }' "$KERNEL_SOURCE/include/linux/version.h"|tail -n 1` +#KERNEL_UTS="`make | grep 'Kernel version' | tail -n 1 | awk -F : '{print $2}' | awk '{print $1}'`" +KERNEL_UTS=$kernsrcver MODULE_NAME="`make | grep 'Driver file name' | tail -n 1 | awk -F : '{print $2}' | awk '{print $1}'`" INSTALL_DIR="`make | grep 'Module install directory' | tail -n 1 | awk -F : '{print $2}' | awk '{print $1}'`" export MODULE_NAME -UTS_COUNT=`grep UTS_RELEASE < "$KERNEL_SOURCE/include/linux/version.h" | wc -l` + +#UTS_COUNT=`grep UTS_RELEASE < "$KERNEL_SOURCE/include/linux/version.h" | wc -l` +UTS_COUNT=`grep UTS_RELEASE < "$UTS_FILE" | wc -l` + if [ $? != 0 ]; then UTS_COUNT=0; fi if [ $UTS_COUNT -ne 1 ]; then echo "[!] Multiple kernel versions specified in linux/version.h" @@ -696,7 +717,7 @@ ls -la "$VIDEODEV_REAL" echo "$VIDEODEV is a symbolic link to $VIDEODEV_REAL." fi -if [ ! -r $VIDEODEV_REAL -o ! -w $VIDEODEV_REAL ]; then +if [ ! -r "$VIDEODEV_REAL" -o ! -w "$VIDEODEV_REAL" ]; then echo "[!] You don't have read/write access to $VIDEODEV." echo "On many distributions, you should add yourself into the" echo "\"video\" group by giving command"