# Finding docked status using devd



## VucanRidr (Sep 10, 2019)

Hi,

How do you determine whether or not a laptop is docked? I have a Lenovo W520 with the standard Lenovo docking station. 

I tried looking at dmesg, and saw the following, conceivably after I disconnected the dock:


```
uhid0 on uhub4
uhid0: <vendor 0x0765 product 0x5001, class 0/0, rev 1.10/0.01, addr 3> on usbus0
ums0 on uhub4
ums0: <MOSART Semi. 2.4G Keyboard Mouse, class 0/0, rev 1.10/1.02, addr 4> on usbus0
ums0: 5 buttons and [XYZT] coordinates ID=3
ugen0.5: <vendor 0x17ef product 0x100a> at usbus0 (disconnected)
uhub5: at uhub4, port 5, addr 5 (disconnected)
uhub5: detached
em0: link state changed to DOWN
```

So how do I find the device that I would need to manipulate in devd.conf?

thanks.


----------



## k.jacker (Sep 10, 2019)

You can either check for something that you have always connected to your docking, or for something inside the docking itself, it just needs to be uniq.
I check for USB inside my docking and that works very well, even it's still a work in progress.

The output from pciconf(8) and usbconfig(8) will help you to adapt my example to your setup.
I can't show you my output, because I'm abroad and haven't been docked for a while now.
devd.conf(5) is a must read, too.


```
notify 100 {
    match "system"        "USB";
    match "subsystem"    "!usbus[0-9]+";
    match "vendor"        "0x413c";
    match "product"        "0x2513";
    action "sysctl hw.snd.default_unit=4";
    action "ifconfig wlan0 down";
};
```


----------

