summaryrefslogtreecommitdiff
blob: f86f003c44e86b5a7ff500a11c44d7fd22f81db4 (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
--- scripts/ptal-init.in.orig	2004-02-26 03:29:54.319933782 +0100
+++ scripts/ptal-init.in	2004-02-26 03:30:47.143429439 +0100
@@ -86,6 +86,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;
@@ -1218,12 +1223,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) {
@@ -1257,9 +1262,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".
@@ -1276,7 +1282,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(
@@ -1297,8 +1303,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;
 	}
 
@@ -1322,11 +1329,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)) {
@@ -1597,7 +1604,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);