devctl(8): A device control utility

Slawa Olhovchenkov slw at zxy.spb.ru
Wed Jan 7 18:17:53 UTC 2015


On Mon, Jan 05, 2015 at 03:01:00PM -0500, John Baldwin wrote:

> For a long time I've wanted a way to administratively manipulate the state of 
> new-bus devices from userland.  I think the first use case I wanted was a way 
> to power off the sound controller (and anything else I wasn't using) on my 
> first laptop (a Dell Inspiron 5000e I got back in 2000).  Similarly, it would 
> be nice to have a way to handle "ejectable" devices (ACPI has a provision for 
> this, and said laptop had _EJx methods to allow one to swap a CD drive out for 
> a battery in a bay while the laptop was in S3).  There are some other use 
> cases that would also be nice such as detaching a driver from a PCI device to 
> decide at runtime that it should be passed through to a bhyve guest (and 
> possibly undoing that to allow a host driver to take it back over).  Forcing a 
> rescan of a PCI device can be useful if you are using an FPGA and would like 
> to alter BAR layout/sizes without having to reboot the OS.  A way to force 
> resets at runtime might also be useful (e.g. a FLR for a PCI device).  A few 
> weeks ago I finally sat down and started on an implementation.  It can be 
> found here:
> 
>    https://github.com/bsdjhb/freebsd/compare/devctl
> 
> Sample commands look like:
> 
>  % devctl disable virtio_pci2
> 
>  # detaches the driver, but leaves the device's name intact similar to
>  # specifying hint.virtio_pci.2.disabled=1 at boot
> 
>  % devctl enable virtio_pci2
> 
>  # enables a disabled device, including attaching it
> 
>  % devctl detach uart1
> 
>  # does a full detach, which means the device is now unnamed

Can be now this device used for VirtualBox USB passthrough?


More information about the freebsd-arch mailing list