mirror of
https://github.com/systemd/systemd.git
synced 2025-01-12 13:18:14 +03:00
5aebfbcb62
Attached is a patch against udev-008 to send out a D-BUS message when a device node is added or removed. Using D-BUS lingo, udev acquires the org.kernel.udev service and sends out a NodeCreated or NodeDeleted signal on the org.kernel.udev.NodeMonitor interface. Each signal carries two parameters: the node in question and the corresponding sysfs path. [Note: the D-BUS concepts of service, interface, object can be a bit confusing at first glance] An example program listening for these messages looks like this #!/usr/bin/python import dbus import gtk def udev_signal_received(dbus_iface, member, service, object_path, message): [filename, sysfs_path] = message.get_args_list() if member=='NodeCreated': print 'Node %s created for %s'%(filename, sysfs_path) elif member=='NodeDeleted': print 'Node %s deleted for %s'%(filename, sysfs_path) def main(): bus = dbus.Bus(dbus.Bus.TYPE_SYSTEM) bus.add_signal_receiver(udev_signal_received, 'org.kernel.udev.NodeMonitor', # interface 'org.kernel.udev', # service '/org/kernel/udev/NodeMonitor') # object gtk.mainloop() if __name__ == '__main__': main() and this is the output when hot-plugging some usb-storage. [david@laptop udev-008]$ ~/node_monitor.py Node /udev/sda created for /block/sda Node /udev/sda1 created for /block/sda/sda1 Node /udev/sda1 deleted for /block/sda/sda1 Node /udev/sda deleted for /block/sda The patch requires D-BUS 0.20 or later while the python example program requires D-BUS from CVS as I only recently applied a patch against the python bindings.
30 lines
1.3 KiB
Plaintext
30 lines
1.3 KiB
Plaintext
This is a short list of things that needs to be done. They are in no specific
|
|
order. I will gladly accept patches for any of these items, or any other stuff
|
|
people offer up.
|
|
|
|
greg k-h
|
|
greg@kroah.com
|
|
|
|
|
|
- fix kernel name logic to handle devices like sdaj and such.
|
|
- more documentation (can never have too much.)
|
|
- add symlink generation and removal support
|
|
- better partition support (it's a hack right now, maybe new libsysfs changes
|
|
can help out a lot here.)
|
|
- allow database to be queried by other programs
|
|
- split program into two pieces (daemon and helper that sends events to it).
|
|
This will allow us to keep track of sequences, and lots of other needed
|
|
stuff.
|
|
- keep track of current permissions on devices when daemon shuts down.
|
|
- better permission handling
|
|
- create kernel name to devfs name config file so that all of the devfs users
|
|
will have an upgrade path.
|
|
- do early boot logic (putting udev into initramfs, handle pivot-root,
|
|
etc.)
|
|
- lots of other stuff...
|
|
- actually use the BUS= value to determine where the LABEL rule should look
|
|
(right now it's ignored, and we only look in the current sysfs directory.)
|
|
This is needed, for example, to look at the usb device's serial number of a
|
|
usb-storage device, instead of the scsi device's sysfs directory for the
|
|
serial number.
|