From: Jim Carter <jimc@math.ucla.edu>
To: linux-hotplug@vger.kernel.org
Subject: Device has module AND init script
Date: Mon, 21 Jan 2002 02:53:35 +0000 [thread overview]
Message-ID: <marc-linux-hotplug-101158194629165@msgid-missing> (raw)
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
next reply other threads:[~2002-01-21 2:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-01-21 2:53 Jim Carter [this message]
2002-01-21 3:17 ` Device has module AND init script David Brownell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=marc-linux-hotplug-101158194629165@msgid-missing \
--to=jimc@math.ucla.edu \
--cc=linux-hotplug@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).