Skip to contentSkip to conversation

hotplug usb.rc changes

PATCH David Brownell 3 participants 10 messages Jun 11, 2003 – Jun 12, 2003

lore
Share & tools
lore
#0 lore raw
Quoted 4 lines · Olaf Hering

I missed /etc/sysconfig/hotplug in usb.rc, fixed patch:

- do not use /etc/sysconfig/usb anymore, use /etc/sysconfig/hotplug instead

But is anything except USB using that? This is an area it'd be good to see RedHat, SuSE, and others agree, but I'd take SuSE as a start.

Also, you're discarding the kernel setting for $DEBUG; maybe it shouldn't be there, but if you want to discard that feature a kernel patch should happen too.

Quoted 1 line

- better check if usb was successfully activated

That is, /proc/bus/usb/001 directory exists? Yes, better!

There's still the issue of needing to get USB partly started _very_ early in boot, for systems with only USB input devices.

Have you looked at what issues would come up from (optionally) running /etc/hotplug/usb.rc from system startup, /etc/rc.d/rc.sysinit (or whatever)?

Quoted 5 lines

- add two new /etc/sysconfig/hotplug variables:
* use HOTPLUG_USB_HOSTCONTROLLER_LIST to load a fixed list of host controller drivers
* use HOTPLUG_USB_STATIC_MODULES to load a fixed list of drivers (for input)

Those seem like good things to keep in an /etc/sysconfig file (and somewhere you had a Debian version, too).

I'll see about merging this, most of it looks fine.

- Dave

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The best thread debugger on the planet. Designed with thread debugging features you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#1 lore raw
Quoted 9 lines · David Brownell
Quoted 4 lines · Olaf Hering

I missed /etc/sysconfig/hotplug in usb.rc, fixed patch:

- do not use /etc/sysconfig/usb anymore, use /etc/sysconfig/hotplug instead

But is anything except USB using that? This is an area it'd be good to see RedHat, SuSE, and others agree, but I'd take SuSE as a start.

We just have the stock references to /etc/sysconfig/{pci,usb}; we don't use /etc/sysconfig/hotplug.

Bill

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The best thread debugger on the planet. Designed with thread debugging features you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to David Brownell
Quoted 7 lines · Bill Nottingham
Quoted 6 lines · David Brownell
Quoted 4 lines · Olaf Hering

I missed /etc/sysconfig/hotplug in usb.rc, fixed patch:

- do not use /etc/sysconfig/usb anymore, use /etc/sysconfig/hotplug instead

Quoted 6 lines
Quoted 3 lines

But is anything except USB using that? This is an area it'd be good to see RedHat, SuSE, and others agree, but I'd take SuSE as a start.

We just have the stock references to /etc/sysconfig/{pci,usb}; we don't use /etc/sysconfig/hotplug.

I see no /etc/sysconfig/{pci,usb} on a redhat system, but hotplug is installed.

Such a sysconfig file would make sense to add static drivers that must be loaded at hotplug start, but that may not trigger events.

The hostcontroller list is maybe not needed, pci hotplug could take care of this. The potential problem that I see with pci hotplug is, that it does load all drivers for a system, it loads them in a random order (unverified), and it could load the wrong ones (uhci/usb-uhci). Loading buggy drivers could lead to crashes, loading them in random order could reorder your network interfaces if there are more than one kind of network card (eth0 could become eth1), and so on.
I have an ieee1394.rc script for that reason, just to avoid pci.rc usage.

Further, we have a patch to beep on /dev/console when a driver is loaded. And also a patch that allows more verbose logging of hotplug events.
So we have now 4 users of such a /etc/sysconfig/hotplug file.

Now, Debian has its stuff in /etc/default/... Too bad that the standard leaves the sysconfig stuff undefined.

Gruss Olaf

Signature · 11 lines
USB is for mice, FireWire is for men!


-------------------------------------------------------
This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#3 lore raw
In reply to David Brownell
Quoted 9 lines · Olaf Hering
Quoted 6 lines
Quoted 3 lines

But is anything except USB using that? This is an area it'd be good to see RedHat, SuSE, and others agree, but I'd take SuSE as a start.

