devctl.4 (7f511526c2006de4cafa2a3d255a1e4ca35dc387) devctl.4 (ace5be682d8e04a1dccf8939efa1babe059e3609)
1.\"
2.\" Copyright (c) 2002 M. Warner Losh
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright

--- 8 unchanged lines hidden (view full) ---

17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
1.\"
2.\" Copyright (c) 2002 M. Warner Losh
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright

--- 8 unchanged lines hidden (view full) ---

17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
25.\" $FreeBSD$
26.\"
27.Dd February 11, 2003
28.Dt DEVCTL 4
29.Os
30.Sh NAME
31.Nm devctl
26.\"
27.Dd February 11, 2003
28.Dt DEVCTL 4
29.Os
30.Sh NAME
31.Nm devctl
32.Nd Device event reporting and device control interface.
32.Nd "device event reporting and device control interface"
33.Sh DESCRIPTION
34The
35.Nm
36device is used to report device events from the kernel.
37Future versions will allow for some device control as well.
38.Sh IMPLEMENTATION NOTES
33.Sh DESCRIPTION
34The
35.Nm
36device is used to report device events from the kernel.
37Future versions will allow for some device control as well.
38.Sh IMPLEMENTATION NOTES
39This design allows only one reader for /dev/devctl.
39This design allows only one reader for
40.Pa /dev/devctl .
40This is not desirable
41in the long run, but will get a lot of hair out of this implementation.
42Maybe we should make this device a clonable device.
43.Pp
41This is not desirable
42in the long run, but will get a lot of hair out of this implementation.
43Maybe we should make this device a clonable device.
44.Pp
44Also note: we specifically do not attach a device to the device_t tree
45Also note: we specifically do not attach a device to the
46.Vt device_t
47tree
45to avoid potential chicken and egg problems.
46One could argue that all of this belongs to the root node.
48to avoid potential chicken and egg problems.
49One could argue that all of this belongs to the root node.
47One could also further argue that the sysctl interface that we have
48not might more properly be an ioctl interface.
50One could also further argue that the
51.Xr sysctl 3
52interface that we have now might more properly be an
53.Xr ioctl 2
54interface.
49.Pp
55.Pp
50SIGIO support is included in the driver.
51However, the author is not sure that the SIGIO support is done correctly.
52It was copied from a driver that had SIGIO support that likely hasn't been
53tested since 3.4 or 2.2.8!
56.Dv SIGIO
57support is included in the driver.
58However, the author is not sure that the
59.Dv SIGIO
60support is done correctly.
61It was copied from a driver that had
62.Dv SIGIO
63support that likely has not been
64tested since
65.Fx 3.4
66or
67.Fx 2.2.8 !
54.Pp
55The read channel for this device is used to report changes to
56userland in realtime.
57We return one record at a time.
58If you try to read this device a character at a time, you will loose
59the rest of the data.
60Listening programs are expected to cope.
61.Pp
68.Pp
69The read channel for this device is used to report changes to
70userland in realtime.
71We return one record at a time.
72If you try to read this device a character at a time, you will loose
73the rest of the data.
74Listening programs are expected to cope.
75.Pp
62The sysctl and boot parameter hw.bus.devctl_disable is used to disable
76The sysctl and boot parameter
77.Va hw.bus.devctl_disable
78is used to disable
63.Nm
79.Nm
64when no devd is running.
80when no
81.Xr devd 8
82is running.
65.Sh PROTOCOL
83.Sh PROTOCOL
84The
66.Nm
85.Nm
67uses an ASCII protocol.
86device
87uses an
88.Tn ASCII
89protocol.
68The driver returns one record at a time to its readers.
69Each record is terminated with a newline.
70The first character of the record is the event type.
71.Pp
72.Bl -column -compact "Type" "Description"
73.Em "Type Description"
90The driver returns one record at a time to its readers.
91Each record is terminated with a newline.
92The first character of the record is the event type.
93.Pp
94.Bl -column -compact "Type" "Description"
95.Em "Type Description"
74+ Device node in tree attached
75- Device node in tree detached
76? Unknown device detected
96+ Device node in tree attached.
97- Device node in tree detached.
98? Unknown device detected.
77.El
99.El
78.Ss Message formats
100.Ss Message Formats
79Except for the first character in the record, attach and detach
80messages have the same format.
101Except for the first character in the record, attach and detach
102messages have the same format.
81.D1 Tdev at parent on location
82.Bl -column -compact "Part" "Description"
103.Pp
104.D1 Ar T Ns Ar dev Li at Ar parent Li on Ar location
105.Pp
106.Bl -column -compact "location" "Description"
83.Em "Part Description"
107.Em "Part Description"
84T + or -
85dev The device name that was attached/detached
86parent The device name of the parent bus that attached the device
87location Bus specific location information
108.It Ar T Ta "+ or -"
109.It Ar dev Ta "The device name that was attached/detached."
110.It Ar parent Ta "The device name of the parent bus that attached the device."
111.It Ar location Ta "Bus specific location information."
88.El
89.Pp
90The nomatch messages can be used to load devices driver.
91If you load a device driver, then one of two things can happen.
112.El
113.Pp
114The nomatch messages can be used to load devices driver.
115If you load a device driver, then one of two things can happen.
92If the device driver attaches to something, you'll get a device
116If the device driver attaches to something, you will get a device
93attached message.
117attached message.
94If it doesn't, then nothing will happen.
118If it does not, then nothing will happen.
95.Pp
96The attach and detach messages arrive after the event.
97This means one cannot use the attach message to load an alternate
98driver.
99The attach message driver has already claimed this device.
100One cannot use the detach messages to flush data to the device.
101The device is already gone.
102.Sh SEE ALSO
103.Xr devd 8
119.Pp
120The attach and detach messages arrive after the event.
121This means one cannot use the attach message to load an alternate
122driver.
123The attach message driver has already claimed this device.
124One cannot use the detach messages to flush data to the device.
125The device is already gone.
126.Sh SEE ALSO
127.Xr devd 8
104