Subject: devd-alike for NetBSD
To: None <tech-kern@netbsd.org>
From: Jachym Holecek <freza@liberouter.org>
List: tech-kern
Date: 02/05/2005 12:36:20
Hello,

mostly as an exercise, I finished a first shot at ${subj}. It's implemented
as a straightforward extension of drvctl(4) (added read method) and
autoconf(9) (emit events to drvctl queue). Currently, only attach/detach
events will be announced. This works for any device, with pci/usb/pcmcia
telling more detailed PNP information [1]. Supporting more buses/events
would be very simple.

Source is located at: http://www.liberouter.org/~freza/devmon.tar.gz
The file devmon/README gives installation instructions, devmon/devmon.conf
describes config file format (which is remarkably simple ;-).

I've been inspired by FreeBSD's devd/newbus, but since I only needed a small
subset thereof, I chose to go from scratch.

Feedback is welcome, I'm willing to do more work on this.

	Regards,
		-- Jachym Holecek

[1] This is what events look like. Note that this is right after boot and
    after plugging+unplugging USB flash disk and PCMCIA network card:

$ cat /dev/drvctl
attach cpu0 at mainbus0 
attach acpi0 at mainbus0 
attach acpiec0 at acpi0 
attach acpibut0 at acpi0 
attach acpiacad0 at acpi0 
attach acpibat0 at acpi0 
attach acpibat1 at acpi0 
attach acpilid0 at acpi0 
attach acpitz0 at acpi0 
attach pci0 at mainbus0 
attach pchb0 at pci0 dev 0 function 0 vendor 8086 product 7194
attach auich0 at pci0 dev 0 function 1 vendor 8086 product 7195
attach vga1 at pci0 dev 2 function 0 vendor 1002 product 4c52
attach wsdisplay0 at vga1 
attach pcib0 at pci0 dev 7 function 0 vendor 8086 product 7198
attach piixide0 at pci0 dev 7 function 1 vendor 8086 product 7199
attach atabus0 at piixide0 
attach uhci0 at pci0 dev 7 function 2 vendor 8086 product 719a
attach usb0 at uhci0 
attach uhub0 at usb0 port 0 config -1 iface -1 vendor 8086 product 0000
attach cbb0 at pci0 dev 10 function 0 vendor 104c product ac50
attach fxp0 at pci0 dev 14 function 0 vendor 8086 product 1229
attach inphy0 at fxp0 
attach isa0 at pcib0 
attach lpt0 at isa0 
attach com1 at isa0 
attach com2 at isa0 
attach pckbc0 at isa0 
attach pckbd0 at pckbc0 
attach wskbd0 at pckbd0 
attach pms0 at pckbc0 
attach wsmouse0 at pms0 
attach pcppi0 at isa0 
attach midi0 at pcppi0 
attach sysbeep0 at pcppi0 
attach isapnp0 at isa0 
attach npx0 at isa0 
attach fdc0 at isa0 
attach cardslot0 at cbb0 
attach pcmcia0 at cardslot0 
attach audio0 at auich0 
attach atapibus0 at atabus0 
attach cd0 at atapibus0 
attach wd0 at atabus0 
attach ne2 at pcmcia0 function 0 manufacturer 00000149 product 0000c1ab
attach nsphyter0 at ne2 
detach nsphyter0
detach ne2
attach uhub1 at uhub0 port 2 config -1 iface -1 vendor 0451 product 2046
attach uhub2 at uhub1 port 4 config -1 iface -1 vendor 067b product 2515
attach umass0 at uhub2 port 1 config 1 iface 0 vendor 067b product 2517
attach atapibus1 at umass0 
attach sd0 at atapibus1 
detach sd0
detach atapibus1
detach umass0
detach uhub2
detach uhub1