BusyBox Bug and Patch Tracking
BusyBox
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004714 [BusyBox] Other major always 08-23-08 14:46 09-08-08 11:05
Reporter lucas View Status public  
Assigned To BusyBox
Priority normal Resolution fixed  
Status closed   Product Version 1.11.x
Summary 0004714: mdev can't tell the difference between /dev/lp0 and /dev/usblp0
Description As mdev uses the basename of the device path to know the device name, situations like "/sys/class/usb/lp0" and "/sys/class/printer/lp0" get in conflict (the last hotplug event overwrites the previous device file).
Additional Information In make_device(), at mdev.c, not even the "exec" rule can fix this, as only the device name is passed (and it has already overwritten the previous device file).

A solution could be to have the mdev.conf file syntax to allow a match for alternate things, like the major/minor pair (which would work at least for devices with fixed assigned pairs).

One possible syntax could be:

--------- mdev.conf ---------
@180,0-15 0:0 660 =usb/ ## /dev/usb/lp{0-15}
@7,0-63 0:0 660 >vc/ ## /dev/vc/{vcs,vcs1,...}
@7,128-191 0:0 660 >vc/ ## /dev/vc/{vcsa,vcsa1,...}
@13,0-31 0:0 660 >input/ ## /dev/input/{js0,js1,...}
@13,32-62 0:0 660 >input/ ## /dev/input/{mouse0,mouse1,...}
@13,63 0:0 660 >input/ ## /dev/input/mice
@13,64-95 0:0 660 >input/ ## /dev/input/{event0,event1,...}
--------- mdev.conf ---------

One possible implication of this scheme (not actually tested) is that the scan task would be faster, as there is no need for regular expression matches for most rules.

Off course, the current rename of the old device would need to be fixed.

I would also vote for an exec rule that would not get called with the device already created (and possibly overwriting a previous one). The major/minor and type of the device file would just get passed by env vars and the executed script/binary would then create the device if needed.
Attached Files  bb-mdev-implement_matching_by_dev_pair.diff [^] (2,813 bytes) 09-04-08 08:20

- Relationships

- Notes
(0010994)
lucas
09-04-08 08:21

RFC: Uploaded a patch to implement the behaviour described earlier, but doesn't handle the "exec" case (need some directions on the best way here).
 
(0011144)
vda
09-06-08 12:25

Trying to understand what patch is doing. I understand why did you need to do sscanf earlier, but starting from this part:

- if (ENABLE_FEATURE_MDEV_RENAME)
+ if (ENABLE_FEATURE_MDEV_RENAME && !alias)

there seems to be another, unrelated change mixed in. Please explain.
 
(0011154)
lucas
09-08-08 08:00

In the old way, the original device file name is removed at this point, but if (as it normally is) "/dev/lp0" was already added, then it would remove the wrong file (we want "/dev/usb/lp0").

I am trying to maintain the old behavior if no rename/alias is being made.

There is a big disadvantage to this patch: it can't be used to make something like "/dev/usblp0", but this ("/dev/usb/lp0") works for me and I'm trying to make the patch as non-intrusive as possible.

It would be nice if the full path to the sysfs file could be passed to the exec script (maybe by some env var), so we could have a script that could do this for us, but we would need to solve the "delete old dev file first" problem (and that constitutes an incompatible change).
 
(0011164)
vda
09-08-08 11:05

Applied to svn, thanks!
 

- Issue History
Date Modified Username Field Change
08-23-08 14:46 lucas New Issue
08-23-08 14:46 lucas Status new => assigned
08-23-08 14:46 lucas Assigned To  => BusyBox
08-23-08 14:52 lucas Issue Monitored: lucas
09-04-08 08:20 lucas File Added: bb-mdev-implement_matching_by_dev_pair.diff
09-04-08 08:21 lucas Note Added: 0010994
09-06-08 12:25 vda Note Added: 0011144
09-08-08 08:00 lucas Note Added: 0011154
09-08-08 11:05 vda Status assigned => closed
09-08-08 11:05 vda Note Added: 0011164
09-08-08 11:05 vda Resolution open => fixed
09-08-08 11:05 vda Fixed in Version  => svn


Copyright © 2000 - 2006 Mantis Group
Powered by Mantis Bugtracker