Devd.conf

Материал из wiki.lissyara.su
Перейти к: навигация, поиск

Конфигурационный файл для хардверных уведомлений на десктопе. (изменение статуса железок, втыкание-вытыкание девайсов и прочее) За подробностями - смотрите http://www.lissyara.su/?id=1364

Причина написания своего - в курренте перевели управление интерфейсами и получением IP адресов по DHCP на работу через devd. Как итог - тот файл, что на сайте DesktopBSD работает - уведомления показываются, но комп не получает адресов по DHCP. Ковыряние и привело к пониманию - этот кусок системы успели перекроить.

Системный конфиг не трогаю - ибо при каждом обновлении будет предлагать его перезатереть, рисую свой и переопределяю какой использовать:

   acer$ cat /etc/rc.conf|grep devd
   devd_flags=" -f /etc/devd.dbsd.conf"
   acer$

Собственно конфиг. Учтите - он оптимизирован для куррента, на начало сентября.

   acer$ cat /etc/devd.dbsd.conf
   # $FreeBSD: src/etc/devd.conf,v 1.42 2008/06/27 12:04:36 rpaulo Exp $
   #
   # Refer to devd.conf(5) and devd(8) man pages for the details on how to
   # run and configure devd.
   #
   
   # NB: All regular expressions have an implicit ^$ around them.
   # NB: device-name is shorthand for 'match device-name'
   
   options {
    # Each directory directive adds a directory the list of directories
    # that we scan for files.  Files are read-in in the order that they
    # are returned from readdir(3).  The rule-sets are combined to
    # create a DFA that's used to match events to actions.
    directory "/etc/devd";
    directory "/usr/local/etc/devd";
    pid-file "/var/run/devd.pid";
   
    # Setup some shorthand for regex that we use later in the file.
    #XXX Yes, these are gross -- imp
    set scsi-controller-regex
     "(aac|adv|adw|aha|ahb|ahc|ahd|aic|amd|amr|asr|bt|ciss|ct|dpt|\
     esp|ida|iir|ips|isp|mlx|mly|mpt|ncr|ncv|nsp|stg|sym|trm|wds)\
     [0-9]+";
   
    set dcop-hwnotify
     "/usr/local/bin/dcop --all-users --all-sessions dbsd-hwnotify Notify";
    set notify-attach
     "/usr/local/bin/dcop --all-users --all-sessions dbsd-hwnotify Notify attachDevice";
    set notify-detach
     "/usr/local/bin/dcop --all-users --all-sessions dbsd-hwnotify Notify detachDevice";
    set notify-link-status-change
     "/usr/local/bin/dcop --all-users --all-sessions dbsd-nettray Notify linkStatusChanged";
    set ignore-output
     " >/dev/null 2>&1 ";
   };
   
   # Note that the attach/detach with the highest value wins, so that one can
   # override these general rules.
   
   attach 10 {
    action "$notify-attach $device-name $ignore-output &";
   };
   detach 10 {
    action "$notify-detach $device-name $ignore-output &";
   };
   
   #
   # Configure the interface on attach.  Due to a historical accident, this
   # script is called pccard_ether.
   #
   notify 0 {
    match "system"          "IFNET";
    match "type"            "ATTACH";
    action "$notify-attach $subsystem $ignore-output & /etc/pccard_ether $subsystem start";
   };
   
   notify 0 {
    match "system"          "IFNET";
    match "type"            "DETACH";
    action "$notify-detach $subsystem $ignore-output & /etc/pccard_ether $subsystem stop";
   };
   
   #
   # Try to start dhclient on Ethernet like interfaces when the link comes
   # up.  Only devices that are configured to support DHCP will actually
   # run it.  No link down rule exists because dhclient automaticly exits
   # when the link goes down.
   #
   notify 0 {
    match "system"          "IFNET";
    match "type"            "LINK_UP";
    media-type              "ethernet";
    action "$notify-link-status-change $subsystem $ignore-output & /etc/rc.d/dhclient quietstart $subsystem";
   };
   
   #
   # Like Ethernet devices, but separate because
   # they have a different media type.  We may want
   # to exploit this later.
   #
   detach 0 {
    media-type "802.11";
    action "$notify-detach $subsystem $ignore-output & /etc/pccard_ether $device-name stop";
   };
   attach 0 {
    media-type "802.11";
    action "$notify-attach $subsystem $ignore-output & /etc/pccard_ether $device-name start";
   };
   notify 0 {
    match "system"          "IFNET";
    match "type"            "LINK_UP";
    media-type              "802.11";
    action "$notify-link-status-change $subsystem $ignore-output & /etc/rc.d/dhclient quietstart $subsystem";
   };
   
   # When a USB Bluetooth dongle appears activate it
   attach 100 {
    device-name "ubt[0-9]+";
    action "$notify-attach $device-name $ignore-output & /etc/rc.d/bluetooth quietstart $device-name";
   };
   detach 100 {
    device-name "ubt[0-9]+";
    action "$notify-detach $device-name $ignore-output & /etc/rc.d/bluetooth quietstop $device-name";
   };
   
   # When a USB keyboard arrives, attach it as the console keyboard.
   attach 100 {
    device-name "ukbd0";
    action "$notify-attach $device-name $ignore-output & /etc/rc.d/syscons setkeyboard /dev/ukbd0";
   };
   detach 100 {
    device-name "ukbd0";
    action "$notify-detach $device-name $ignore-output & /etc/rc.d/syscons setkeyboard /dev/kbd0";
   };
   
   attach 100 {
    device-name "ums[0-9]+";
    action "$notify-attach $device-name $ignore-output & /etc/rc.d/moused quietstart $device-name";
   };
   
   detach 100 {
    device-name "ums[0-9]+";
    action "$notify-detach $device-name $ignore-output & /etc/rc.d/moused stop $device-name";
   };
   
   # Firmware download into the ActiveWire board. After the firmware download is
   # done the device detaches and reappears as something new and shiny
   # automatically.
   attach 100 {
    match "vendor"  "0x0854";
    match "product" "0x0100";
    match "release" "0x0000";
    action "$notify-attach $device-name $ignore-output & /usr/local/bin/ezdownload -f /usr/local/share/usb/firmware/0854.0100.0_01.hex $device-name";
   };
   
   # Firmware download for Entrega Serial DB25 adapter.
   attach 100 {
    match "vendor"  "0x1645";
    match "product" "0x8001";
    match "release" "0x0101";
    action "$notify-attach $device-name $ignore-output & if ! kldstat -n usio > /dev/null 2>&1 ; then kldload usio; fi /usr/sbin/ezdownload -v -f /usr/share/usb/firmware/1645.8001.0101 /dev/$device-name";
   };
   
   # This entry starts the ColdSync tool in daemon mode. Make sure you have an up
   # to date /usr/local/etc/palms. We override the 'listen' settings for port and
   # type in /usr/local/etc/coldsync.conf.
   attach 100 {
    device-name "ugen[0-9]+";
    match "vendor" "0x082d";
    match "product" "0x0100";
    match "release" "0x0100";
    action "$notify-attach $device-name $ignore-output & /usr/local/bin/coldsync -md -p /dev/$device-name -t usb";
   };
   
   # Switch power profiles when the AC line state changes.
   notify 10 {
    match "system"          "ACPI";
    match "subsystem"       "ACAD";
    action "$dcop-hwnotify acpiLineStateChanged $notify $ignore-output & /etc/rc.d/power_profile $notify";
   };
   
   # Notify all users before beginning emergency shutdown when we get
   # a _CRT or _HOT thermal event and we're going to power down the system
   # very soon.
   notify 10 {
    match "system"          "ACPI";
    match "subsystem"       "Thermal";
    match "notify"          "0xcc";
    action "$dcop-hwnotify acpiTemperatureCritical $ignore-output & logger -p kern.emerg 'WARNING: system temperature too high, shutting down soon!'";
   };
   
   # User requested suspend, so perform preparation steps and then execute
   # the actual suspend process.
   notify 10 {
    match "system"          "ACPI";
    match "subsystem"       "Suspend";
    action "$dcop-hwnotify $notify $ignore-output & /etc/rc.suspend acpi $notify";
   };
   notify 10 {
    match "system"          "ACPI";
    match "subsystem"       "Resume";
    action "$dcop-hwnotify $notify $ignore-output & /etc/rc.resume acpi $notify";
   };
   
   # The next blocks enable volume hotkeys that can be found on the Asus EeePC
   notify 0 {
    match "system"          "ACPI";
    match "subsystem"       "ASUS-Eee";
    match "notify"          "0x13";
    action                  "mixer 0";
   };
   
   notify 0 {
    match "system"          "ACPI";
    match "subsystem"       "ASUS-Eee";
    match "notify"          "0x14";
    action                  "mixer vol -10";
   };
   
   notify 0 {
    match "system"          "ACPI";
    match "subsystem"       "ASUS-Eee";
    match "notify"          "0x15";
    action                  "mixer vol +10";
   };
   
   acer$