Bug 2377 - mdev doesn't load modules for usb hot-plugged devices
Summary: mdev doesn't load modules for usb hot-plugged devices
Status: NEW
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: 1.17.x
Hardware: PC Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-09 17:11 UTC by Andrew
Modified: 2011-08-27 08:43 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew 2010-08-09 17:11:30 UTC
I tried to use busybox mdev as hotplug handler; and I saw that it doesn't load modules for hot-plugged devices (like usb flash). In /proc/sys/kernel/hotplug there is /sbin/mdev as handler, and module is working - it's successfully loaded by modprobing all modaliases.
Kernel - 2.6.35
Comment 1 Denys Vlasenko 2010-08-30 23:58:13 UTC
There is not enough information here to figure out what's going on.

Can you install the following shell script, say, /sbin/mdev_debug.sh:

#!/bin/sh
echo >>/tmp/mdev.trace
date >>/tmp/mdev.trace
echo "Params: $*" >>/tmp/mdev.trace
env | sort >>/tmp/mdev.trace
exec /sbin/mdev "$@"

instead of /sbin/mdev, then plug usb flash in, wait a few seconds, then attach resulting /tmp/mdev.trace to this bug, along with your mdev.conf
Comment 2 Andrew 2011-08-27 08:43:03 UTC
Sorry for long answer waiting, it was more important things for me for that time - but some weeks ago I have time to look on mdev hotplug closer.

It really doesn't load modules, and even at first look it haven't code to do this - even in 1.19.0.

I made simple wrapper to load/unload modules by hotplug, it was tested on 2.6.21 and 2.6.35 kernels, here it is:

#!/bin/sh
[ "$ACTION" = add ] && [ "$MODALIAS" != "" ] && modprobe $MODALIAS
[ "$ACTION" = remove ] && [ "$MODALIAS" != "" ] && modprobe -r $MODALIAS
/sbin/mdev $@

It works good, but IMHO it'll be better if modules will be loaded by mdev itself. 

Here is mdev.trace:
# cat /tmp/mdev.trace

Sat Aug 27 11:32:36 EEST 2011
Params: usb

ACTION=add
BUSNUM=003
DEVICE=/proc/bus/usb/003/002
DEVNAME=bus/usb/003/002
DEVNUM=002
DEVPATH=/devices/pci0000:00/0000:00:02.2/usb3/3-1
DEVTYPE=usb_device
HOME=/
MAJOR=189
MINOR=257
PATH=/sbin:/bin:/usr/sbin:/usr/bin
PHYSDEVBUS=usb
PRODUCT=4e8/1623/100
PWD=/
SEQNUM=1022
SUBSYSTEM=usb
TYPE=0/0/0
Sat Aug 27 11:32:36 EEST 2011
Params: usb
ACTION=add
DEVICE=/proc/bus/usb/003/002
DEVPATH=/devices/pci0000:00/0000:00:02.2/usb3/3-1/3-1:1.0
DEVTYPE=usb_interface
HOME=/
INTERFACE=8/6/80
MODALIAS=usb:v04E8p1623d0100dc00dsc00dp00ic08isc06ip50
PATH=/sbin:/bin:/usr/sbin:/usr/bin
PHYSDEVBUS=usb
PRODUCT=4e8/1623/100
PWD=/
SEQNUM=1023
SUBSYSTEM=usb
TYPE=0/0/0

Sat Aug 27 11:33:17 EEST 2011
Params: usb
ACTION=add
BUSNUM=001
DEVICE=/proc/bus/usb/001/002
DEVNAME=bus/usb/001/002
DEVNUM=002
DEVPATH=/devices/pci0000:00/0000:00:02.0/usb1/1-2
DEVTYPE=usb_device
HOME=/
MAJOR=189
MINOR=1
PATH=/sbin:/bin:/usr/sbin:/usr/bin
PHYSDEVBUS=usb
PRODUCT=d9f/2/0
PWD=/
SEQNUM=1024
SUBSYSTEM=usb
TYPE=0/0/0

Sat Aug 27 11:33:17 EEST 2011
Params: usb
ACTION=add
DEVICE=/proc/bus/usb/001/002
DEVPATH=/devices/pci0000:00/0000:00:02.0/usb1/1-2/1-2:1.0
DEVTYPE=usb_interface
HOME=/
INTERFACE=3/0/0
MODALIAS=usb:v0D9Fp0002d0000dc00dsc00dp00ic03isc00ip00
PATH=/sbin:/bin:/usr/sbin:/usr/bin
PHYSDEVBUS=usb
PRODUCT=d9f/2/0
PWD=/
SEQNUM=1025
SUBSYSTEM=usb
TYPE=0/0/0


Sat Aug 27 11:33:24 EEST 2011
Params: usb
Sat Aug 27 11:33:24 EEST 2011
Params: usb
ACTION=remove
DEVICE=/proc/bus/usb/003/002
DEVPATH=/devices/pci0000:00/0000:00:02.2/usb3/3-1/3-1:1.0
DEVTYPE=usb_interface
HOME=/
INTERFACE=8/6/80
MODALIAS=usb:v04E8p1623d0100dc00dsc00dp00ic08isc06ip50
PATH=/sbin:/bin:/usr/sbin:/usr/bin
PHYSDEVBUS=usb
PRODUCT=4e8/1623/100
PWD=/
SEQNUM=1026
SUBSYSTEM=usb
TYPE=0/0/0
ACTION=remove
BUSNUM=003
DEVICE=/proc/bus/usb/003/002
DEVNAME=bus/usb/003/002
DEVNUM=002
DEVPATH=/devices/pci0000:00/0000:00:02.2/usb3/3-1
DEVTYPE=usb_device
HOME=/
MAJOR=189
MINOR=257
PATH=/sbin:/bin:/usr/sbin:/usr/bin
PHYSDEVBUS=usb
PRODUCT=4e8/1623/100
PWD=/
SEQNUM=1027
SUBSYSTEM=usb
TYPE=0/0/0