summarylogtreecommitdiffstats
path: root/hpoj-kernel26.patch
blob: 38b8d04646510bbc3940319828ec7473e6492fd2 (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
--- hpoj-0.91/scripts/ptal-init.in.kernel26	2004-03-03 17:30:47.000000000 +0000
+++ hpoj-0.91/scripts/ptal-init.in	2004-03-03 17:30:59.000000000 +0000
@@ -90,6 +90,11 @@
 my $varLock="/var/lock";
 my $varLockSubsys="$varLock/subsys";
 my $osPlatform=`uname -s 2>/dev/null`;
+chomp $osPlatform;
+my $linuxVersion=($osPlatform eq 'Linux' ? `uname -r 2>/dev/null` : '');
+$linuxVersion=~s/^(\s*)(\d+\.\d+)(\..*)$/$2/;
+chomp $linuxVersion;
+my $usbprintermodule = ($linuxVersion eq '2.6' ? "usblp" : "printer");
 my %devnames;
 my %obsoleteDevnames;
 my %configInfo;
@@ -1222,12 +1227,12 @@
 # undef -- skip USB probe
 # 0 -- do nothing, proceed with USB probe
 # >0 -- load printer.o
-# <0 -- disable and unload printer.o
+# <0 -- disable and unload printer.o/usblp.o
 sub linuxWhatShouldWeDoAboutUsbPrinterModule {
 	my $isSmp=&linuxIsSmp;
 	my $libusbSupported=&ptalMlcdSupportsLibusb;
 	my $usblpIsLoaded=&linuxUsblpIsLoaded;
-	my $printerIsLoaded=&linuxModuleIsLoaded("printer");
+	my $printerIsLoaded=&linuxModuleIsLoaded($usbprintermodule);
 
 	# non-SMP:
 	if (!$isSmp) {
@@ -1261,9 +1266,10 @@
 		}
 		goto allowInsmodPrinter;
 
-	# SMP, libusb support, some sort of printer.c functionality loaded:
+	# SMP, libusb support, some sort of printer.c/usblp.c
+	# functionality loaded:
 	} elsif ($usblpIsLoaded) {
-	    # printer.c compiled into the kernel:
+	    # printer.c/usblp.c compiled into the kernel:
 	    if (!$printerIsLoaded) {
 		if (!&askYN(
 "\n".
@@ -1280,7 +1286,7 @@
 			return undef;
 		}
 
-	    # printer.c compiled and loaded as a module:
+	    # printer.c/usblp.c compiled and loaded as a module:
 	    } else {
 promptDisableRmmodPrinter:
 		my $r=&askYN(
@@ -1301,8 +1307,9 @@
 		}
 	    }
 
-	# SMP, libusb support, printer.c enabled although not loaded:
-	} elsif (!&linuxModuleIsDisabled("printer")) {
+	# SMP, libusb support, printer.c/usblp.c enabled although not 
+	# loaded:
+	} elsif (!&linuxModuleIsDisabled($usbprintermodule)) {
 		goto promptDisableRmmodPrinter;
 	}
 
@@ -1326,11 +1333,11 @@
 			return 1;
 		}
 		if ($r<0) {
-			$r=&linuxDisableAndUnloadModule("printer",
+			$r=&linuxDisableAndUnloadModule($usbprintermodule,
 "to prevent possible system instability due to SMP+USB");
 		} else {
 linuxJustLoad:
-			$r=&linuxInsmod("printer",$quiet);
+			$r=&linuxInsmod($usbprintermodule,$quiet);
 		}
 		if (!$r && !$quiet &&
 		    &askYN("\n*** Continue with the USB probe anyway".$msg,0)) {
@@ -1601,7 +1608,7 @@
 
     } else {
 	my $parModulesLoaded=0;
-	# Don't "modprobe printer" on SMP Linux with libusb support:
+	# Don't "modprobe printer/usblp" on SMP Linux with libusb support:
 	my $usbModulesLoaded=
 		(&ptalMlcdSupportsLibusb &&
 		 $osPlatform=~/Linux/ && &linuxIsSmp);