Changeset View
Changeset View
Standalone View
Standalone View
lib/libdevctl/devctl.3
Show All 28 Lines | |||||
.Dt DEVCTL 3 | .Dt DEVCTL 3 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm devctl , | .Nm devctl , | ||||
.Nm devctl_attach , | .Nm devctl_attach , | ||||
.Nm devctl_detach , | .Nm devctl_detach , | ||||
.Nm devctl_disable , | .Nm devctl_disable , | ||||
.Nm devctl_enable , | .Nm devctl_enable , | ||||
.Nm devctl_rescan , | |||||
.Nm devctl_resume , | .Nm devctl_resume , | ||||
.Nm devctl_set_driver , | .Nm devctl_set_driver , | ||||
.Nm devctl_suspend | .Nm devctl_suspend | ||||
.Nd device control library | .Nd device control library | ||||
.Sh LIBRARY | .Sh LIBRARY | ||||
.Lb libdevctl | .Lb libdevctl | ||||
.Sh SYNOPSIS | .Sh SYNOPSIS | ||||
.In devctl.h | .In devctl.h | ||||
.Ft int | .Ft int | ||||
.Fn devctl_attach "const char *device" | .Fn devctl_attach "const char *device" | ||||
.Ft int | .Ft int | ||||
.Fn devctl_detach "const char *device" "bool force" | .Fn devctl_detach "const char *device" "bool force" | ||||
.Ft int | .Ft int | ||||
.Fn devctl_disable "const char *device" "bool force_detach" | .Fn devctl_disable "const char *device" "bool force_detach" | ||||
.Ft int | .Ft int | ||||
.Fn devctl_enable "const char *device" | .Fn devctl_enable "const char *device" | ||||
.Ft int | .Ft int | ||||
.Fn devctl_rescan "const char *device" | |||||
.Ft int | |||||
.Fn devctl_resume "const char *device" | .Fn devctl_resume "const char *device" | ||||
.Ft int | .Ft int | ||||
.Fn devctl_set_driver "const char *device" "const char *driver" "bool force" | .Fn devctl_set_driver "const char *device" "const char *driver" "bool force" | ||||
.Ft int | .Ft int | ||||
.Fn devctl_suspend "const char *device" | .Fn devctl_suspend "const char *device" | ||||
.Sh DESCRIPTION | .Sh DESCRIPTION | ||||
The | The | ||||
.Nm | .Nm | ||||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | |||||
.Fa force | .Fa force | ||||
is false, | is false, | ||||
the request will fail. | the request will fail. | ||||
If the device is already attached and | If the device is already attached and | ||||
.Fa force | .Fa force | ||||
is true, | is true, | ||||
the device will be detached from its current device driver before it is | the device will be detached from its current device driver before it is | ||||
attached to the new device driver. | attached to the new device driver. | ||||
.Pp | |||||
The | |||||
.Fn devctl_rescan | |||||
function rescans a bus device checking for devices that have been added or | |||||
removed. | |||||
.Sh RETURN VALUES | .Sh RETURN VALUES | ||||
.Rv -std devctl_attach devctl_detach devctl_disable devctl_enable \ | .Rv -std devctl_attach devctl_detach devctl_disable devctl_enable \ | ||||
devctl_suspend devctl_resume devctl_set_driver | devctl_suspend devctl_rescan devctl_resume devctl_set_driver | ||||
.Sh ERRORS | .Sh ERRORS | ||||
In addition to specific errors noted below, | In addition to specific errors noted below, | ||||
all of the | all of the | ||||
.Nm | .Nm | ||||
functions may fail for any of the errors described in | functions may fail for any of the errors described in | ||||
.Xr open 2 | .Xr open 2 | ||||
as well as: | as well as: | ||||
.Bl -tag -width Er | .Bl -tag -width Er | ||||
▲ Show 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | |||||
.It Bq Er ENOENT | .It Bq Er ENOENT | ||||
No device driver with the requested name exists. | No device driver with the requested name exists. | ||||
.It Bq Er ENOMEM | .It Bq Er ENOMEM | ||||
An internal memory allocation request failed. | An internal memory allocation request failed. | ||||
.It Bq Er ENXIO | .It Bq Er ENXIO | ||||
The device is disabled. | The device is disabled. | ||||
.It Bq Er ENXIO | .It Bq Er ENXIO | ||||
The new device driver failed to attach. | The new device driver failed to attach. | ||||
.El | |||||
.Pp | |||||
The | |||||
.Fn devctl_rescan | |||||
function may fail if: | |||||
.Bl -tag -width Er | |||||
.It Bq Er ENXIO | |||||
The device is not attached to a driver. | |||||
.It Bq Er ENXIO | |||||
The bus driver does not support rescanning. | |||||
.El | .El | ||||
.Sh SEE ALSO | .Sh SEE ALSO | ||||
.Xr devinfo 3 , | .Xr devinfo 3 , | ||||
.Xr devstat 3 , | .Xr devstat 3 , | ||||
.Xr devctl 8 | .Xr devctl 8 | ||||
.Sh HISTORY | .Sh HISTORY | ||||
The | The | ||||
.Nm | .Nm | ||||
library first appeared in | library first appeared in | ||||
.Fx 10.3 . | .Fx 10.3 . | ||||
.Sh BUGS | .Sh BUGS | ||||
If a device is suspended individually via | If a device is suspended individually via | ||||
.Fn devctl_suspend | .Fn devctl_suspend | ||||
and the entire machine is subsequently suspended, | and the entire machine is subsequently suspended, | ||||
the device will be resumed when the machine resumes. | the device will be resumed when the machine resumes. |