We just have the stock references to /etc/sysconfig/{pci,usb}; we don't use /etc/sysconfig/hotplug.

I see no /etc/sysconfig/{pci,usb} on a redhat system, but hotplug is installed.

We don't include ones, but the hotplug scripts we ship will use the USB one if they it's there (the pci one is commented out, sorry.)

Bill

-------------------------------------------------------
This SF.NET email is sponsored by: eBay
Great deals on office technology -- on eBay now! Click here:
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#4 lore raw
In reply to David Brownell
Quoted 8 lines · Bill Nottingham
Quoted 7 lines · Olaf Hering
Quoted 6 lines
Quoted 3 lines

But is anything except USB using that? This is an area it'd be good to see RedHat, SuSE, and others agree, but I'd take SuSE as a start.

We just have the stock references to /etc/sysconfig/{pci,usb}; we don't use /etc/sysconfig/hotplug.

Quoted 6 lines
Quoted 2 lines

I see no /etc/sysconfig/{pci,usb} on a redhat system, but hotplug is installed.

We don't include ones, but the hotplug scripts we ship will use the USB one if they it's there (the pci one is commented out, sorry.)

what values do they contain? It seems hotplug can perfectly work without them.
And it would make much sense to load hid.o, mousedev.o and keybdev.o per default anyway, so this x11 hack is obsolete. Or is there a reason why one would not load the usb hid drivers? I dont see any.

Gruss Olaf

Signature · 11 lines
USB is for mice, FireWire is for men!


-------------------------------------------------------
This SF.NET email is sponsored by: eBay
Great deals on office technology -- on eBay now! Click here:
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#5 lore raw
In reply to David Brownell
Quoted 6 lines
Quoted 3 lines

We don't include ones, but the hotplug scripts we ship will use the USB one if they it's there (the pci one is commented out, sorry.)

what values do they contain? It seems hotplug can perfectly work without them.

Whatever someone wants, I suppose. We just use the stock scripts that refer to them.

Quoted 3 lines

And it would make much sense to load hid.o, mousedev.o and keybdev.o per default anyway, so this x11 hack is obsolete. Or is there a reason why one would not load the usb hid drivers? I dont see any.

We actually load them outside of the usb hotplug framework.

Bill

-------------------------------------------------------
This SF.NET email is sponsored by: eBay
Great deals on office technology -- on eBay now! Click here:
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#6 lore raw
In reply to David Brownell
Quoted 10 lines · Bill Nottingham
Quoted 6 lines
Quoted 3 lines

We don't include ones, but the hotplug scripts we ship will use the USB one if they it's there (the pci one is commented out, sorry.)

what values do they contain? It seems hotplug can perfectly work without them.

Whatever someone wants, I suppose. We just use the stock scripts that refer to them.

