著者: karl 日付: To: dng 題目: Re: [DNG] What is an init system?
Didier Kryn:
... > > What do you need udev for, isn't it yet another process to run for
> > not much gain, at least for simple systems, and why do I have to
> > recreate /dev at every boot, I can just have static dev files.
> > Yes, udev is a pain, and hdmi and newer mdraid superblocks wants
I meant usb here, not udev.
> > dynamic minors, but except that. And automounting isn't preferred here.
>
> Â Â Â Well, for a server, you can go with static /dev, but for a desktop
> or laptop where you want to plug/uplug external devices, you definitely
> need some brand of a hotplugger, because, yes, the kernel does create
> the device files, but it gives them owners/groups/permisssions which
> make them often unusable. Also the hotplugger creates/manages the
> /dev/disk tree which I find pretty usefull. If I had time to devote to
> it I would give a serious try to mdev. The thing is that it does not
> come ready-made; you need to understand it and build your own
> configuration. I like its simplicity though.
A static /dev (in my view) is where device files maintained on disk,
not by the kernel (with CONFIG_DEVTMPFS).
All that above is about usb.
One problem with usb is that the relation between the hw and the module
to use is hidden --- so it is easy use some form of automounter but
hard to do it manually.
By attaching a usb device you see something like this in the log:
May 28 10:53:30 angelit kern.info kernel: [1420143.035368] usb 2-3: new high-speed USB device number 2 using ehci-pci
From this you can get:
# cat /sys/bus/usb/devices/2-3/manufacturer
Kingston
# cat /sys/bus/usb/devices/2-3/product
DataTraveler 3.0
or if you like,
# cat /sys/bus/usb/devices/2-3/uevent
MAJOR=189
MINOR=129
DEVNAME=bus/usb/002/002
DEVTYPE=usb_device
DRIVER=usb
PRODUCT=951/1666/100
TYPE=0/0/0
BUSNUM=002
DEVNUM=002
its device file is simply the DEVNAME value above with /dev/ prepended
# ls -l /dev/bus/usb/002/002
crw-rw-rw- 1 root root 189, 129 May 15 2019 /dev/bus/usb/002/002
But how do I figure out what module to use (yes, I know it is
usb-storage) ?