Bei SuSE 7.3 ist leider die Möglichkeit, KernelModule im laufenden System zu laden, nicht ausgereizt worden und die Methode, die in der SDB aufgeführt ist, funktionierte bei mir nicht. Deshalb habe ich hier ein Skript erstellt, das interaktiv z.B. das Scannermodul für einen AGFA SNAPScan 310 einbindet, so dass nur noch zum Entladen der Module ein Root-Passwort notwendig ist.

aha152x automatisch einbinden:


Sichere Methode

  • Einfach in /etc/modules.conf eintragen:

 # AGFA SNAPscan 310:
 below sg aha152x isa-pnp

Das sorgt dafür, dass beim Einbinden des sg-Moduls, das automatisch von Xsane oder Kooka geladen wird, die Module aha152x und isa-pnp mit geladen werden.

man modules.conf:

  • [add] below module module_list This directive makes it possible for one module to "push" another set of modules below itself in a module stack, as seen in the output of the lsmod (8) command. The below directive is useful for those circumstances when the dependencies are more complex than what can be described in the modules.dep dependency file. This is an optimized case of the pre-install and post-remove directives. Note that failure of installing the module will not influence the exit status of modprobe. The optional add prefix adds the new list to the previous list instead of replacing it.


Weniger sichere Methode

  • Eine andere Möglichkeit ist in die Datei /etc/sudoers folgende Zeilen anzuhängen, so kann bei einem evtl. Problem das scsi-Modul immer geladen werden. Vorausgesetzt es lässt sich auch "von Hand" laden:

 %users ALL=NOPASSWD:/sbin/modprobe
 %users ALL=NOPASSWD:/sbin/rmmod

Dann sind alle lokalen Benutzer berechtigt mit sudo module zu laden und auch wieder zu entfernen! Das Skript muss dafür noch angepasst werden, indem die #--> Kommentare entfernt werden und vor die Zeilen die am Ende #<-- tragen auskommentiert werden, dafür entfällt das Ändern von /etc/modules.conf.

Skript für Scanner-Icon

Um bequem heraus zu finden, ob die evtl. eingerichtete ide-scsi-Emulation das sg-Modul schon geladen hat, obwohl der Scanner aus war, und somit nicht funktioniert, ruft man das Scanprogramm am Besten mit einem Skript (SCANNER) auf, das einen symbolischen Link zu SCANNER-remove hat:

 #! /bin/sh

 # Konfiguration:
 # nach manuellem Einbinden:
 #
 # #cat /proc/scsi/scsi:
 # Host: scsi2 Channel: 00 Id: 01 Lun: 00
 # Vendor: AGFA Model: SNAPSCAN 310 Rev: 1.20
 # Type: Scanner ^^^^^^^^ ANSI SCSI revision: 02
 #
 # Dieser Eintrag sollte irgend ein eindeutiges Wort aus 
 # cat /proc/scsi/scsi enthalten, dass auf den Scanner bezogen ist:
 MODEL=SNAPSCAN
 # scsi-Kartenmodul:
 SMOD=aha152x
 # Scan-Programm:
 PROGI=/usr/X11R6/bin/xsane
 # wird an SCANNER kooka angefügt startet Kooka:
 [ 1ドル = kooka ] && PROGI=/opt/kde3/bin/kooka

 # Unter welchem Namen wurde das Skript aufgerufen?
 SKRIPTNAME=$(echo 0ドル | sed "s/^.*\/\([^\\]*\)/1円/")
 
 #--> LOAD="sudo /sbin/modprobe $SMOD"
 #--> UNLOAD="sudo /sbin/rmmod $SMOD"

 ## SCANNER ##
 # ==== #

 if [ $SKRIPTNAME = SCANNER ] ; then

 # Ist der Scaner schon RICHTIG eingebunden?
 grep "$MODEL" /proc/scsi/scsi > /dev/null 2>&1
 agfa=$?
 /sbin/lsmod | grep $SMOD > /dev/null 2>&1
 AHA=$?

 # Wenn nein, dann sg-Modul und scsi-Kartenmodul mit dem symbolischen Link,
 # SCANNER-remove, auf dieses Skript entfernen und noch einmal starten.
 if [ $agfa = 1 -a $AHA = 0 ] ; then
 SCANNER-remove
 SCANNER

 # Wenn ja, dann nachfragen, ob er an ist, damit die automatische Einbindung
 # auch funktioniert (wichtig für Vergessliche wie mich).
 elif [ $agfa = 1 -a $AHA != 0 ] ; then
 kdialog --yesno 'Ist der Scanner an?' 8 25
 ans=$?
 if [ $ans != 0 ] ; then
 exit

 elif [ $ans = 0 ] ; then
 #--> $LOAD
 #--> sleep 2
 $PROGI &
 fi

 # Wenn er schon korrekt funktioniert - Scanprogi starten:
 elif [ $agfa = 0 ] ; then
 #--> $LOAD
 #--> sleep 2
 $PROGI &
 exit 0
 fi
 fi

 ## SCANNER-remove ##
 # =========== #

 if [ $SKRIPTNAME = SCANNER-remove ] ; then

 # Ist das Scaner-Modul wirklich geladen?
 /sbin/lsmod | grep $SMOD > /dev/null 2>&1
 agfa=$? # 0 = JA; 1 = NEIN
 # Ist das sg-Modul geladen?
 SG=$(/sbin/lsmod | grep -wc "^sg") # Größer 0 = JA; kleiner 0 = NEIN

 # Für nicht geladenes Skanner-Modul und geladenes sg-Modul:
 if [ $agfa != 0 ] ; then
 if [ $SG != 0 ] ; then
 #--> $UNLOAD
 kdesu --caption "sg-Modul entladen?" -n -c '/sbin/rmmod sg' #<--
 fi
 kdialog --msgbox "Scanner-Modul ist entladen" 8 25
 exit 0
 # Für geladenes Skanner-Modul und geladenes sg-Modul:
 elif [ $agfa = 0 ] ; then
 kdesu --caption "Scanner-Modul entladen?"\ #<--
 -n -c "/sbin/rmmod sg $SMOD" # Optional isa-pnp auch entladen. #<--
 #--> $UNLOAD
 # Erfolgs Kontrolle:
 /sbin/lsmod | grep $SMOD > /dev/null 2>&1
 arg=$? # 1 = Erfolg; 0 = Nix entladen
 if [ $arg = 1 ] ; then
 kdialog --msgbox "Der SCANNER ist nicht mehr eingebunden" 6 60
 elif [ $arg = 0 ] ; then
 kdialog --textbox '/proc/scsi/scsi' 65 15
 fi
 fi
 fi

Der Skriptteil zum Entladen der Module kann auch wichtig werden, wenn das CD-Brennen nicht mehr funktioniert, nachdem man ein Bild eingescannt hat.

Beschreibungsdatei des KDE-Desktop-Icons

Wenn man jetzt noch in KDE ein Desktop-Icon Xsane.desktop mit diesem Inhalt erstellt:

 [Desktop Action empty]
 Exec=
 Name=

 [Desktop Action rmscan]
 Exec=SCANNER-remove
 Icon=file_important
 Name=Module entfernen!

 [Desktop Action scan]
 Exec=SCANNER kooka
 Icon=scanner
 Name=Kooka
 Name[de]=Kooka

 [Desktop Entry]
 Actions=rmscan;empty;scan
 Comment[de]=Xsane
 Exec=SCANNER
 Icon=scanner
 MimeType=
 Name[de]=Xsane
 Path=
 ServiceTypes=
 SwallowExec=
 SwallowTitle=
 Terminal=false
 TerminalOptions=
 Type=Application
 X-KDE-SubstituteUID=false
 X-KDE-Username=

kann man durch den Kontextmenü-Eintrag "Module entfernen!" (rechte Maustaste) die Module wieder entladen.

KernelModul/LadeSkript (zuletzt geändert am 2007年12月23日 22:49:46 durch localhost)

AltStyle によって変換されたページ (->オリジナル) /