And Olaf had the right idea to ship the /etc/sysconfig/* files that are referenced. I'm just thinking that just a "usb" file would be enough; nothing much is shared between the different agents, and having a "hotplug" file with only USB-specific options seems wrong.

Quoted 6 lines
Quoted 3 lines

And it would make much sense to load hid.o, mousedev.o and keybdev.o per default anyway, so this x11 hack is obsolete. Or is there a reason why one would not load the usb hid drivers? I dont see any.

We actually load them outside of the usb hotplug framework.

Which is a bit of a problem in terms of getting convergence. It'd be good to have a standard way to start up USB, and that's exactly what "/etc/hotplug/usb.rc start" was intended to do.

If I understand why RedHat's rc.sysinit does it that way, there are a few reasons. One is (a) to use "kudzu" static config data, which knows various USB-specific, overlapping /etc/sysconfig/usb a bit. The better (IMO) reason is (b) to ensure that USB keyboards/mice can be used during system bootstrap, if the kernel (or its initrd) didn't build them in. That's early for "usb.rc start", since hotplug agents often can't run that early (filesystems unmounted or readonly, etc). And it also doesn't use the same conventions as "usb.rc" does.

Seems like we would win by having an "rc.usb boot" way for RC scripts to solve that input device problem, calling it later to handle the "coldplug" problem like "rc.usb start" does today (synthesizing the events that couldn't be handled that early).

- Dave

-------------------------------------------------------
This SF.NET email is sponsored by: eBay
Great deals on office technology -- on eBay now! Click here:
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#7 lore raw
In reply to David Brownell
Quoted 6 lines · David Brownell
Quoted 1 line

We actually load them outside of the usb hotplug framework.

Which is a bit of a problem in terms of getting convergence. It'd be good to have a standard way to start up USB, and that's exactly what "/etc/hotplug/usb.rc start" was intended to do.

Quoted 8 lines

If I understand why RedHat's rc.sysinit does it that way, there are a few reasons. One is (a) to use "kudzu" static config data, which knows various USB-specific, overlapping /etc/sysconfig/usb a bit. The better (IMO) reason is (b) to ensure that USB keyboards/mice can be used during system bootstrap, if the kernel (or its initrd) didn't build them in. That's early for "usb.rc start", since hotplug agents often can't run that early (filesystems unmounted or readonly, etc). And it also doesn't use the same conventions as "usb.rc" does.

It's actually only for the second reason; so that the keyboard is there if (for example) fsck fails.

Bill

-------------------------------------------------------
This SF.NET email is sponsored by: eBay
Great deals on office technology -- on eBay now! Click here:
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#8 lore raw
In reply to David Brownell
Quoted 3 lines · Bill Nottingham

It's actually only for the second reason; so that the keyboard is there if (for example) fsck fails.

So it looks like it'd be a win if "rc.usb boot" did that logic, without the "coldplug" stuff to handle the system being only partially booted. RH-specific logic won't be necessary.

Of course there's still that issue of which HCDs to load; Olaf's patch says that's what the /etc/sysconfig file holds. RH currently uses /etc/modules.conf for such stuff ... and a pure hotplug model would use interact with what PCI says is actually present.

- Dave

-------------------------------------------------------
This SF.NET email is sponsored by: eBay
Great deals on office technology -- on eBay now! Click here:
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#9 lore raw
In reply to David Brownell
Quoted 8 lines · David Brownell
Quoted 3 lines · Bill Nottingham

It's actually only for the second reason; so that the keyboard is there if (for example) fsck fails.

So it looks like it'd be a win if "rc.usb boot" did that logic, without the "coldplug" stuff to handle the system being only partially booted. RH-specific logic won't be necessary.

Our runlevel S loads the usb stuff unconditionally like this:

#

# load usb drivers in runlevel S
#
case "${PREVLEVEL}${RUNLEVEL}" in
        N1|NS)
        test -f /etc/sysconfig/hotplug &&  . /etc/sysconfig/hotplug && test "$HOTPLUG_START_USB" = "yes" && {
        test -f /proc/cpuinfo || mount -n -t proc proc /proc 2>/dev/null
        test -d /proc/bus/usb || modprobe usbcore >/dev/null 2>&1
        mount usbdevfs >/dev/null 2>&1
        for i in $HOTPLUG_USB_HOSTCONTROLLER_LIST ;do echo -n $i" " ;modprobe $i >/dev/null 2>&1 ;done;echo
        sleep 3
        grep ^I: /proc/bus/usb/devices | grep HID && for i in input hid keybdev;do modprobe $i >/dev/null 2>&1 ;done
        }
        ;;
esac

This HOTPLUG_START_USB used to exist, but I'm not sure if we will leave these HOTPLUG_START_{USB,IEEE1394,...} stuff for the next release. I will probably remove it, have to think about it in the next days.

Well, maybe something like this could become part of a 'usb.rc boot' or 'usb.rc single' or something.

The only real issue is the /etc/sysconfig/ vs. /etc/default/ We should source both if they exist, it causes only one additional stat() call.
The goal should be that the configuration is unified somehow, and not spread all over /etc for the various distros.

Gruss Olaf

Signature · 11 lines
USB is for mice, FireWire is for men!


-------------------------------------------------------
This SF.NET email is sponsored by: eBay
Great deals on office technology -- on eBay now! Click here:
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel