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
nexedi
linux
Commits
471c2ba6
Commit
471c2ba6
authored
Aug 27, 2002
by
Vojtech Pavlik
Browse files
Options
Browse Files
Download
Plain Diff
Merge
bk://ldm.bkbits.net/linux-2.5-input
into suse.cz:/home/vojtech/bk/pat
parents
47bfc88a
34151589
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
95 additions
and
112 deletions
+95
-112
drivers/char/keyboard.c
drivers/char/keyboard.c
+31
-15
drivers/input/input.c
drivers/input/input.c
+45
-85
drivers/input/mousedev.c
drivers/input/mousedev.c
+6
-6
include/linux/input.h
include/linux/input.h
+13
-6
No files found.
drivers/char/keyboard.c
View file @
471c2ba6
...
@@ -161,11 +161,16 @@ static int sysrq_alt;
...
@@ -161,11 +161,16 @@ static int sysrq_alt;
*/
*/
int
getkeycode
(
unsigned
int
scancode
)
int
getkeycode
(
unsigned
int
scancode
)
{
{
struct
input_handle
*
handl
e
;
struct
list_head
*
nod
e
;
struct
input_dev
*
dev
=
NULL
;
struct
input_dev
*
dev
=
NULL
;
for
(
handle
=
kbd_handler
.
handle
;
handle
;
handle
=
handle
->
hnext
)
list_for_each
(
node
,
&
kbd_handler
.
h_list
)
{
if
(
handle
->
dev
->
keycodesize
)
{
dev
=
handle
->
dev
;
break
;
}
struct
input_handle
*
handle
=
to_handle_h
(
node
);
if
(
handle
->
dev
->
keycodesize
)
{
dev
=
handle
->
dev
;
break
;
}
}
if
(
!
dev
)
if
(
!
dev
)
return
-
ENODEV
;
return
-
ENODEV
;
...
@@ -178,12 +183,17 @@ int getkeycode(unsigned int scancode)
...
@@ -178,12 +183,17 @@ int getkeycode(unsigned int scancode)
int
setkeycode
(
unsigned
int
scancode
,
unsigned
int
keycode
)
int
setkeycode
(
unsigned
int
scancode
,
unsigned
int
keycode
)
{
{
struct
input_handle
*
handl
e
;
struct
list_head
*
nod
e
;
struct
input_dev
*
dev
=
NULL
;
struct
input_dev
*
dev
=
NULL
;
int
i
,
oldkey
;
int
i
,
oldkey
;
for
(
handle
=
kbd_handler
.
handle
;
handle
;
handle
=
handle
->
hnext
)
list_for_each
(
node
,
&
kbd_handler
.
h_list
)
{
if
(
handle
->
dev
->
keycodesize
)
{
dev
=
handle
->
dev
;
break
;
}
struct
input_handle
*
handle
=
to_handle_h
(
node
);
if
(
handle
->
dev
->
keycodesize
)
{
dev
=
handle
->
dev
;
break
;
}
}
if
(
!
dev
)
if
(
!
dev
)
return
-
ENODEV
;
return
-
ENODEV
;
...
@@ -209,27 +219,30 @@ int setkeycode(unsigned int scancode, unsigned int keycode)
...
@@ -209,27 +219,30 @@ int setkeycode(unsigned int scancode, unsigned int keycode)
*/
*/
static
void
kd_nosound
(
unsigned
long
ignored
)
static
void
kd_nosound
(
unsigned
long
ignored
)
{
{
struct
input_handle
*
handl
e
;
struct
list_head
*
nod
e
;
for
(
handle
=
kbd_handler
.
handle
;
handle
;
handle
=
handle
->
hnext
)
list_for_each
(
node
,
&
kbd_handler
.
h_list
)
{
struct
input_handle
*
handle
=
to_handle_h
(
node
);
if
(
test_bit
(
EV_SND
,
handle
->
dev
->
evbit
))
{
if
(
test_bit
(
EV_SND
,
handle
->
dev
->
evbit
))
{
if
(
test_bit
(
SND_TONE
,
handle
->
dev
->
sndbit
))
if
(
test_bit
(
SND_TONE
,
handle
->
dev
->
sndbit
))
input_event
(
handle
->
dev
,
EV_SND
,
SND_TONE
,
0
);
input_event
(
handle
->
dev
,
EV_SND
,
SND_TONE
,
0
);
if
(
test_bit
(
SND_BELL
,
handle
->
dev
->
sndbit
))
if
(
test_bit
(
SND_BELL
,
handle
->
dev
->
sndbit
))
input_event
(
handle
->
dev
,
EV_SND
,
SND_BELL
,
0
);
input_event
(
handle
->
dev
,
EV_SND
,
SND_BELL
,
0
);
}
}
}
}
}
static
struct
timer_list
kd_mksound_timer
=
{
function
:
kd_nosound
};
static
struct
timer_list
kd_mksound_timer
=
{
function
:
kd_nosound
};
void
kd_mksound
(
unsigned
int
hz
,
unsigned
int
ticks
)
void
kd_mksound
(
unsigned
int
hz
,
unsigned
int
ticks
)
{
{
struct
input_handle
*
handl
e
;
struct
list_head
*
nod
e
;
del_timer
(
&
kd_mksound_timer
);
del_timer
(
&
kd_mksound_timer
);
if
(
hz
)
{
if
(
hz
)
{
for
(
handle
=
kbd_handler
.
handle
;
handle
;
handle
=
handle
->
hnext
)
list_for_each
(
node
,
&
kbd_handler
.
h_list
)
{
struct
input_handle
*
handle
=
to_handle_h
(
node
);
if
(
test_bit
(
EV_SND
,
handle
->
dev
->
evbit
))
{
if
(
test_bit
(
EV_SND
,
handle
->
dev
->
evbit
))
{
if
(
test_bit
(
SND_TONE
,
handle
->
dev
->
sndbit
))
{
if
(
test_bit
(
SND_TONE
,
handle
->
dev
->
sndbit
))
{
input_event
(
handle
->
dev
,
EV_SND
,
SND_TONE
,
hz
);
input_event
(
handle
->
dev
,
EV_SND
,
SND_TONE
,
hz
);
...
@@ -240,6 +253,7 @@ void kd_mksound(unsigned int hz, unsigned int ticks)
...
@@ -240,6 +253,7 @@ void kd_mksound(unsigned int hz, unsigned int ticks)
break
;
break
;
}
}
}
}
}
if
(
ticks
)
if
(
ticks
)
mod_timer
(
&
kd_mksound_timer
,
jiffies
+
ticks
);
mod_timer
(
&
kd_mksound_timer
,
jiffies
+
ticks
);
}
else
}
else
...
@@ -251,12 +265,13 @@ void kd_mksound(unsigned int hz, unsigned int ticks)
...
@@ -251,12 +265,13 @@ void kd_mksound(unsigned int hz, unsigned int ticks)
*/
*/
int
kbd_rate
(
struct
kbd_repeat
*
rep
)
int
kbd_rate
(
struct
kbd_repeat
*
rep
)
{
{
struct
input_handle
*
handl
e
;
struct
list_head
*
nod
e
;
if
(
rep
->
rate
<
0
||
rep
->
delay
<
0
)
if
(
rep
->
rate
<
0
||
rep
->
delay
<
0
)
return
-
EINVAL
;
return
-
EINVAL
;
for
(
handle
=
kbd_handler
.
handle
;
handle
;
handle
=
handle
->
hnext
)
list_for_each
(
node
,
&
kbd_handler
.
h_list
)
{
struct
input_handle
*
handle
=
to_handle_h
(
node
);
if
(
test_bit
(
EV_REP
,
handle
->
dev
->
evbit
))
{
if
(
test_bit
(
EV_REP
,
handle
->
dev
->
evbit
))
{
if
(
rep
->
rate
>
HZ
)
rep
->
rate
=
HZ
;
if
(
rep
->
rate
>
HZ
)
rep
->
rate
=
HZ
;
handle
->
dev
->
rep
[
REP_PERIOD
]
=
rep
->
rate
?
(
HZ
/
rep
->
rate
)
:
0
;
handle
->
dev
->
rep
[
REP_PERIOD
]
=
rep
->
rate
?
(
HZ
/
rep
->
rate
)
:
0
;
...
@@ -264,7 +279,7 @@ int kbd_rate(struct kbd_repeat *rep)
...
@@ -264,7 +279,7 @@ int kbd_rate(struct kbd_repeat *rep)
if
(
handle
->
dev
->
rep
[
REP_DELAY
]
<
handle
->
dev
->
rep
[
REP_PERIOD
])
if
(
handle
->
dev
->
rep
[
REP_DELAY
]
<
handle
->
dev
->
rep
[
REP_PERIOD
])
handle
->
dev
->
rep
[
REP_DELAY
]
=
handle
->
dev
->
rep
[
REP_PERIOD
];
handle
->
dev
->
rep
[
REP_DELAY
]
=
handle
->
dev
->
rep
[
REP_PERIOD
];
}
}
}
return
0
;
return
0
;
}
}
...
@@ -874,11 +889,12 @@ static inline unsigned char getleds(void)
...
@@ -874,11 +889,12 @@ static inline unsigned char getleds(void)
static
void
kbd_bh
(
unsigned
long
dummy
)
static
void
kbd_bh
(
unsigned
long
dummy
)
{
{
struct
input_handle
*
handle
;
struct
list_head
*
node
;
unsigned
char
leds
=
getleds
();
unsigned
char
leds
=
getleds
();
if
(
leds
!=
ledstate
)
{
if
(
leds
!=
ledstate
)
{
for
(
handle
=
kbd_handler
.
handle
;
handle
;
handle
=
handle
->
hnext
)
{
list_for_each
(
node
,
&
kbd_handler
.
h_list
)
{
struct
input_handle
*
handle
=
to_handle_h
(
node
);
input_event
(
handle
->
dev
,
EV_LED
,
LED_SCROLLL
,
!!
(
leds
&
0x01
));
input_event
(
handle
->
dev
,
EV_LED
,
LED_SCROLLL
,
!!
(
leds
&
0x01
));
input_event
(
handle
->
dev
,
EV_LED
,
LED_NUML
,
!!
(
leds
&
0x02
));
input_event
(
handle
->
dev
,
EV_LED
,
LED_NUML
,
!!
(
leds
&
0x02
));
input_event
(
handle
->
dev
,
EV_LED
,
LED_CAPSL
,
!!
(
leds
&
0x04
));
input_event
(
handle
->
dev
,
EV_LED
,
LED_CAPSL
,
!!
(
leds
&
0x04
));
...
...
drivers/input/input.c
View file @
471c2ba6
...
@@ -58,8 +58,9 @@ EXPORT_SYMBOL(input_event);
...
@@ -58,8 +58,9 @@ EXPORT_SYMBOL(input_event);
#define INPUT_MAJOR 13
#define INPUT_MAJOR 13
#define INPUT_DEVICES 256
#define INPUT_DEVICES 256
static
struct
input_dev
*
input_dev
;
static
LIST_HEAD
(
input_dev_list
);
static
struct
input_handler
*
input_handler
;
static
LIST_HEAD
(
input_handler_list
);
static
struct
input_handler
*
input_table
[
8
];
static
struct
input_handler
*
input_table
[
8
];
static
devfs_handle_t
input_devfs_handle
;
static
devfs_handle_t
input_devfs_handle
;
...
@@ -69,9 +70,10 @@ DECLARE_WAIT_QUEUE_HEAD(input_devices_poll_wait);
...
@@ -69,9 +70,10 @@ DECLARE_WAIT_QUEUE_HEAD(input_devices_poll_wait);
static
int
input_devices_state
;
static
int
input_devices_state
;
#endif
#endif
void
input_event
(
struct
input_dev
*
dev
,
unsigned
int
type
,
unsigned
int
code
,
int
value
)
void
input_event
(
struct
input_dev
*
dev
,
unsigned
int
type
,
unsigned
int
code
,
int
value
)
{
{
struct
input_handle
*
handle
=
dev
->
handl
e
;
struct
list_head
*
nod
e
;
if
(
dev
->
pm_dev
)
if
(
dev
->
pm_dev
)
pm_access
(
dev
->
pm_dev
);
pm_access
(
dev
->
pm_dev
);
...
@@ -190,10 +192,10 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in
...
@@ -190,10 +192,10 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in
if
(
type
!=
EV_SYN
)
if
(
type
!=
EV_SYN
)
dev
->
sync
=
0
;
dev
->
sync
=
0
;
while
(
handle
)
{
list_for_each
(
node
,
&
dev
->
h_list
)
{
struct
input_handle
*
handle
=
to_handle
(
node
);
if
(
handle
->
open
)
if
(
handle
->
open
)
handle
->
handler
->
event
(
handle
,
type
,
code
,
value
);
handle
->
handler
->
event
(
handle
,
type
,
code
,
value
);
handle
=
handle
->
dnext
;
}
}
}
}
...
@@ -247,41 +249,8 @@ void input_close_device(struct input_handle *handle)
...
@@ -247,41 +249,8 @@ void input_close_device(struct input_handle *handle)
static
void
input_link_handle
(
struct
input_handle
*
handle
)
static
void
input_link_handle
(
struct
input_handle
*
handle
)
{
{
handle
->
dnext
=
handle
->
dev
->
handle
;
list_add_tail
(
&
handle
->
d_node
,
&
handle
->
dev
->
h_list
);
handle
->
hnext
=
handle
->
handler
->
handle
;
list_add_tail
(
&
handle
->
h_node
,
&
handle
->
handler
->
h_list
);
handle
->
dev
->
handle
=
handle
;
handle
->
handler
->
handle
=
handle
;
}
/**
* input_find_and_remove - Find and remove node
*
* @type: data type
* @initval: initial value
* @targ: node to find
* @next: next node in the list
*
* Searches the linked list for the target node @targ. If the node
* is found, it is removed from the list.
*
* If the node is not found, the end of the list will be hit,
* indicating that it wasn't in the list to begin with.
*
* Returns nothing.
*/
#define input_find_and_remove(type, initval, targ, next) \
do { \
type **ptr; \
for (ptr = &initval; *ptr; ptr = &((*ptr)->next)) \
if (*ptr == targ) break; \
if (*ptr) *ptr = (*ptr)->next; \
} while (0)
static
void
input_unlink_handle
(
struct
input_handle
*
handle
)
{
input_find_and_remove
(
struct
input_handle
,
handle
->
dev
->
handle
,
handle
,
dnext
);
input_find_and_remove
(
struct
input_handle
,
handle
->
handler
->
handle
,
handle
,
hnext
);
}
}
#define MATCH_BIT(bit, max) \
#define MATCH_BIT(bit, max) \
...
@@ -442,7 +411,7 @@ static void input_call_hotplug(char *verb, struct input_dev *dev)
...
@@ -442,7 +411,7 @@ static void input_call_hotplug(char *verb, struct input_dev *dev)
void
input_register_device
(
struct
input_dev
*
dev
)
void
input_register_device
(
struct
input_dev
*
dev
)
{
{
struct
input_handler
*
handler
=
input_handler
;
struct
list_head
*
node
;
struct
input_handle
*
handle
;
struct
input_handle
*
handle
;
struct
input_device_id
*
id
;
struct
input_device_id
*
id
;
...
@@ -465,19 +434,17 @@ void input_register_device(struct input_dev *dev)
...
@@ -465,19 +434,17 @@ void input_register_device(struct input_dev *dev)
/*
/*
* Add the device.
* Add the device.
*/
*/
INIT_LIST_HEAD
(
&
dev
->
h_list
);
dev
->
next
=
input_dev
;
list_add_tail
(
&
dev
->
node
,
&
input_dev_list
);
input_dev
=
dev
;
/*
/*
* Notify handlers.
* Notify handlers.
*/
*/
list_for_each
(
node
,
&
input_handler_list
)
{
while
(
handler
)
{
struct
input_handler
*
handler
=
to_handler
(
node
);
if
((
id
=
input_match_device
(
handler
->
id_table
,
dev
)))
if
((
id
=
input_match_device
(
handler
->
id_table
,
dev
)))
if
((
handle
=
handler
->
connect
(
handler
,
dev
,
id
)))
if
((
handle
=
handler
->
connect
(
handler
,
dev
,
id
)))
input_link_handle
(
handle
);
input_link_handle
(
handle
);
handler
=
handler
->
next
;
}
}
/*
/*
...
@@ -500,8 +467,7 @@ void input_register_device(struct input_dev *dev)
...
@@ -500,8 +467,7 @@ void input_register_device(struct input_dev *dev)
void
input_unregister_device
(
struct
input_dev
*
dev
)
void
input_unregister_device
(
struct
input_dev
*
dev
)
{
{
struct
input_handle
*
handle
=
dev
->
handle
;
struct
list_head
*
node
,
*
next
;
struct
input_handle
*
dnext
;
if
(
!
dev
)
return
;
if
(
!
dev
)
return
;
...
@@ -521,11 +487,11 @@ void input_unregister_device(struct input_dev *dev)
...
@@ -521,11 +487,11 @@ void input_unregister_device(struct input_dev *dev)
* Notify handlers.
* Notify handlers.
*/
*/
while
(
handle
)
{
list_for_each_safe
(
node
,
next
,
&
dev
->
h_list
)
{
dnext
=
handle
->
dnext
;
struct
input_handle
*
handle
=
to_handle
(
node
);
input_unlink_handle
(
handle
);
list_del_init
(
&
handle
->
d_node
);
list_del_init
(
&
handle
->
h_node
);
handle
->
handler
->
disconnect
(
handle
);
handle
->
handler
->
disconnect
(
handle
);
handle
=
dnext
;
}
}
/*
/*
...
@@ -539,7 +505,7 @@ void input_unregister_device(struct input_dev *dev)
...
@@ -539,7 +505,7 @@ void input_unregister_device(struct input_dev *dev)
/*
/*
* Remove the device.
* Remove the device.
*/
*/
input_find_and_remove
(
struct
input_dev
,
input_dev
,
dev
,
next
);
list_del_init
(
&
dev
->
node
);
/*
/*
* Notify /proc.
* Notify /proc.
...
@@ -553,12 +519,13 @@ void input_unregister_device(struct input_dev *dev)
...
@@ -553,12 +519,13 @@ void input_unregister_device(struct input_dev *dev)
void
input_register_handler
(
struct
input_handler
*
handler
)
void
input_register_handler
(
struct
input_handler
*
handler
)
{
{
struct
input_dev
*
dev
=
input_dev
;
struct
list_head
*
node
;
struct
input_handle
*
handle
;
struct
input_handle
*
handle
;
struct
input_device_id
*
id
;
struct
input_device_id
*
id
;
if
(
!
handler
)
return
;
if
(
!
handler
)
return
;
INIT_LIST_HEAD
(
&
handler
->
h_list
);
/*
/*
* Add minors if needed.
* Add minors if needed.
*/
*/
...
@@ -569,19 +536,17 @@ void input_register_handler(struct input_handler *handler)
...
@@ -569,19 +536,17 @@ void input_register_handler(struct input_handler *handler)
/*
/*
* Add the handler.
* Add the handler.
*/
*/
list_add_tail
(
&
handler
->
node
,
&
input_handler_list
);
handler
->
next
=
input_handler
;
input_handler
=
handler
;
/*
/*
* Notify it about all existing devices.
* Notify it about all existing devices.
*/
*/
while
(
dev
)
{
list_for_each
(
node
,
&
input_dev_list
)
{
struct
input_dev
*
dev
=
to_dev
(
node
);
if
((
id
=
input_match_device
(
handler
->
id_table
,
dev
)))
if
((
id
=
input_match_device
(
handler
->
id_table
,
dev
)))
if
((
handle
=
handler
->
connect
(
handler
,
dev
,
id
)))
if
((
handle
=
handler
->
connect
(
handler
,
dev
,
id
)))
input_link_handle
(
handle
);
input_link_handle
(
handle
);
dev
=
dev
->
next
;
}
}
/*
/*
...
@@ -596,25 +561,23 @@ void input_register_handler(struct input_handler *handler)
...
@@ -596,25 +561,23 @@ void input_register_handler(struct input_handler *handler)
void
input_unregister_handler
(
struct
input_handler
*
handler
)
void
input_unregister_handler
(
struct
input_handler
*
handler
)
{
{
struct
input_handle
*
handle
=
handler
->
handle
;
struct
list_head
*
node
,
*
next
;
struct
input_handle
*
hnext
;
/*
/*
* Tell the handler to disconnect from all devices it keeps open.
* Tell the handler to disconnect from all devices it keeps open.
*/
*/
list_for_each_safe
(
node
,
next
,
&
handler
->
h_list
)
{
while
(
handle
)
{
struct
input_handle
*
handle
=
to_handle_h
(
node
);
hnext
=
handle
->
hnext
;
list_del_init
(
&
handle
->
h_node
)
;
input_unlink_handle
(
handl
e
);
list_del_init
(
&
handle
->
d_nod
e
);
handler
->
disconnect
(
handle
);
handler
->
disconnect
(
handle
);
handle
=
hnext
;
}
}
/*
/*
* Remove it.
* Remove it.
*/
*/
input_find_and_remove
(
struct
input_handler
,
input_handler
,
handler
,
list_del_init
(
&
handler
->
node
);
next
);
/*
/*
* Remove minors.
* Remove minors.
...
@@ -715,13 +678,14 @@ static unsigned int input_devices_poll(struct file *file, poll_table *wait)
...
@@ -715,13 +678,14 @@ static unsigned int input_devices_poll(struct file *file, poll_table *wait)
static
int
input_devices_read
(
char
*
buf
,
char
**
start
,
off_t
pos
,
int
count
,
int
*
eof
,
void
*
data
)
static
int
input_devices_read
(
char
*
buf
,
char
**
start
,
off_t
pos
,
int
count
,
int
*
eof
,
void
*
data
)
{
{
struct
input_dev
*
dev
=
input_dev
;
struct
list_head
*
node
;
struct
input_handle
*
handle
;
off_t
at
=
0
;
off_t
at
=
0
;
int
i
,
len
,
cnt
=
0
;
int
i
,
len
,
cnt
=
0
;
while
(
dev
)
{
list_for_each
(
node
,
&
input_dev_list
)
{
struct
input_dev
*
dev
=
to_dev
(
node
);
struct
list_head
*
hnode
;
len
=
sprintf
(
buf
,
"I: Bus=%04x Vendor=%04x Product=%04x Version=%04x
\n
"
,
len
=
sprintf
(
buf
,
"I: Bus=%04x Vendor=%04x Product=%04x Version=%04x
\n
"
,
dev
->
id
.
bustype
,
dev
->
id
.
vendor
,
dev
->
id
.
product
,
dev
->
id
.
version
);
dev
->
id
.
bustype
,
dev
->
id
.
vendor
,
dev
->
id
.
product
,
dev
->
id
.
version
);
...
@@ -730,11 +694,9 @@ static int input_devices_read(char *buf, char **start, off_t pos, int count, int
...
@@ -730,11 +694,9 @@ static int input_devices_read(char *buf, char **start, off_t pos, int count, int
len
+=
sprintf
(
buf
+
len
,
"P: Phys=%s
\n
"
,
dev
->
phys
?
dev
->
phys
:
""
);
len
+=
sprintf
(
buf
+
len
,
"P: Phys=%s
\n
"
,
dev
->
phys
?
dev
->
phys
:
""
);
len
+=
sprintf
(
buf
+
len
,
"D: Drivers="
);
len
+=
sprintf
(
buf
+
len
,
"D: Drivers="
);
handle
=
dev
->
handle
;
list_for_each
(
hnode
,
&
dev
->
h_list
)
{
struct
input_handle
*
handle
=
to_handle
(
hnode
);
while
(
handle
)
{
len
+=
sprintf
(
buf
+
len
,
"%s "
,
handle
->
name
);
len
+=
sprintf
(
buf
+
len
,
"%s "
,
handle
->
name
);
handle
=
handle
->
dnext
;
}
}
len
+=
sprintf
(
buf
+
len
,
"
\n
"
);
len
+=
sprintf
(
buf
+
len
,
"
\n
"
);
...
@@ -761,24 +723,24 @@ static int input_devices_read(char *buf, char **start, off_t pos, int count, int
...
@@ -761,24 +723,24 @@ static int input_devices_read(char *buf, char **start, off_t pos, int count, int
if
(
cnt
>=
count
)
if
(
cnt
>=
count
)
break
;
break
;
}
}
dev
=
dev
->
next
;
}
}
if
(
!
dev
)
*
eof
=
1
;
if
(
node
==
&
input_dev_list
)
*
eof
=
1
;
return
(
count
>
cnt
)
?
cnt
:
count
;
return
(
count
>
cnt
)
?
cnt
:
count
;
}
}
static
int
input_handlers_read
(
char
*
buf
,
char
**
start
,
off_t
pos
,
int
count
,
int
*
eof
,
void
*
data
)
static
int
input_handlers_read
(
char
*
buf
,
char
**
start
,
off_t
pos
,
int
count
,
int
*
eof
,
void
*
data
)
{
{
struct
input_handler
*
handler
=
input_handler
;
struct
list_head
*
node
;
off_t
at
=
0
;
off_t
at
=
0
;
int
len
=
0
,
cnt
=
0
;
int
len
=
0
,
cnt
=
0
;
int
i
=
0
;
int
i
=
0
;
while
(
handler
)
{
list_for_each
(
node
,
&
input_handler_list
)
{
struct
input_handler
*
handler
=
to_handler
(
node
);
if
(
handler
->
fops
)
if
(
handler
->
fops
)
len
=
sprintf
(
buf
,
"N: Number=%d Name=%s Minor=%d
\n
"
,
len
=
sprintf
(
buf
,
"N: Number=%d Name=%s Minor=%d
\n
"
,
...
@@ -798,11 +760,9 @@ static int input_handlers_read(char *buf, char **start, off_t pos, int count, in
...
@@ -798,11 +760,9 @@ static int input_handlers_read(char *buf, char **start, off_t pos, int count, in
if
(
cnt
>=
count
)
if
(
cnt
>=
count
)
break
;
break
;
}
}
handler
=
handler
->
next
;
}
}
if
(
node
==
&
input_handler_list
)
if
(
!
handler
)
*
eof
=
1
;
*
eof
=
1
;
return
(
count
>
cnt
)
?
cnt
:
count
;
return
(
count
>
cnt
)
?
cnt
:
count
;
}
}
...
...
drivers/input/mousedev.c
View file @
471c2ba6
...
@@ -200,8 +200,9 @@ static int mousedev_release(struct inode * inode, struct file * file)
...
@@ -200,8 +200,9 @@ static int mousedev_release(struct inode * inode, struct file * file)
if
(
!--
list
->
mousedev
->
open
)
{
if
(
!--
list
->
mousedev
->
open
)
{
if
(
list
->
mousedev
->
minor
==
MOUSEDEV_MIX
)
{
if
(
list
->
mousedev
->
minor
==
MOUSEDEV_MIX
)
{
struct
input_handle
*
handle
=
mousedev_handler
.
handle
;
struct
list_head
*
node
;
while
(
handle
)
{
list_for_each
(
node
,
&
mousedev_handler
.
h_list
)
{
struct
input_handle
*
handle
=
to_handle_h
(
node
);
struct
mousedev
*
mousedev
=
handle
->
private
;
struct
mousedev
*
mousedev
=
handle
->
private
;
if
(
!
mousedev
->
open
)
{
if
(
!
mousedev
->
open
)
{
if
(
mousedev
->
exist
)
{
if
(
mousedev
->
exist
)
{
...
@@ -212,7 +213,6 @@ static int mousedev_release(struct inode * inode, struct file * file)
...
@@ -212,7 +213,6 @@ static int mousedev_release(struct inode * inode, struct file * file)
kfree
(
mousedev
);
kfree
(
mousedev
);
}
}
}
}
handle
=
handle
->
hnext
;
}
}
}
else
{
}
else
{
if
(
!
mousedev_mix
.
open
)
{
if
(
!
mousedev_mix
.
open
)
{
...
@@ -258,13 +258,13 @@ static int mousedev_open(struct inode * inode, struct file * file)
...
@@ -258,13 +258,13 @@ static int mousedev_open(struct inode * inode, struct file * file)
if
(
!
list
->
mousedev
->
open
++
)
{
if
(
!
list
->
mousedev
->
open
++
)
{
if
(
list
->
mousedev
->
minor
==
MOUSEDEV_MIX
)
{
if
(
list
->
mousedev
->
minor
==
MOUSEDEV_MIX
)
{
struct
input_handle
*
handle
=
mousedev_handler
.
handle
;
struct
list_head
*
node
;
while
(
handle
)
{
list_for_each
(
node
,
&
mousedev_handler
.
h_list
)
{
struct
input_handle
*
handle
=
to_handle_h
(
node
);
struct
mousedev
*
mousedev
=
handle
->
private
;
struct
mousedev
*
mousedev
=
handle
->
private
;
if
(
!
mousedev
->
open
)
if
(
!
mousedev
->
open
)
if
(
mousedev
->
exist
)
if
(
mousedev
->
exist
)
input_open_device
(
handle
);
input_open_device
(
handle
);
handle
=
handle
->
hnext
;
}
}
}
else
{
}
else
{
if
(
!
mousedev_mix
.
open
)
if
(
!
mousedev_mix
.
open
)
...
...
include/linux/input.h
View file @
471c2ba6
...
@@ -811,8 +811,8 @@ struct input_dev {
...
@@ -811,8 +811,8 @@ struct input_dev {
int
(
*
upload_effect
)(
struct
input_dev
*
dev
,
struct
ff_effect
*
effect
);
int
(
*
upload_effect
)(
struct
input_dev
*
dev
,
struct
ff_effect
*
effect
);
int
(
*
erase_effect
)(
struct
input_dev
*
dev
,
int
effect_id
);
int
(
*
erase_effect
)(
struct
input_dev
*
dev
,
int
effect_id
);
struct
input_handle
*
handle
;
struct
list_head
h_list
;
struct
input_dev
*
next
;
struct
list_head
node
;
};
};
/*
/*
...
@@ -856,6 +856,8 @@ struct input_device_id {
...
@@ -856,6 +856,8 @@ struct input_device_id {
unsigned
long
driver_info
;
unsigned
long
driver_info
;
};
};
struct
input_handle
;
struct
input_handler
{
struct
input_handler
{
void
*
private
;
void
*
private
;
...
@@ -870,8 +872,8 @@ struct input_handler {
...
@@ -870,8 +872,8 @@ struct input_handler {
struct
input_device_id
*
id_table
;
struct
input_device_id
*
id_table
;
struct
input_handle
*
handle
;
struct
list_head
h_list
;
struct
input_handler
*
next
;
struct
list_head
node
;
};
};
struct
input_handle
{
struct
input_handle
{
...
@@ -884,10 +886,15 @@ struct input_handle {
...
@@ -884,10 +886,15 @@ struct input_handle {
struct
input_dev
*
dev
;
struct
input_dev
*
dev
;
struct
input_handler
*
handler
;
struct
input_handler
*
handler
;
struct
input_handle
*
dnext
;
struct
list_head
d_node
;
struct
input_handle
*
hnext
;
struct
list_head
h_node
;
};
};
#define to_dev(n) container_of(n,struct input_dev,node)
#define to_handler(n) container_of(n,struct input_handler,node);
#define to_handle(n) container_of(n,struct input_handle,d_node)
#define to_handle_h(n) container_of(n,struct input_handle,h_node)
void
input_register_device
(
struct
input_dev
*
);
void
input_register_device
(
struct
input_dev
*
);
void
input_unregister_device
(
struct
input_dev
*
);
void
input_unregister_device
(
struct
input_dev
*
);
...
...
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