Re: devd + driver load by plugged device class how to ?

From: Vladimir Grebenschikov <vova_at_fbsd.ru>
Date: Sun, 17 Apr 2005 22:45:59 +0400
В вс, 17/04/2005 в 11:10 -0600, M. Warner Losh пишет:
> In message: <1113740156.1018.6.camel_at_localhost>
>             Vladimir Grebenschikov <vova_at_fbsd.ru> writes:
> : Is there way to configure devd (or other daemon) to load appropriate
> : driver by class, when device detected on bus, like:
> 
> Yes.  That's what nomatch events are for.  The default devd.conf
> momatch entries in it.
> 
> : load ukbd.ko when USB keyboard plugged (same for other USB ums, ulpt,
> : umass, etc)
> 
> usb doesn't support reprobing correctly yet, so this isn't possible
> until it does.
> 
> : load atacard.ko, when ATA disk inserted into PCMCI slot
> 
> nomatch 10 {
> 	match "bus" "pccard[0-9]+];
> 	match "function_type" "4";
> 	action "kldload atacard";
> }
> 
> : load if_wi.ko when WLan card inserted into PCMCI slot 
> 
> This device supports a large number of devices, so the list is rather
> long...

Oops, looks like there is some bugs here:

# cat /etc/devd/atacard.conf
nomatch 10 {
        match "bus" "pccard[0-9]+";
        match "function_type" "4";
        action "kldload atacard";
};
# cat /etc/devd/wi0.conf
nomatch 10 {
        match "bus" "pccard[0-9]+";
        match "manufacturer" "0x0156"; 
        action "kldload if_wi";
};
# grep -C1 \$pnpinfo /etc/devd.conf
nomatch 0 {
        action "logger Unknown device: pnp=$pnpinfo loc=$location bus=$bus manufacturer=$manufacturer product=$product";
};
# devd -dD
Parsing /etc/devd.conf
ethernet-nic-regex=(an|ar|ath|aue|awi|axe|bfe|bge|cm|cnw|cs|cue|dc|de|ed|el|em|ep|ex|fe|fxp|gem|hme|ie|kue|lge|lnc|my|nge|pcn|ray|re|rl|rue|sf|sis|sk|sn|snc|ste|ti|tl|tx|txp|udav|vge|vr|vx|wb|wi|xe|xl)[0-9]+
scsi-controller-regex=(aac|adv|adw|aha|ahb|ahc|ahd|aic|amd|amr|asr|bt|ciss|ct|dpt|ida|iir|ips|isp|mlx|mly|mpt|ncr|ncv|nsp|stg|sym|trm|wds)[0-9]+
Parsing files in /etc/devd
Parsing /etc/devd/wi0.conf
Parsing /etc/devd/iwi.conf
Parsing /etc/devd/acpi_power.conf
Parsing /etc/devd/atacard.conf
Parsing files in /usr/local/etc/devd
// PCMCI CDROM inserted here 
Processing event '? at function=0 manufacturer=0xffffffff product=0xffffffff cisvendor="Shining" cisproduct="PMIDE-ASC" function_type=4 on pccard0'
Pushing table
Processing nomatch event
Testing bus= against ^pccard[0-9]+
Testing bus= against ^pccard[0-9]+
Executing 'logger Unknown device: pnp= loc= bus= manufacturer= product='
Popping table
// WaveLan inserted here
Processing event '? at function=0 manufacturer=0x0156 product=0x0002 cisvendor="Lucent Technologies" cisproduct="WaveLAN/IEEE" function_type=6 on pccard0'
Pushing table
Processing nomatch event
Testing bus= against ^pccard[0-9]+
Testing bus= against ^pccard[0-9]+
Executing 'logger Unknown device: pnp= loc= bus= manufacturer= product='
Popping table
//

Looks like:

- bus name does not substituted, see "Testing bus= against
^pccard[0-9]+" messages, kernel reports valid messages:
pccard0: <unknown card> (manufacturer=0xffffffff, product=0xffffffff) at function 0
pccard0:    CIS info: Shining, PMIDE-ASC, Rev 1.04
pccard0: <unknown card> (manufacturer=0x0156, product=0x0002) at function 0
pccard0:    CIS info: Lucent Technologies, WaveLAN/IEEE, Version 01.01

- variables does not interpreted, see "nomatch 0" entry above, I've
extend it with "manufacturer=$manufacturer product=$product", but
default devd.conf does not works also.


> Warner
-- 
Vladimir B. Grebenchikov
vova_at_fbsd.ru
Received on Sun Apr 17 2005 - 16:49:05 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:32 UTC