1 |
From: Alan Mackenzie [mailto:acm@×××.de] |
2 |
Sent: Tuesday, March 13, 2012 7:04 PM |
3 |
|
4 |
> Huh? What's that to do with udev? You're talking at far too high a level |
5 |
of |
6 |
> abstraction. The new hardware will "just work" if there are the correct |
7 |
> drivers built in. That's as true of udev as it is of mdev as it is of the |
8 |
old static |
9 |
> /dev with mknod. |
10 |
|
11 |
This idea works fine when your drivers are simple enough to go into a |
12 |
kernel, and can actually perform all of the functions your device needs. |
13 |
Many modern devices require "complex" things to happen before or after they |
14 |
appear in your /dev tree before they can *really* be useful. (Complex |
15 |
relative to the operations a kernel module is expected to perform). |
16 |
|
17 |
When I plug in my HP USB printer, the hplip system checks a locally |
18 |
installed database file to make sure I have support for that model before |
19 |
making it available as a device. When udev finds my Bluetooth keyboard or |
20 |
mouse, it launches bluetoothd so it will work. udev manages drives, sound |
21 |
cards and network cards that may appear and disappear in such a way that |
22 |
they are always given consistent names. I have custom rules that run when I |
23 |
plug an Android phone into my machine that preps it for being debugged via |
24 |
Eclipse, despite the kernel seeing it as just a generic USB device. |
25 |
|
26 |
The point is, udev suppors /arbitrary/ behaviors, defined by device vendors |
27 |
or even end users, which can be controlled and configured at runtime. Some |
28 |
of these operations would be hard to do safely from the kernel. Some of them |
29 |
may even trigger events to happen in userspace in the context of the |
30 |
logged-on user (such as automounting from GNOME.) |
31 |
|
32 |
Note that none of this is necessarily unique to udev; mdev could (and |
33 |
probably does, I don't know) provide userspace events for new devices just |
34 |
as easily as udev does. But in order for udev to maintain the broad level of |
35 |
complex hardware support that it has, it must make certain assumptions that |
36 |
may not hold true for /all/ cases, but are true in the /broadest general/ |
37 |
case: that it may be required to launch software or read data found in /usr |
38 |
or /home or wherever else a udev rule might point, and it may be required to |
39 |
do so before it has even seen the device nodes needed to mount non-root |
40 |
partitions. |
41 |
|
42 |
mdev's appeal here in this case is simply that it makes different, simpler |
43 |
assumptions: that it will /never/ need to access software or data that is |
44 |
not part of the root partition at boot time. If that assumption holds true |
45 |
for a given system, then mdev can behave as an effective drop-in replacement |
46 |
for udev. The choice is then to give up support for the broader case in |
47 |
exchange for a simpler system that supports "enough" to make all of your |
48 |
specific hardware function. |
49 |
|
50 |
--Mike |