Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
5fd543ef
Commit
5fd543ef
authored
Jun 13, 2003
by
Vojtech Pavlik
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
cecd4820
f739babf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
Documentation/input/input-programming.txt
Documentation/input/input-programming.txt
+8
-8
No files found.
Documentation/input/input-programming.txt
View file @
5fd543ef
...
...
@@ -146,7 +146,7 @@ static int __init button_init(void)
Note the button_used variable - we have to track how many times the open
function was called to know when exactly our device stops being used.
The open() callback should return a 0 in case of succes or any nonzero value
The open() callback should return a 0 in case of succes
s
or any nonzero value
in case of failure. The close() callback (which is void) must always succeed.
1.3 Basic event types
...
...
@@ -178,7 +178,7 @@ set the corresponding bits and call the
function. Events are generated only for nonzero value.
However EV_ABS requires a little special care. Before calling
input_register_device
s
, you have to fill additional fields in the input_dev
input_register_device, you have to fill additional fields in the input_dev
struct for each absolute axis your device has. If our button device had also
the ABS_X axis:
...
...
@@ -207,11 +207,11 @@ one device. You'll need it in the open and close callbacks.
1.5 NBITS(), LONG(), BIT()
~~~~~~~~~~~~~~~~~~~~~~~~~~
These three macros fr
in
input.h help some bitfield computations:
These three macros fr
om
input.h help some bitfield computations:
NBITS(x) - returns the length of a bitfield array in longs for x bits
LONG(x) - returns the index in the array in longs for bit x
BIT(x) - returns the inde
s
in a long for bit x
BIT(x) - returns the inde
x
in a long for bit x
1.6 The number, id* and name fields
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
...
@@ -221,7 +221,7 @@ is registered. It has no use except for identifying the device to the user
in system messages.
The dev->name should be set before registering the input device by the input
device driver. It's a string like 'Generic button device' containing a
n
device driver. It's a string like 'Generic button device' containing a
user friendly name of the device.
The id* fields contain the bus ID (PCI, USB, ...), vendor ID and device ID
...
...
@@ -237,7 +237,7 @@ The id and name fields can be passed to userland via the evdev interface.
1.7 The keycode, keycodemax, keycodesize fields
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
These two fields will be used for any inpu
r
devices that report their data
These two fields will be used for any inpu
t
devices that report their data
as scancodes. If not all scancodes can be known by autodetection, they may
need to be set by userland utilities. The keycode array then is an array
used to map from scancodes to input system keycodes. The keycode max will
...
...
@@ -258,7 +258,7 @@ handled by the input system.
The other event types up to now are:
EV_LED - used for the keyboad LEDs.
EV_LED - used for the keyboa
r
d LEDs.
EV_SND - used for keyboard beeps.
They are very similar to for example key events, but they go in the other
...
...
@@ -270,7 +270,7 @@ driver can handle these events, it has to set the respective bits in evbit,
int button_event(struct input_dev *dev, unsigned int type, unsigned int code, int value);
{
if (type == EV_SND && code ==
EV
_BELL) {
if (type == EV_SND && code ==
SND
_BELL) {
outb(value, BUTTON_BELL);
return 0;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment