[BusyBox 0002144]: mdev hotplug behavior for char/block devices

bugs at busybox.net bugs at busybox.net
Sat Feb 16 04:13:21 UTC 2008


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=2144 
====================================================================== 
Reported By:                joeyoravec
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   2144
Category:                   Standards Compliance
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             02-14-2008 16:14 PST
Last Modified:              02-15-2008 20:13 PST
====================================================================== 
Summary:                    mdev hotplug behavior for char/block devices
Description: 
On an embedded system, mdev in busybox 1.7.2 will sometimes create block
instead of character drivers. I experience this problem with two character
devices. Please see additional information for my investigation, and the
attached file for a proposed patch.
====================================================================== 

---------------------------------------------------------------------- 
 vapier - 02-14-08 17:47  
---------------------------------------------------------------------- 
please post the hotplug environment and the sysfs path for the device that
you are seeing problems with 

---------------------------------------------------------------------- 
 espakman - 02-15-08 02:45  
---------------------------------------------------------------------- 
I see the same behaviour with the watchdog device and softdog module

mdev used for hotplugging, echo /sbin/mdev > /proc/sys/kernel/hotplug
/sys/devices/virtual/misc/watchdog


insmod softdog:
/dev/watchdog is added because of hotplugging by mdev, as block device:
brw-rw----  1   root   root  10,130

rm /dev/watchdog, mdev -s:
/dev/watchdog is added as character device:
crw-rw----  1   root   root  10,130

Obviously /usr/sbin/watchdog fails to start in the hotplugging case. 

---------------------------------------------------------------------- 
 joeyoravec - 02-15-08 06:49  
---------------------------------------------------------------------- 
Here's are two of my problem devices, info captured with "env >>
/tmp/mdevlogfile" on a hotplug event. These are devices for an ALSA sound
chip/card over a SPI bitbang bus. There's a dev file under dev path, and
in this situation mdev should create a character device. Without my
proposed patch it would create a block device.

As I said in the original posting "mdev -s" would work fine because it
uses a completely different algorithm (scanning class and bus) and would
correctly create a character device. On hotplug events the situation is
different; the documentation says to use the SUBSYSTEM variable, not to
parse the path.

ACTION=add
HOME=/
SEQNUM=115
MAJOR=116
DEVPATH=/devices/platform/ermine_spi_bb_dac26/spi3.0/sound/card0/pcmC0D0p
SUBSYSTEM=sound
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MINOR=16
PWD=/

ACTION=add
HOME=/
SEQNUM=116
MAJOR=116
DEVPATH=/devices/platform/ermine_spi_bb_dac26/spi3.0/sound/card0/controlC0
SUBSYSTEM=sound
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MINOR=0
PWD=/ 

---------------------------------------------------------------------- 
 vapier - 02-15-08 20:13  
---------------------------------------------------------------------- 
i cannot reproduce this ... if this were actually a problem for me, i would
have fixed it long ago

on my systems, mdev creates all of the alsa devices correctly (which are
loaded as modules, not built into the kernel) and has been since 2.6.19
(i'm currently testing 2.6.24).

for example, with busybox-1.9.1:
root:/> ls -l /dev/watchdog
ls: /dev/watchdog: No such file or directory
root:/> modprobe softdog
Software Watchdog Timer: 0.07 initialized. soft_noboot=0 soft_margin=60
sec (nowayout= 0)
root:/> ls -l /dev/watchdog
crw-rw----    1 root     root      10, 130 Jan  1 18:30 /dev/watchdog

it looks like your DEVPATH is wrong ... it should always start with
/class/... or /block/...  that is why the algorithm works

for example, the environment from first execution with the softdog loading
is:
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
HOME=/
SEQNUM=97
MINOR=130
MAJOR=10
SUBSYSTEM=misc
DEVPATH=/class/misc/watchdog
ACTION=remove 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
02-14-08 16:14  joeyoravec     New Issue                                    
02-14-08 16:14  joeyoravec     Status                   new => assigned     
02-14-08 16:14  joeyoravec     Assigned To               => BusyBox         
02-14-08 16:14  joeyoravec     File Added: busybox-1.7.2-mdevblock.patch        
           
02-14-08 16:15  joeyoravec     Issue Monitored: joeyoravec                    
02-14-08 17:47  vapier         Note Added: 0004854                          
02-15-08 02:45  espakman       Note Added: 0004864                          
02-15-08 06:49  joeyoravec     Note Added: 0004874                          
02-15-08 20:13  vapier         Note Added: 0004944                          
======================================================================




More information about the busybox-cvs mailing list