Changeset View
Standalone View
share/man/man4/gpiokeys.4
- This file was added.
Property | Old Value | New Value |
---|---|---|
svn:eol-style | null | native \ No newline at end of property |
svn:keywords | null | FreeBSD=%H \ No newline at end of property |
svn:mime-type | null | text/plain \ No newline at end of property |
.\" | |||||
.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD | |||||
.\" | |||||
.\" Copyright (c) 2020 Andriy Gapon <avg@FreeBSD.org> | |||||
.\" | |||||
.\" Redistribution and use in source and binary forms, with or without | |||||
.\" modification, are permitted provided that the following conditions | |||||
.\" are met: | |||||
.\" 1. Redistributions of source code must retain the above copyright | |||||
.\" notice, this list of conditions and the following disclaimer. | |||||
.\" 2. Redistributions in binary form must reproduce the above copyright | |||||
.\" notice, this list of conditions and the following disclaimer in the | |||||
.\" documentation and/or other materials provided with the distribution. | |||||
.\" | |||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
.\" SUCH DAMAGE. | |||||
.\" | |||||
.\" $FreeBSD$ | |||||
.\" | |||||
.Dd August 3, 2020 | |||||
.Dt GPIOKEYS 4 | |||||
.Os | |||||
.Sh NAME | |||||
.Nm gpiokeys | |||||
.Nd GPIO keys device driver | |||||
.Sh SYNOPSIS | |||||
To compile this driver into the kernel, | |||||
place the following lines in your | |||||
kernel configuration file: | |||||
.Bd -ragged -offset indent | |||||
.Cd "options FDT" | |||||
.Cd "device gpio" | |||||
.Cd "device gpiokeys" | |||||
.Ed | |||||
.Pp | |||||
Alternatively, to load the driver as a | |||||
module at boot time, place the following line in | |||||
.Xr loader.conf 5 : | |||||
.Bd -literal -offset indent | |||||
gpiokeys_load="YES" | |||||
.Ed | |||||
.Sh DESCRIPTION | |||||
The | |||||
.Nm | |||||
driver provides a way to represent a set of general purpose inputs as a | |||||
.Xr keyboard 4 | |||||
device. | |||||
At the moment the driver supports only | |||||
.Xr FDT 4 | |||||
based systems. | |||||
The FDT determines what pins are mapped to buttons and what key codes are | |||||
generated for each virtual button. | |||||
manu: This sounds weird to me, I think that s/FDT/DTS/ would sound better. | |||||
Done Inline ActionsOkay. avg: Okay. | |||||
The | |||||
.Xr keyboard 4 | |||||
device can be used from userland to monitor for input changes. | |||||
.Pp | |||||
On an | |||||
.Xr FDT 4 | |||||
based system | |||||
the DTS part for a | |||||
.Nm gpiokeys | |||||
bjkUnsubmitted Done Inline ActionsI expect mandoc -Tlint to complain about an argument to .Nm here. bjk: I expect mandoc -Tlint to complain about an argument to .Nm here. | |||||
avgAuthorUnsubmitted Done Inline ActionsActually, it didn't. avg: Actually, it didn't.
I'll fix this.
| |||||
device usually looks like: | |||||
.Bd -literal | |||||
/ { | |||||
... | |||||
gpio_keys { | |||||
compatible = "gpio-keys"; | |||||
btn1 { | |||||
label = "button1"; | |||||
linux,code = <KEY_1>; | |||||
gpios = <&gpio 0 3 GPIO_ACTIVE_LOW> | |||||
}; | |||||
btn2 { | |||||
label = "button2"; | |||||
linux,code = <KEY_2>; | |||||
gpios = <&gpio 0 4 GPIO_ACTIVE_LOW> | |||||
}; | |||||
}; | |||||
}; | |||||
.Ed | |||||
.Pp | |||||
For more details about the | |||||
.Va gpios | |||||
property, please consult | |||||
.Pa /usr/src/sys/dts/bindings-gpio.txt . | |||||
.Pp | |||||
Not Done Inline ActionsMhm, I didn't knew we still had this. manu: Mhm, I didn't knew we still had this.
It's an old file that might not be accurate anymore and… | |||||
Done Inline ActionsI took this from from gpioled(4). avg: I took this from from gpioled(4).
If you can make a suggestion on how to improve this part… | |||||
Not Done Inline ActionsYeah we can improve later, this is way better that what we currently have :) manu: Yeah we can improve later, this is way better that what we currently have :) | |||||
Done Inline ActionsBTW, that document seems to have a fairly accurate, if a bit vague, description of the gpios property\ avg: BTW, that document seems to have a fairly accurate, if a bit vague, description of the `gpios`… | |||||
The | |||||
.Nm | |||||
driver supports two properties for specifying a key code. | |||||
.Pp | |||||
The property | |||||
.Va freebsd,code | |||||
specifies a | |||||
.Fx | |||||
native scancode compatible with | |||||
.Xr kbdmap 5 | |||||
keyboard maps. | |||||
.Pp | |||||
The property | |||||
.Va linux,code | |||||
specifies an evdev scancode. | |||||
That scancode is internally translated to a native scancode. | |||||
Note that not all evdev scancodes have corresponding native scancodes. | |||||
If a scancode cannot be translated, then a diagnostic message is printed | |||||
and the input is ignored. | |||||
.Pp | |||||
The property | |||||
.Va label | |||||
is a descriptive name of a button. | |||||
It is used for diagnostic messages only. | |||||
Its alternative spelling is | |||||
.Va name . | |||||
.Pp | |||||
The property | |||||
.Va autorepeat | |||||
determines whether autorepeat is enabled for a button. | |||||
.Pp | |||||
The property | |||||
.Va debounce-interval | |||||
defines debouncing interval time in milliseconds. | |||||
If not specified the interval defaults to 5. | |||||
.Sh SEE ALSO | |||||
.Xr fdt 4 , | |||||
.Xr gpio 4 , | |||||
.Xr kbdmap 5 , | |||||
.Xr keyboard 4 , | |||||
.Sh HISTORY | |||||
The | |||||
.Nm | |||||
manual page first appeared in | |||||
.Fx 12.2 . | |||||
.Sh AUTHORS | |||||
The | |||||
.Nm | |||||
driver was written by | |||||
.An Oleksandr Tymoshenko Aq Mt gonzo@FreeBSD.org . | |||||
This | |||||
manual page was written by | |||||
.An Andriy Gapon Aq Mt avg@FreeBSD.org . |
This sounds weird to me, I think that s/FDT/DTS/ would sound better.