summaryrefslogtreecommitdiffstats
path: root/abs/extra/sapphire/sapphire.patch
blob: 0305d918fd40e289acfd1fd31b99824bd521d35e (plain)
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
diff -ruaN sapphire-4.2.orig//Makefile sapphire-4.2/Makefile
--- sapphire-4.2.orig//Makefile	2012-05-06 02:51:36.000000000 +0000
+++ sapphire-4.2/Makefile	2012-05-14 02:12:57.000000000 +0000
@@ -5,7 +5,7 @@
 MODNAME=sapphire
 MODSOURCE=$(MODNAME).c
 CONFLICTS=hid_topseed
-BLACKLIST=/etc/modprobe.d/blacklist-$(CONFLICTS).conf
+BLACKLIST=$(DESTDIR)/etc/modprobe.d/blacklist-$(CONFLICTS).conf
 KEYMAP_SCRIPT=sapphire_keymap.sh
 EXTRACT_KEYDEFS=extract_keydefs.sh
 INPUT_H=/usr/include/linux/input.h
@@ -39,12 +39,12 @@
 
 modinstall: $(MODNAME).ko $(KEYMAP_SCRIPT)
 	$(MAKE) -C $(KDIR)/build M=`pwd` modules_install
-	depmod $(KVER)
-	@if [ "$(KVER)" = "$$(uname -r)" ]; then \
-		rmmod $(MODNAME)   2>/dev/null ;\
-		rmmod $(CONFLICTS) 2>/dev/null ;\
-		modprobe -v $(MODNAME) ;\
-	fi
+#	depmod $(KVER)
+#	@if [ "$(KVER)" = "$$(uname -r)" ]; then \
+#		rmmod $(MODNAME)   2>/dev/null ;\
+#		rmmod $(CONFLICTS) 2>/dev/null ;\
+#		modprobe -v $(MODNAME) ;\
+#	fi
 
 clean:
 	$(MAKE) -C $(KDIR)/build M=`pwd` clean
@@ -61,8 +61,8 @@
 	depmod
 
 install: $(MODNAME).ko clean_modparms modinstall $(BLACKLIST) $(KEYMAP_SCRIPT)
-	install -m 0755 $(KEYMAP_SCRIPT) /usr/local/bin/
-	[ -e /etc/sapphire.keymap ] && ./$(KEYMAP_SCRIPT) /etc/sapphire.keymap || exit 0
-	sync
+#	install -m 0755 $(KEYMAP_SCRIPT) /usr/local/bin/
+#	[ -e /etc/sapphire.keymap ] && ./$(KEYMAP_SCRIPT) /etc/sapphire.keymap || exit 0
+#	sync
 
 all: install
diff -ruaN sapphire-4.2.orig//Makefile~ sapphire-4.2/Makefile~
--- sapphire-4.2.orig//Makefile~	1970-01-01 00:00:00.000000000 +0000
+++ sapphire-4.2/Makefile~	2012-05-06 02:51:36.000000000 +0000
@@ -0,0 +1,68 @@
+#
+# Makefile and (un-)Installer for Sapphire remote control driver,
+#    by Mark Lord 2012.
+#
+MODNAME=sapphire
+MODSOURCE=$(MODNAME).c
+CONFLICTS=hid_topseed
+BLACKLIST=/etc/modprobe.d/blacklist-$(CONFLICTS).conf
+KEYMAP_SCRIPT=sapphire_keymap.sh
+EXTRACT_KEYDEFS=extract_keydefs.sh
+INPUT_H=/usr/include/linux/input.h
+
+## MODPARMS is not used any more, but we have to nuke old copies to prevent issues:
+MODPARMS=/etc/modprobe.d/$(MODNAME).conf
+
+KVER  ?= `uname -r`
+KDIR  = /lib/modules/$(KVER)
+obj-m += $(MODNAME).o
+
+#EXTRA_CFLAGS += -Werror
+
+default: kmod $(KEYMAP_SCRIPT)
+
+kmod:
+	$(MAKE) -C $(KDIR)/build M=`pwd` modules
+
+$(MODNAME).ko: $(MODSOURCE) $(MODNAME).h
+	$(MAKE) kmod
+
+$(KEYMAP_SCRIPT): $(EXTRACT_KEYDEFS) $(KEYMAP_SCRIPT).part1 $(KEYMAP_SCRIPT).part3 $(MODNAME).h $(INPUT_H)
+	chmod 0755 $(EXTRACT_KEYDEFS)
+	./$(EXTRACT_KEYDEFS) $(INPUT_H) $(MODNAME).h | cat $(KEYMAP_SCRIPT).part1 - $(KEYMAP_SCRIPT).part3 > $(KEYMAP_SCRIPT)
+	chmod 0755 $(KEYMAP_SCRIPT)
+
+$(BLACKLIST):
+	@echo "Creating $(BLACKLIST)"
+	@echo "## $(CONFLICTS) Conflicts with $(MODNAME) driver" >  $(BLACKLIST)
+	@echo "blacklist $(CONFLICTS)"                           >> $(BLACKLIST)
+
+modinstall: $(MODNAME).ko $(KEYMAP_SCRIPT)
+	$(MAKE) -C $(KDIR)/build M=`pwd` modules_install
+	depmod $(KVER)
+	@if [ "$(KVER)" = "$$(uname -r)" ]; then \
+		rmmod $(MODNAME)   2>/dev/null ;\
+		rmmod $(CONFLICTS) 2>/dev/null ;\
+		modprobe -v $(MODNAME) ;\
+	fi
+
+clean:
+	$(MAKE) -C $(KDIR)/build M=`pwd` clean
+	-rm -f $(KEYMAP_SCRIPT)
+
+clean_modparms:
+	@if [ -e $(MODPARAMS) ]; then rm -f $(MODPARMS) ; fi ; exit 0
+
+uninstall: clean clean_modparms
+	-rmmod $(MODNAME)
+	-rm -f $(BLACKLIST)
+	-rm -f /usr/local/bin/$(KEYMAP_SCRIPT)
+	-rm -f $(KDIR)/extra/$(MODNAME).ko
+	depmod
+
+install: $(MODNAME).ko clean_modparms modinstall $(BLACKLIST) $(KEYMAP_SCRIPT)
+	install -m 0755 $(KEYMAP_SCRIPT) /usr/local/bin/
+	[ -e /etc/sapphire.keymap ] && ./$(KEYMAP_SCRIPT) /etc/sapphire.keymap || exit 0
+	sync
+
+all: install