aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libdevctl/devctl.322
-rw-r--r--lib/libdevctl/devctl.c7
-rw-r--r--lib/libdevctl/devctl.h1
3 files changed, 28 insertions, 2 deletions
diff --git a/lib/libdevctl/devctl.3 b/lib/libdevctl/devctl.3
index b2734cf4aa30..7d8ddbaaab7e 100644
--- a/lib/libdevctl/devctl.3
+++ b/lib/libdevctl/devctl.3
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd February 2, 2016
+.Dd April 27, 2016
.Dt DEVCTL 3
.Os
.Sh NAME
@@ -34,6 +34,7 @@
.Nm devctl_detach ,
.Nm devctl_disable ,
.Nm devctl_enable ,
+.Nm devctl_rescan ,
.Nm devctl_resume ,
.Nm devctl_set_driver ,
.Nm devctl_suspend
@@ -51,6 +52,8 @@
.Ft int
.Fn devctl_enable "const char *device"
.Ft int
+.Fn devctl_rescan "const char *device"
+.Ft int
.Fn devctl_resume "const char *device"
.Ft int
.Fn devctl_set_driver "const char *device" "const char *driver" "bool force"
@@ -149,9 +152,14 @@ If the device is already attached and
is true,
the device will be detached from its current device driver before it is
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
.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
In addition to specific errors noted below,
all of the
@@ -280,6 +288,16 @@ The device is disabled.
.It Bq Er ENXIO
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
.Sh SEE ALSO
.Xr devinfo 3 ,
.Xr devstat 3 ,
diff --git a/lib/libdevctl/devctl.c b/lib/libdevctl/devctl.c
index 7be431e9bf53..33c891b8e853 100644
--- a/lib/libdevctl/devctl.c
+++ b/lib/libdevctl/devctl.c
@@ -122,3 +122,10 @@ devctl_set_driver(const char *device, const char *driver, bool force)
req.dr_flags |= DEVF_SET_DRIVER_DETACH;
return (devctl_request(DEV_SET_DRIVER, &req));
}
+
+int
+devctl_rescan(const char *device)
+{
+
+ return (devctl_simple_request(DEV_RESCAN, device, 0));
+}
diff --git a/lib/libdevctl/devctl.h b/lib/libdevctl/devctl.h
index f773b11dd43a..40c64c126dda 100644
--- a/lib/libdevctl/devctl.h
+++ b/lib/libdevctl/devctl.h
@@ -38,5 +38,6 @@ int devctl_disable(const char *device, bool force_detach);
int devctl_suspend(const char *device);
int devctl_resume(const char *device);
int devctl_set_driver(const char *device, const char *driver, bool force);
+int devctl_rescan(const char *device);
#endif /* !__DEVCTL_H__ */