File: linux-2.6.18.patch

package info (click to toggle)
qc-usb 0.6.6-7
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 732 kB
  • ctags: 1,683
  • sloc: ansic: 10,149; sh: 726; makefile: 261
file content (127 lines) | stat: -rw-r--r-- 5,839 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
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 <linux/version.h>" ; 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 <linux/utsrelease.h>"; 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 <linux/quickcam.h>
 #endif
+#include <linux/version.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)) || (HAVE_UTSRELEASE_H == 1)
+#include <linux/utsrelease.h>
+#endif
 #include <linux/module.h>
 
 #include "qc-memory.h"
@@ -74,6 +78,14 @@
 #include <linux/moduleparam.h>
 #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 <linux/videodev.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
+#include <media/v4l2-common.h>
+#endif
 #include <linux/usb.h>
 #include <asm/pgtable.h>		/* This is required for testing pte_offset_map */
 #include <linux/spinlock.h>
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 <linux/version.h>"; 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 <linux/utsrelease.h>"; 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"