How to make hotplug work

Gavin Li gavinl at optech.ca
Wed Oct 5 15:13:55 UTC 2005


Bob,

I traced rc.sysinit from RHFC3 yesterday, the hotplug of USB Flash drive
starts working after the script load all modules in the Init Hardware stage.
Then I disabled this script and manually add module by module and I found
out the USB Flash drive needs these modules to make hotplug work: scsi_mod
sd_mod usb-storage ehci-hcd, just as you pointed out.
The weired thing is ehci-hcd is not depended by any other modules. I just
considered the USB Flash drive only needs the scsi_mod sd_mod and
usb-storage.

Thanks for your reply.

Gavin

-----Original Message-----
From: Bob Chiodini [mailto:rchiodin at bellsouth.net]
Sent: Wednesday, October 05, 2005 9:41 AM
To: Gavin Li
Subject: Re: How to make hotplug work


On Tue, 2005-10-04 at 12:38 -0400, Gavin Li wrote:
> > Gavin,
> > 
> > I think echo /sbin/udevsend > /proc/sys/kernel/hotplug should be
> > echo /sbin/hotplug > /proc/sys/kernel/hotplug, if it is not already.  I,
> 
> I already tried both of them, it just doesn't log anything.
> 
> > also had to modprobe usbcore as part of system initialization.  I was
> 
> I use RHFC3 kernel binary. I checked rc.sysinit in RHFC3, it loads all the
> modules, does it need to be done? I think the hotplug should do it when
> neccessary. I found it by call "exit 0" before it prints "Init hardware"
and
> after it. The hotplug starts working after Init hardware ( which all the
> modules have been loaded ), don't understand.
> and Then I tried to modprobe usb-storage, and sd_mod module, and then try
> hotplug, it doesn't work.
> 
> 
> > working with a 2.4.x kernel.  There is a typo near the end of rcS the
> 
> I don't have problem with 2.4.x kernel
> 
> > moun should be mount.  Cut and paste problem?
> 
> I typed in, so it is a typo.
> 
> > 
> > Bob...
> > 
> > This is the /sbin/hotplug that I came up with.  Rather "brute force",
> > but it only needed to do one thing, mount a USB stick.
> 
> 

Gavin,

Some questions:

Does anything show up in dmesg or /var/log/messages when you plug in
your device?

Are the modules usbcore, uhci, and/or ehci loaded before you plug in
your device.  I would think you would at least need uhci/ehci, or they
are compiled into the kernel.  There also may be some dependency on
hald.  I plugged a USB stick into my FC3 box and got the following
in /var/log/messages:

Oct  5 09:31:00 tweedy kernel: usb 1-8.4: new full speed USB device using
ehci_hcd and address 6
Oct  5 09:31:01 tweedy kernel: Initializing USB Mass Storage driver...
Oct  5 09:31:01 tweedy kernel: scsi2 : SCSI emulation for USB Mass Storage
devices
Oct  5 09:31:01 tweedy kernel: usbcore: registered new driver usb-storage
Oct  5 09:31:01 tweedy kernel: USB Mass Storage support registered.
Oct  5 09:31:06 tweedy kernel:   Vendor: LEXAR     Model: DIGITAL FILM
Rev: /W1.
Oct  5 09:31:06 tweedy kernel:   Type:   Direct-Access
ANSI SCSI revision: 02
Oct  5 09:31:06 tweedy scsi.agent[25481]: disk at
/devices/pci0000:00/0000:00:1d.7/usb1/1-8/1-8.4/1-8.4:1.0/host2/target2:0:0/
2:0:0:0
Oct  5 09:31:06 tweedy kernel: SCSI device sda: 251904 512-byte hdwr sectors
(129 MB)
Oct  5 09:31:06 tweedy kernel: sda: Write Protect is off
Oct  5 09:31:06 tweedy kernel: sda: assuming drive cache: write through
Oct  5 09:31:06 tweedy kernel: SCSI device sda: 251904 512-byte hdwr sectors
(129 MB)
Oct  5 09:31:06 tweedy kernel: sda: Write Protect is off
Oct  5 09:31:06 tweedy kernel: sda: assuming drive cache: write through
Oct  5 09:31:06 tweedy kernel:  sda: sda1
Oct  5 09:31:06 tweedy kernel: Attached scsi removable disk sda at scsi2,
channel 0, id 0, lun 0
Oct  5 09:31:07 tweedy fstab-sync[25548]: added mount point
/media/USB_MEMORY for /dev/sda1
Oct  5 09:31:07 tweedy kernel: FAT: utf8 is not a recommended IO charset for
FAT filesystems, filesystem will be case sensitive!
Oct  5 09:31:07 tweedy kernel: SELinux: initialized (dev sda1, type vfat),
uses genfs_contexts
Oct  5 09:31:50 tweedy kernel: usb 1-8.4: USB disconnect, address 6
Oct  5 09:31:50 tweedy fstab-sync[25671]: removed mount point
/media/USB_MEMORY for /dev/sda1

Possibly ehci_hcd is also needed.  The following modules were loaded in
response to inserting the stick:

nls_utf8                6081  0
vfat                   17217  0
fat                    55005  1 vfat
sd_mod                 22721  0
usb_storage            73993  0

USB and the 2.6 kernel seem more complex than the 2.4 kernel.

Hopefully someone else can enlighten us.  

BTW:  All of the above is from FC3 (kernel 2.6.12-1.1378_FC3smp),
and /proc/sys/kernel/hotplug is 

[bob at tweedy kernel]$ cat hotplug
/sbin/hotplug
[bob at tweedy kernel]$ file /sbin/hotplug
/sbin/hotplug: Bourne shell script text executable


Bob...




More information about the fedora-list mailing list