linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Device has module AND init script
@ 2002-01-21  2:53 Jim Carter
  2002-01-21  3:17 ` David Brownell
  0 siblings, 1 reply; 2+ messages in thread
From: Jim Carter @ 2002-01-21  2:53 UTC (permalink / raw)
  To: linux-hotplug

I have a joystick which has the usual module stack, but which also needs to
have jscal executed upon hotplugging (via my script
/etc/hotplug/usb/setupstick).  There are three issues here:

1.  The logical place to name the setup script is usb.usermap, but if any
modules are found, usb.agent bypasses usb.usermap.  Workaround: put the
lines in usb.handmap.

2.  Both modules and setup scripts have an order dependence which modprobe
may not be able to 100% straighten out.  Workaround: Use the source, Luke!
The right effect is achieved if the script is listed first, then the most
specific driver, to the most general.  I'm not sure how order dependence
could be enforced neatly, specifically to get the script executed last, so
I didn't try to hack anything for this.

3.  In the obsolete version in my distro (2001_04_24-1_6),
hotplug.functions :: load_drivers tries to find the module in
/lib/modules/$KERNEL.  Three issues (relevant to the current version
2002_01_14) go with this:

a.  If that "directory" is a symlink, which it is in my system, "find" will
not find the module.  Fix: MODULE_DIR=/lib/modules/$KERNEL/.

b.  "find" (at least Gnu Find 4.1.7) returns 0 if there was no error even
if no files were found.  The script always thought it saw the module
anyway.  The current version doesn't have the find.

c.  It's a lot easier to test for an init script first, and if it's not an
init script then run modprobe, and if that fails you don't have to figure
out why it failed, just say that it did.

I've appended a patch for the above points, versus
hotplug-2002_01_14.tar.gz.

James F. Carter          Voice 310 825 2897    FAX 310 206 6673
UCLA-Mathnet;  6115 MSA; 405 Hilgard Ave.; Los Angeles, CA, USA  90095-1555
Email: jimc@math.ucla.edu    http://www.math.ucla.edu/~jimc (q.v. for PGP key)


*** ../hotplug/hotplug.functions	Mon Jan 14 11:26:45 2002
--- hotplug.functions	Sun Jan 20 18:25:14 2002
***************
*** 14,20 ****
  PATH=/bin:/sbin:/usr/sbin:/usr/bin

  KERNEL=`uname -r`
! MODULE_DIR=/lib/modules/$KERNEL

  HOTPLUG_DIR=/etc/hotplug

--- 14,20 ----
  PATH=/bin:/sbin:/usr/sbin:/usr/bin

  KERNEL=`uname -r`
! MODULE_DIR=/lib/modules/$KERNEL/.

  HOTPLUG_DIR=/etc/hotplug

***************
*** 138,153 ****
  	    if grep -q "^$MODULE\$" /etc/hotplug/blacklist \
  		    >/dev/null 2>&1; then
  		debug_mesg "... blacklisted module:  $MODULE"
! 	    # user mode drivers will ONLY have a setup script,
! 	    # so it's not an error if a module doesn't exist
! 	    elif $MODPROBE -n $MODULE >/dev/null 2>&1 &&
! 		    ! $MODPROBE $MODULE >/dev/null 2>&1 ; then
! 		mesg "... can't load module $MODULE"
  	    elif [ -x /etc/hotplug/$TYPE/$MODULE ]; then
  		debug_mesg Module setup $MODULE for $DESCRIPTION
  		/etc/hotplug/$TYPE/$MODULE
! 	    else
! 		mesg "missing kernel or user mode driver $MODULE "
  	    fi
  	fi
      done
--- 138,150 ----
  	    if grep -q "^$MODULE\$" /etc/hotplug/blacklist \
  		    >/dev/null 2>&1; then
  		debug_mesg "... blacklisted module:  $MODULE"
! 		# Bypass modprobe if it's a user driver or setup script.
  	    elif [ -x /etc/hotplug/$TYPE/$MODULE ]; then
  		debug_mesg Module setup $MODULE for $DESCRIPTION
  		/etc/hotplug/$TYPE/$MODULE
! 	    elif $MODPROBE -n $MODULE >/dev/null 2>&1 &&
! 		    ! $MODPROBE $MODULE >/dev/null 2>&1 ; then
! 		mesg "... can't load module $MODULE nor execute /etc/hotplug/$TYPE/$MODULE"
  	    fi
  	fi
      done


_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-01-21  3:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-01-21  2:53 Device has module AND init script Jim Carter
2002-01-21  3:17 ` David Brownell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).