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
2b271cdb
Commit
2b271cdb
authored
Jul 30, 2002
by
Brad Hards
Committed by
Vojtech Pavlik
Jul 30, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change the EVIOC?ABS ioctls to use structs rather than arrays of ints.
parent
75eb18b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
12 deletions
+27
-12
drivers/input/evdev.c
drivers/input/evdev.c
+17
-10
include/linux/input.h
include/linux/input.h
+10
-2
No files found.
drivers/input/evdev.c
View file @
2b271cdb
...
...
@@ -233,6 +233,7 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
struct
evdev_list
*
list
=
file
->
private_data
;
struct
evdev
*
evdev
=
list
->
evdev
;
struct
input_dev
*
dev
=
evdev
->
handle
.
dev
;
struct
input_absinfo
abs
;
int
t
,
u
;
if
(
!
evdev
->
exist
)
return
-
ENODEV
;
...
...
@@ -378,11 +379,14 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
int
t
=
_IOC_NR
(
cmd
)
&
ABS_MAX
;
if
(
put_user
(
dev
->
abs
[
t
],
((
int
*
)
arg
)
+
0
))
return
-
EFAULT
;
if
(
put_user
(
dev
->
absmin
[
t
],
((
int
*
)
arg
)
+
1
))
return
-
EFAULT
;
if
(
put_user
(
dev
->
absmax
[
t
],
((
int
*
)
arg
)
+
2
))
return
-
EFAULT
;
if
(
put_user
(
dev
->
absfuzz
[
t
],
((
int
*
)
arg
)
+
3
))
return
-
EFAULT
;
if
(
put_user
(
dev
->
absflat
[
t
],
((
int
*
)
arg
)
+
4
))
return
-
EFAULT
;
abs
.
value
=
dev
->
abs
[
t
];
abs
.
minimum
=
dev
->
absmin
[
t
];
abs
.
maximum
=
dev
->
absmax
[
t
];
abs
.
fuzz
=
dev
->
absfuzz
[
t
];
abs
.
flat
=
dev
->
absflat
[
t
];
if
(
copy_to_user
((
void
*
)
arg
,
&
abs
,
sizeof
(
struct
input_absinfo
)))
return
-
EFAULT
;
return
0
;
}
...
...
@@ -391,11 +395,14 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
int
t
=
_IOC_NR
(
cmd
)
&
ABS_MAX
;
if
(
get_user
(
dev
->
abs
[
t
],
((
int
*
)
arg
)
+
0
))
return
-
EFAULT
;
if
(
get_user
(
dev
->
absmin
[
t
],
((
int
*
)
arg
)
+
1
))
return
-
EFAULT
;
if
(
get_user
(
dev
->
absmax
[
t
],
((
int
*
)
arg
)
+
2
))
return
-
EFAULT
;
if
(
get_user
(
dev
->
absfuzz
[
t
],
((
int
*
)
arg
)
+
3
))
return
-
EFAULT
;
if
(
get_user
(
dev
->
absflat
[
t
],
((
int
*
)
arg
)
+
4
))
return
-
EFAULT
;
if
(
copy_from_user
(
&
abs
,
(
void
*
)
arg
,
sizeof
(
struct
input_absinfo
)))
return
-
EFAULT
;
dev
->
abs
[
t
]
=
abs
.
value
;
dev
->
absmin
[
t
]
=
abs
.
minimum
;
dev
->
absmax
[
t
]
=
abs
.
maximum
;
dev
->
absfuzz
[
t
]
=
abs
.
fuzz
;
dev
->
absflat
[
t
]
=
abs
.
flat
;
return
0
;
}
...
...
include/linux/input.h
View file @
2b271cdb
...
...
@@ -63,6 +63,14 @@ struct input_id {
__u16
version
;
};
struct
input_absinfo
{
int
value
;
int
minimum
;
int
maximum
;
int
fuzz
;
int
flat
;
};
#define EVIOCGVERSION _IOR('E', 0x01, int)
/* get driver version */
#define EVIOCGID _IOR('E', 0x02, struct input_id)
/* get device ID */
#define EVIOCGREP _IOR('E', 0x03, int[2])
/* get repeat settings */
...
...
@@ -79,8 +87,8 @@ struct input_id {
#define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len)
/* get all sounds status */
#define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + ev, len)
/* get event bits */
#define EVIOCGABS(abs) _IOR('E', 0x40 + abs,
int[5]
)
/* get abs value/limits */
#define EVIOCSABS(abs) _IOW('E', 0xc0 + abs,
int[5]
)
/* set abs value/limits */
#define EVIOCGABS(abs) _IOR('E', 0x40 + abs,
struct input_absinfo
)
/* get abs value/limits */
#define EVIOCSABS(abs) _IOW('E', 0xc0 + abs,
struct input_absinfo
)
/* set abs value/limits */
#define EVIOCSFF _IOC(_IOC_WRITE, 'E', 0x80, sizeof(struct ff_effect))
/* send a force effect to a force feedback device */
#define EVIOCRMFF _IOW('E', 0x81, int)
/* Erase a force effect */
...
...
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