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
ba521f1b
Commit
ba521f1b
authored
Mar 17, 2018
by
Dmitry Torokhov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'psmouse' into next
Merge various PS/2 handling improvements.
parents
83fc580d
3aceaa34
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
521 additions
and
396 deletions
+521
-396
drivers/input/mouse/alps.c
drivers/input/mouse/alps.c
+7
-23
drivers/input/mouse/elantech.c
drivers/input/mouse/elantech.c
+16
-24
drivers/input/mouse/lifebook.c
drivers/input/mouse/lifebook.c
+33
-29
drivers/input/mouse/logips2pp.c
drivers/input/mouse/logips2pp.c
+87
-65
drivers/input/mouse/psmouse-base.c
drivers/input/mouse/psmouse-base.c
+103
-86
drivers/input/mouse/psmouse.h
drivers/input/mouse/psmouse.h
+4
-1
drivers/input/mouse/sentelic.c
drivers/input/mouse/sentelic.c
+1
-10
drivers/input/mouse/synaptics.c
drivers/input/mouse/synaptics.c
+4
-4
drivers/input/mouse/trackpoint.c
drivers/input/mouse/trackpoint.c
+24
-36
drivers/input/serio/libps2.c
drivers/input/serio/libps2.c
+219
-103
include/linux/libps2.h
include/linux/libps2.h
+23
-15
No files found.
drivers/input/mouse/alps.c
View file @
ba521f1b
...
@@ -827,7 +827,7 @@ static void alps_process_packet_v6(struct psmouse *psmouse)
...
@@ -827,7 +827,7 @@ static void alps_process_packet_v6(struct psmouse *psmouse)
unsigned
char
*
packet
=
psmouse
->
packet
;
unsigned
char
*
packet
=
psmouse
->
packet
;
struct
input_dev
*
dev
=
psmouse
->
dev
;
struct
input_dev
*
dev
=
psmouse
->
dev
;
struct
input_dev
*
dev2
=
priv
->
dev2
;
struct
input_dev
*
dev2
=
priv
->
dev2
;
int
x
,
y
,
z
,
left
,
right
,
middle
;
int
x
,
y
,
z
;
/*
/*
* We can use Byte5 to distinguish if the packet is from Touchpad
* We can use Byte5 to distinguish if the packet is from Touchpad
...
@@ -847,9 +847,6 @@ static void alps_process_packet_v6(struct psmouse *psmouse)
...
@@ -847,9 +847,6 @@ static void alps_process_packet_v6(struct psmouse *psmouse)
x
=
packet
[
1
]
|
((
packet
[
3
]
&
0x20
)
<<
2
);
x
=
packet
[
1
]
|
((
packet
[
3
]
&
0x20
)
<<
2
);
y
=
packet
[
2
]
|
((
packet
[
3
]
&
0x40
)
<<
1
);
y
=
packet
[
2
]
|
((
packet
[
3
]
&
0x40
)
<<
1
);
z
=
packet
[
4
];
z
=
packet
[
4
];
left
=
packet
[
3
]
&
0x01
;
right
=
packet
[
3
]
&
0x02
;
middle
=
packet
[
3
]
&
0x04
;
/* To prevent the cursor jump when finger lifted */
/* To prevent the cursor jump when finger lifted */
if
(
x
==
0x7F
&&
y
==
0x7F
&&
z
==
0x7F
)
if
(
x
==
0x7F
&&
y
==
0x7F
&&
z
==
0x7F
)
...
@@ -859,9 +856,7 @@ static void alps_process_packet_v6(struct psmouse *psmouse)
...
@@ -859,9 +856,7 @@ static void alps_process_packet_v6(struct psmouse *psmouse)
input_report_rel
(
dev2
,
REL_X
,
(
char
)
x
/
4
);
input_report_rel
(
dev2
,
REL_X
,
(
char
)
x
/
4
);
input_report_rel
(
dev2
,
REL_Y
,
-
((
char
)
y
/
4
));
input_report_rel
(
dev2
,
REL_Y
,
-
((
char
)
y
/
4
));
input_report_key
(
dev2
,
BTN_LEFT
,
left
);
psmouse_report_standard_buttons
(
dev2
,
packet
[
3
]);
input_report_key
(
dev2
,
BTN_RIGHT
,
right
);
input_report_key
(
dev2
,
BTN_MIDDLE
,
middle
);
input_sync
(
dev2
);
input_sync
(
dev2
);
return
;
return
;
...
@@ -871,8 +866,6 @@ static void alps_process_packet_v6(struct psmouse *psmouse)
...
@@ -871,8 +866,6 @@ static void alps_process_packet_v6(struct psmouse *psmouse)
x
=
packet
[
1
]
|
((
packet
[
3
]
&
0x78
)
<<
4
);
x
=
packet
[
1
]
|
((
packet
[
3
]
&
0x78
)
<<
4
);
y
=
packet
[
2
]
|
((
packet
[
4
]
&
0x78
)
<<
4
);
y
=
packet
[
2
]
|
((
packet
[
4
]
&
0x78
)
<<
4
);
z
=
packet
[
5
];
z
=
packet
[
5
];
left
=
packet
[
3
]
&
0x01
;
right
=
packet
[
3
]
&
0x02
;
if
(
z
>
30
)
if
(
z
>
30
)
input_report_key
(
dev
,
BTN_TOUCH
,
1
);
input_report_key
(
dev
,
BTN_TOUCH
,
1
);
...
@@ -888,8 +881,8 @@ static void alps_process_packet_v6(struct psmouse *psmouse)
...
@@ -888,8 +881,8 @@ static void alps_process_packet_v6(struct psmouse *psmouse)
input_report_key
(
dev
,
BTN_TOOL_FINGER
,
z
>
0
);
input_report_key
(
dev
,
BTN_TOOL_FINGER
,
z
>
0
);
/* v6 touchpad does not have middle button */
/* v6 touchpad does not have middle button */
input_report_key
(
dev
,
BTN_LEFT
,
left
);
packet
[
3
]
&=
~
BIT
(
2
);
input_report_key
(
dev
,
BTN_RIGHT
,
right
);
psmouse_report_standard_buttons
(
dev2
,
packet
[
3
]
);
input_sync
(
dev
);
input_sync
(
dev
);
}
}
...
@@ -1098,7 +1091,7 @@ static void alps_process_trackstick_packet_v7(struct psmouse *psmouse)
...
@@ -1098,7 +1091,7 @@ static void alps_process_trackstick_packet_v7(struct psmouse *psmouse)
struct
alps_data
*
priv
=
psmouse
->
private
;
struct
alps_data
*
priv
=
psmouse
->
private
;
unsigned
char
*
packet
=
psmouse
->
packet
;
unsigned
char
*
packet
=
psmouse
->
packet
;
struct
input_dev
*
dev2
=
priv
->
dev2
;
struct
input_dev
*
dev2
=
priv
->
dev2
;
int
x
,
y
,
z
,
left
,
right
,
middle
;
int
x
,
y
,
z
;
/* It should be a DualPoint when received trackstick packet */
/* It should be a DualPoint when received trackstick packet */
if
(
!
(
priv
->
flags
&
ALPS_DUALPOINT
))
{
if
(
!
(
priv
->
flags
&
ALPS_DUALPOINT
))
{
...
@@ -1112,16 +1105,10 @@ static void alps_process_trackstick_packet_v7(struct psmouse *psmouse)
...
@@ -1112,16 +1105,10 @@ static void alps_process_trackstick_packet_v7(struct psmouse *psmouse)
((
packet
[
3
]
&
0x20
)
<<
1
);
((
packet
[
3
]
&
0x20
)
<<
1
);
z
=
(
packet
[
5
]
&
0x3f
)
|
((
packet
[
3
]
&
0x80
)
>>
1
);
z
=
(
packet
[
5
]
&
0x3f
)
|
((
packet
[
3
]
&
0x80
)
>>
1
);
left
=
(
packet
[
1
]
&
0x01
);
right
=
(
packet
[
1
]
&
0x02
)
>>
1
;
middle
=
(
packet
[
1
]
&
0x04
)
>>
2
;
input_report_rel
(
dev2
,
REL_X
,
(
char
)
x
);
input_report_rel
(
dev2
,
REL_X
,
(
char
)
x
);
input_report_rel
(
dev2
,
REL_Y
,
-
((
char
)
y
));
input_report_rel
(
dev2
,
REL_Y
,
-
((
char
)
y
));
input_report_key
(
dev2
,
BTN_LEFT
,
left
);
psmouse_report_standard_buttons
(
dev2
,
packet
[
1
]);
input_report_key
(
dev2
,
BTN_RIGHT
,
right
);
input_report_key
(
dev2
,
BTN_MIDDLE
,
middle
);
input_sync
(
dev2
);
input_sync
(
dev2
);
}
}
...
@@ -1503,10 +1490,7 @@ static void alps_report_bare_ps2_packet(struct psmouse *psmouse,
...
@@ -1503,10 +1490,7 @@ static void alps_report_bare_ps2_packet(struct psmouse *psmouse,
alps_report_buttons
(
dev
,
dev2
,
alps_report_buttons
(
dev
,
dev2
,
packet
[
0
]
&
1
,
packet
[
0
]
&
2
,
packet
[
0
]
&
4
);
packet
[
0
]
&
1
,
packet
[
0
]
&
2
,
packet
[
0
]
&
4
);
input_report_rel
(
dev
,
REL_X
,
psmouse_report_standard_motion
(
dev
,
packet
);
packet
[
1
]
?
packet
[
1
]
-
((
packet
[
0
]
<<
4
)
&
0x100
)
:
0
);
input_report_rel
(
dev
,
REL_Y
,
packet
[
2
]
?
((
packet
[
0
]
<<
3
)
&
0x100
)
-
packet
[
2
]
:
0
);
input_sync
(
dev
);
input_sync
(
dev
);
}
}
...
...
drivers/input/mouse/elantech.c
View file @
ba521f1b
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
static
int
synaptics_send_cmd
(
struct
psmouse
*
psmouse
,
unsigned
char
c
,
static
int
synaptics_send_cmd
(
struct
psmouse
*
psmouse
,
unsigned
char
c
,
unsigned
char
*
param
)
unsigned
char
*
param
)
{
{
if
(
ps
mouse_sliced_command
(
psmouse
,
c
)
||
if
(
ps
2_sliced_command
(
&
psmouse
->
ps2dev
,
c
)
||
ps2_command
(
&
psmouse
->
ps2dev
,
param
,
PSMOUSE_CMD_GETINFO
))
{
ps2_command
(
&
psmouse
->
ps2dev
,
param
,
PSMOUSE_CMD_GETINFO
))
{
psmouse_err
(
psmouse
,
"%s query 0x%02x failed.
\n
"
,
__func__
,
c
);
psmouse_err
(
psmouse
,
"%s query 0x%02x failed.
\n
"
,
__func__
,
c
);
return
-
1
;
return
-
1
;
...
@@ -107,8 +107,8 @@ static int elantech_read_reg(struct psmouse *psmouse, unsigned char reg,
...
@@ -107,8 +107,8 @@ static int elantech_read_reg(struct psmouse *psmouse, unsigned char reg,
switch
(
etd
->
hw_version
)
{
switch
(
etd
->
hw_version
)
{
case
1
:
case
1
:
if
(
ps
mouse_sliced_command
(
psmouse
,
ETP_REGISTER_READ
)
||
if
(
ps
2_sliced_command
(
&
psmouse
->
ps2dev
,
ETP_REGISTER_READ
)
||
ps
mouse_sliced_command
(
psmouse
,
reg
)
||
ps
2_sliced_command
(
&
psmouse
->
ps2dev
,
reg
)
||
ps2_command
(
&
psmouse
->
ps2dev
,
param
,
PSMOUSE_CMD_GETINFO
))
{
ps2_command
(
&
psmouse
->
ps2dev
,
param
,
PSMOUSE_CMD_GETINFO
))
{
rc
=
-
1
;
rc
=
-
1
;
}
}
...
@@ -162,9 +162,9 @@ static int elantech_write_reg(struct psmouse *psmouse, unsigned char reg,
...
@@ -162,9 +162,9 @@ static int elantech_write_reg(struct psmouse *psmouse, unsigned char reg,
switch
(
etd
->
hw_version
)
{
switch
(
etd
->
hw_version
)
{
case
1
:
case
1
:
if
(
ps
mouse_sliced_command
(
psmouse
,
ETP_REGISTER_WRITE
)
||
if
(
ps
2_sliced_command
(
&
psmouse
->
ps2dev
,
ETP_REGISTER_WRITE
)
||
ps
mouse_sliced_command
(
psmouse
,
reg
)
||
ps
2_sliced_command
(
&
psmouse
->
ps2dev
,
reg
)
||
ps
mouse_sliced_command
(
psmouse
,
val
)
||
ps
2_sliced_command
(
&
psmouse
->
ps2dev
,
val
)
||
ps2_command
(
&
psmouse
->
ps2dev
,
NULL
,
PSMOUSE_CMD_SETSCALE11
))
{
ps2_command
(
&
psmouse
->
ps2dev
,
NULL
,
PSMOUSE_CMD_SETSCALE11
))
{
rc
=
-
1
;
rc
=
-
1
;
}
}
...
@@ -279,8 +279,8 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse)
...
@@ -279,8 +279,8 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse)
input_report_key
(
dev
,
BTN_TOOL_FINGER
,
fingers
==
1
);
input_report_key
(
dev
,
BTN_TOOL_FINGER
,
fingers
==
1
);
input_report_key
(
dev
,
BTN_TOOL_DOUBLETAP
,
fingers
==
2
);
input_report_key
(
dev
,
BTN_TOOL_DOUBLETAP
,
fingers
==
2
);
input_report_key
(
dev
,
BTN_TOOL_TRIPLETAP
,
fingers
==
3
);
input_report_key
(
dev
,
BTN_TOOL_TRIPLETAP
,
fingers
==
3
);
input_report_key
(
dev
,
BTN_LEFT
,
packet
[
0
]
&
0x01
);
input_report_key
(
dev
,
BTN_RIGHT
,
packet
[
0
]
&
0x02
);
psmouse_report_standard_buttons
(
dev
,
packet
[
0
]
);
if
(
etd
->
fw_version
<
0x020000
&&
if
(
etd
->
fw_version
<
0x020000
&&
(
etd
->
capabilities
[
0
]
&
ETP_CAP_HAS_ROCKER
))
{
(
etd
->
capabilities
[
0
]
&
ETP_CAP_HAS_ROCKER
))
{
...
@@ -390,8 +390,7 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse)
...
@@ -390,8 +390,7 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse)
input_report_key
(
dev
,
BTN_TOOL_DOUBLETAP
,
fingers
==
2
);
input_report_key
(
dev
,
BTN_TOOL_DOUBLETAP
,
fingers
==
2
);
input_report_key
(
dev
,
BTN_TOOL_TRIPLETAP
,
fingers
==
3
);
input_report_key
(
dev
,
BTN_TOOL_TRIPLETAP
,
fingers
==
3
);
input_report_key
(
dev
,
BTN_TOOL_QUADTAP
,
fingers
==
4
);
input_report_key
(
dev
,
BTN_TOOL_QUADTAP
,
fingers
==
4
);
input_report_key
(
dev
,
BTN_LEFT
,
packet
[
0
]
&
0x01
);
psmouse_report_standard_buttons
(
dev
,
packet
[
0
]);
input_report_key
(
dev
,
BTN_RIGHT
,
packet
[
0
]
&
0x02
);
if
(
etd
->
reports_pressure
)
{
if
(
etd
->
reports_pressure
)
{
input_report_abs
(
dev
,
ABS_PRESSURE
,
pres
);
input_report_abs
(
dev
,
ABS_PRESSURE
,
pres
);
input_report_abs
(
dev
,
ABS_TOOL_WIDTH
,
width
);
input_report_abs
(
dev
,
ABS_TOOL_WIDTH
,
width
);
...
@@ -434,9 +433,7 @@ static void elantech_report_trackpoint(struct psmouse *psmouse,
...
@@ -434,9 +433,7 @@ static void elantech_report_trackpoint(struct psmouse *psmouse,
x
=
packet
[
4
]
-
(
int
)((
packet
[
1
]
^
0x80
)
<<
1
);
x
=
packet
[
4
]
-
(
int
)((
packet
[
1
]
^
0x80
)
<<
1
);
y
=
(
int
)((
packet
[
2
]
^
0x80
)
<<
1
)
-
packet
[
5
];
y
=
(
int
)((
packet
[
2
]
^
0x80
)
<<
1
)
-
packet
[
5
];
input_report_key
(
tp_dev
,
BTN_LEFT
,
packet
[
0
]
&
0x01
);
psmouse_report_standard_buttons
(
tp_dev
,
packet
[
0
]);
input_report_key
(
tp_dev
,
BTN_RIGHT
,
packet
[
0
]
&
0x02
);
input_report_key
(
tp_dev
,
BTN_MIDDLE
,
packet
[
0
]
&
0x04
);
input_report_rel
(
tp_dev
,
REL_X
,
x
);
input_report_rel
(
tp_dev
,
REL_X
,
x
);
input_report_rel
(
tp_dev
,
REL_Y
,
y
);
input_report_rel
(
tp_dev
,
REL_Y
,
y
);
...
@@ -526,12 +523,10 @@ static void elantech_report_absolute_v3(struct psmouse *psmouse,
...
@@ -526,12 +523,10 @@ static void elantech_report_absolute_v3(struct psmouse *psmouse,
input_report_key
(
dev
,
BTN_TOOL_TRIPLETAP
,
fingers
==
3
);
input_report_key
(
dev
,
BTN_TOOL_TRIPLETAP
,
fingers
==
3
);
/* For clickpads map both buttons to BTN_LEFT */
/* For clickpads map both buttons to BTN_LEFT */
if
(
etd
->
fw_version
&
0x001000
)
{
if
(
etd
->
fw_version
&
0x001000
)
input_report_key
(
dev
,
BTN_LEFT
,
packet
[
0
]
&
0x03
);
input_report_key
(
dev
,
BTN_LEFT
,
packet
[
0
]
&
0x03
);
}
else
{
else
input_report_key
(
dev
,
BTN_LEFT
,
packet
[
0
]
&
0x01
);
psmouse_report_standard_buttons
(
dev
,
packet
[
0
]);
input_report_key
(
dev
,
BTN_RIGHT
,
packet
[
0
]
&
0x02
);
}
input_report_abs
(
dev
,
ABS_PRESSURE
,
pres
);
input_report_abs
(
dev
,
ABS_PRESSURE
,
pres
);
input_report_abs
(
dev
,
ABS_TOOL_WIDTH
,
width
);
input_report_abs
(
dev
,
ABS_TOOL_WIDTH
,
width
);
...
@@ -546,13 +541,10 @@ static void elantech_input_sync_v4(struct psmouse *psmouse)
...
@@ -546,13 +541,10 @@ static void elantech_input_sync_v4(struct psmouse *psmouse)
unsigned
char
*
packet
=
psmouse
->
packet
;
unsigned
char
*
packet
=
psmouse
->
packet
;
/* For clickpads map both buttons to BTN_LEFT */
/* For clickpads map both buttons to BTN_LEFT */
if
(
etd
->
fw_version
&
0x001000
)
{
if
(
etd
->
fw_version
&
0x001000
)
input_report_key
(
dev
,
BTN_LEFT
,
packet
[
0
]
&
0x03
);
input_report_key
(
dev
,
BTN_LEFT
,
packet
[
0
]
&
0x03
);
}
else
{
else
input_report_key
(
dev
,
BTN_LEFT
,
packet
[
0
]
&
0x01
);
psmouse_report_standard_buttons
(
dev
,
packet
[
0
]);
input_report_key
(
dev
,
BTN_RIGHT
,
packet
[
0
]
&
0x02
);
input_report_key
(
dev
,
BTN_MIDDLE
,
packet
[
0
]
&
0x04
);
}
input_mt_report_pointer_emulation
(
dev
,
true
);
input_mt_report_pointer_emulation
(
dev
,
true
);
input_sync
(
dev
);
input_sync
(
dev
);
...
...
drivers/input/mouse/lifebook.c
View file @
ba521f1b
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#include <linux/libps2.h>
#include <linux/libps2.h>
#include <linux/dmi.h>
#include <linux/dmi.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/types.h>
#include "psmouse.h"
#include "psmouse.h"
#include "lifebook.h"
#include "lifebook.h"
...
@@ -136,7 +137,7 @@ static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse)
...
@@ -136,7 +137,7 @@ static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse)
struct
lifebook_data
*
priv
=
psmouse
->
private
;
struct
lifebook_data
*
priv
=
psmouse
->
private
;
struct
input_dev
*
dev1
=
psmouse
->
dev
;
struct
input_dev
*
dev1
=
psmouse
->
dev
;
struct
input_dev
*
dev2
=
priv
?
priv
->
dev2
:
NULL
;
struct
input_dev
*
dev2
=
priv
?
priv
->
dev2
:
NULL
;
u
nsigned
char
*
packet
=
psmouse
->
packet
;
u
8
*
packet
=
psmouse
->
packet
;
bool
relative_packet
=
packet
[
0
]
&
0x08
;
bool
relative_packet
=
packet
[
0
]
&
0x08
;
if
(
relative_packet
||
!
lifebook_use_6byte_proto
)
{
if
(
relative_packet
||
!
lifebook_use_6byte_proto
)
{
...
@@ -188,14 +189,10 @@ static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse)
...
@@ -188,14 +189,10 @@ static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse)
}
}
if
(
dev2
)
{
if
(
dev2
)
{
if
(
relative_packet
)
{
if
(
relative_packet
)
input_report_rel
(
dev2
,
REL_X
,
psmouse_report_standard_motion
(
dev2
,
packet
);
((
packet
[
0
]
&
0x10
)
?
packet
[
1
]
-
256
:
packet
[
1
]));
input_report_rel
(
dev2
,
REL_Y
,
psmouse_report_standard_buttons
(
dev2
,
packet
[
0
]);
-
(
int
)((
packet
[
0
]
&
0x20
)
?
packet
[
2
]
-
256
:
packet
[
2
]));
}
input_report_key
(
dev2
,
BTN_LEFT
,
packet
[
0
]
&
0x01
);
input_report_key
(
dev2
,
BTN_RIGHT
,
packet
[
0
]
&
0x02
);
input_sync
(
dev2
);
input_sync
(
dev2
);
}
}
...
@@ -205,10 +202,12 @@ static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse)
...
@@ -205,10 +202,12 @@ static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse)
static
int
lifebook_absolute_mode
(
struct
psmouse
*
psmouse
)
static
int
lifebook_absolute_mode
(
struct
psmouse
*
psmouse
)
{
{
struct
ps2dev
*
ps2dev
=
&
psmouse
->
ps2dev
;
struct
ps2dev
*
ps2dev
=
&
psmouse
->
ps2dev
;
unsigned
char
param
;
u8
param
;
int
error
;
if
(
psmouse_reset
(
psmouse
))
error
=
psmouse_reset
(
psmouse
);
return
-
1
;
if
(
error
)
return
error
;
/*
/*
* Enable absolute output -- ps2_command fails always but if
* Enable absolute output -- ps2_command fails always but if
...
@@ -224,15 +223,15 @@ static int lifebook_absolute_mode(struct psmouse *psmouse)
...
@@ -224,15 +223,15 @@ static int lifebook_absolute_mode(struct psmouse *psmouse)
static
void
lifebook_relative_mode
(
struct
psmouse
*
psmouse
)
static
void
lifebook_relative_mode
(
struct
psmouse
*
psmouse
)
{
{
struct
ps2dev
*
ps2dev
=
&
psmouse
->
ps2dev
;
struct
ps2dev
*
ps2dev
=
&
psmouse
->
ps2dev
;
u
nsigned
char
param
=
0x06
;
u
8
param
=
0x06
;
ps2_command
(
ps2dev
,
&
param
,
PSMOUSE_CMD_SETRES
);
ps2_command
(
ps2dev
,
&
param
,
PSMOUSE_CMD_SETRES
);
}
}
static
void
lifebook_set_resolution
(
struct
psmouse
*
psmouse
,
unsigned
int
resolution
)
static
void
lifebook_set_resolution
(
struct
psmouse
*
psmouse
,
unsigned
int
resolution
)
{
{
static
const
u
nsigned
char
params
[]
=
{
0
,
1
,
2
,
2
,
3
};
static
const
u
8
params
[]
=
{
0
,
1
,
2
,
2
,
3
};
u
nsigned
char
p
;
u
8
p
;
if
(
resolution
==
0
||
resolution
>
400
)
if
(
resolution
==
0
||
resolution
>
400
)
resolution
=
400
;
resolution
=
400
;
...
@@ -257,11 +256,11 @@ static void lifebook_disconnect(struct psmouse *psmouse)
...
@@ -257,11 +256,11 @@ static void lifebook_disconnect(struct psmouse *psmouse)
int
lifebook_detect
(
struct
psmouse
*
psmouse
,
bool
set_properties
)
int
lifebook_detect
(
struct
psmouse
*
psmouse
,
bool
set_properties
)
{
{
if
(
!
lifebook_present
)
if
(
!
lifebook_present
)
return
-
1
;
return
-
ENXIO
;
if
(
desired_serio_phys
&&
if
(
desired_serio_phys
&&
strcmp
(
psmouse
->
ps2dev
.
serio
->
phys
,
desired_serio_phys
))
strcmp
(
psmouse
->
ps2dev
.
serio
->
phys
,
desired_serio_phys
))
return
-
1
;
return
-
ENXIO
;
if
(
set_properties
)
{
if
(
set_properties
)
{
psmouse
->
vendor
=
"Fujitsu"
;
psmouse
->
vendor
=
"Fujitsu"
;
...
@@ -294,10 +293,10 @@ static int lifebook_create_relative_device(struct psmouse *psmouse)
...
@@ -294,10 +293,10 @@ static int lifebook_create_relative_device(struct psmouse *psmouse)
dev2
->
id
.
version
=
0x0000
;
dev2
->
id
.
version
=
0x0000
;
dev2
->
dev
.
parent
=
&
psmouse
->
ps2dev
.
serio
->
dev
;
dev2
->
dev
.
parent
=
&
psmouse
->
ps2dev
.
serio
->
dev
;
dev2
->
evbit
[
0
]
=
BIT_MASK
(
EV_KEY
)
|
BIT_MASK
(
EV_REL
);
input_set_capability
(
dev2
,
EV_REL
,
REL_X
);
dev2
->
relbit
[
BIT_WORD
(
REL_X
)]
=
BIT_MASK
(
REL_X
)
|
BIT_MASK
(
REL_Y
);
input_set_capability
(
dev2
,
EV_REL
,
REL_Y
);
dev2
->
keybit
[
BIT_WORD
(
BTN_LEFT
)]
=
input_set_capability
(
dev2
,
EV_KEY
,
BTN_LEFT
);
BIT_MASK
(
BTN_LEFT
)
|
BIT_MASK
(
BTN_RIGHT
);
input_set_capability
(
dev2
,
EV_KEY
,
BTN_RIGHT
);
error
=
input_register_device
(
priv
->
dev2
);
error
=
input_register_device
(
priv
->
dev2
);
if
(
error
)
if
(
error
)
...
@@ -316,21 +315,26 @@ int lifebook_init(struct psmouse *psmouse)
...
@@ -316,21 +315,26 @@ int lifebook_init(struct psmouse *psmouse)
{
{
struct
input_dev
*
dev1
=
psmouse
->
dev
;
struct
input_dev
*
dev1
=
psmouse
->
dev
;
int
max_coord
=
lifebook_use_6byte_proto
?
4096
:
1024
;
int
max_coord
=
lifebook_use_6byte_proto
?
4096
:
1024
;
int
error
;
error
=
lifebook_absolute_mode
(
psmouse
);
if
(
error
)
return
error
;
if
(
lifebook_absolute_mode
(
psmouse
))
/* Clear default capabilities */
return
-
1
;
bitmap_zero
(
dev1
->
evbit
,
EV_CNT
);
bitmap_zero
(
dev1
->
relbit
,
REL_CNT
);
bitmap_zero
(
dev1
->
keybit
,
KEY_CNT
);
dev1
->
evbit
[
0
]
=
BIT_MASK
(
EV_ABS
)
|
BIT_MASK
(
EV_KEY
);
input_set_capability
(
dev1
,
EV_KEY
,
BTN_TOUCH
);
dev1
->
relbit
[
0
]
=
0
;
dev1
->
keybit
[
BIT_WORD
(
BTN_MOUSE
)]
=
0
;
dev1
->
keybit
[
BIT_WORD
(
BTN_TOUCH
)]
=
BIT_MASK
(
BTN_TOUCH
);
input_set_abs_params
(
dev1
,
ABS_X
,
0
,
max_coord
,
0
,
0
);
input_set_abs_params
(
dev1
,
ABS_X
,
0
,
max_coord
,
0
,
0
);
input_set_abs_params
(
dev1
,
ABS_Y
,
0
,
max_coord
,
0
,
0
);
input_set_abs_params
(
dev1
,
ABS_Y
,
0
,
max_coord
,
0
,
0
);
if
(
!
desired_serio_phys
)
{
if
(
!
desired_serio_phys
)
{
if
(
lifebook_create_relative_device
(
psmouse
))
{
error
=
lifebook_create_relative_device
(
psmouse
);
if
(
error
)
{
lifebook_relative_mode
(
psmouse
);
lifebook_relative_mode
(
psmouse
);
return
-
1
;
return
error
;
}
}
}
}
...
...
drivers/input/mouse/logips2pp.c
View file @
ba521f1b
...
@@ -9,9 +9,11 @@
...
@@ -9,9 +9,11 @@
* the Free Software Foundation.
* the Free Software Foundation.
*/
*/
#include <linux/bitops.h>
#include <linux/input.h>
#include <linux/input.h>
#include <linux/serio.h>
#include <linux/serio.h>
#include <linux/libps2.h>
#include <linux/libps2.h>
#include <linux/types.h>
#include "psmouse.h"
#include "psmouse.h"
#include "logips2pp.h"
#include "logips2pp.h"
...
@@ -22,12 +24,12 @@
...
@@ -22,12 +24,12 @@
#define PS2PP_KIND_TRACKMAN 4
#define PS2PP_KIND_TRACKMAN 4
/* Logitech mouse features */
/* Logitech mouse features */
#define PS2PP_WHEEL
0x01
#define PS2PP_WHEEL
BIT(0)
#define PS2PP_HWHEEL
0x02
#define PS2PP_HWHEEL
BIT(1)
#define PS2PP_SIDE_BTN
0x04
#define PS2PP_SIDE_BTN
BIT(2)
#define PS2PP_EXTRA_BTN
0x08
#define PS2PP_EXTRA_BTN
BIT(3)
#define PS2PP_TASK_BTN
0x10
#define PS2PP_TASK_BTN
BIT(4)
#define PS2PP_NAV_BTN
0x20
#define PS2PP_NAV_BTN
BIT(5)
struct
ps2pp_info
{
struct
ps2pp_info
{
u8
model
;
u8
model
;
...
@@ -42,7 +44,7 @@ struct ps2pp_info {
...
@@ -42,7 +44,7 @@ struct ps2pp_info {
static
psmouse_ret_t
ps2pp_process_byte
(
struct
psmouse
*
psmouse
)
static
psmouse_ret_t
ps2pp_process_byte
(
struct
psmouse
*
psmouse
)
{
{
struct
input_dev
*
dev
=
psmouse
->
dev
;
struct
input_dev
*
dev
=
psmouse
->
dev
;
u
nsigned
char
*
packet
=
psmouse
->
packet
;
u
8
*
packet
=
psmouse
->
packet
;
if
(
psmouse
->
pktcnt
<
3
)
if
(
psmouse
->
pktcnt
<
3
)
return
PSMOUSE_GOOD_DATA
;
return
PSMOUSE_GOOD_DATA
;
...
@@ -58,28 +60,30 @@ static psmouse_ret_t ps2pp_process_byte(struct psmouse *psmouse)
...
@@ -58,28 +60,30 @@ static psmouse_ret_t ps2pp_process_byte(struct psmouse *psmouse)
case
0x0d
:
/* Mouse extra info */
case
0x0d
:
/* Mouse extra info */
input_report_rel
(
dev
,
packet
[
2
]
&
0x80
?
REL_HWHEEL
:
REL_WHEEL
,
input_report_rel
(
dev
,
(
int
)
(
packet
[
2
]
&
8
)
-
(
int
)
(
packet
[
2
]
&
7
));
packet
[
2
]
&
0x80
?
REL_HWHEEL
:
REL_WHEEL
,
input_report_key
(
dev
,
BTN_SIDE
,
(
packet
[
2
]
>>
4
)
&
1
);
-
sign_extend32
(
packet
[
2
],
3
));
input_report_key
(
dev
,
BTN_EXTRA
,
(
packet
[
2
]
>>
5
)
&
1
);
input_report_key
(
dev
,
BTN_SIDE
,
packet
[
2
]
&
BIT
(
4
));
input_report_key
(
dev
,
BTN_EXTRA
,
packet
[
2
]
&
BIT
(
5
));
break
;
break
;
case
0x0e
:
/* buttons 4, 5, 6, 7, 8, 9, 10 info */
case
0x0e
:
/* buttons 4, 5, 6, 7, 8, 9, 10 info */
input_report_key
(
dev
,
BTN_SIDE
,
(
packet
[
2
])
&
1
);
input_report_key
(
dev
,
BTN_SIDE
,
packet
[
2
]
&
BIT
(
0
)
);
input_report_key
(
dev
,
BTN_EXTRA
,
(
packet
[
2
]
>>
1
)
&
1
);
input_report_key
(
dev
,
BTN_EXTRA
,
packet
[
2
]
&
BIT
(
1
)
);
input_report_key
(
dev
,
BTN_
BACK
,
(
packet
[
2
]
>>
3
)
&
1
);
input_report_key
(
dev
,
BTN_
TASK
,
packet
[
2
]
&
BIT
(
2
)
);
input_report_key
(
dev
,
BTN_
FORWARD
,
(
packet
[
2
]
>>
4
)
&
1
);
input_report_key
(
dev
,
BTN_
BACK
,
packet
[
2
]
&
BIT
(
3
)
);
input_report_key
(
dev
,
BTN_
TASK
,
(
packet
[
2
]
>>
2
)
&
1
);
input_report_key
(
dev
,
BTN_
FORWARD
,
packet
[
2
]
&
BIT
(
4
)
);
break
;
break
;
case
0x0f
:
/* TouchPad extra info */
case
0x0f
:
/* TouchPad extra info */
input_report_rel
(
dev
,
packet
[
2
]
&
0x08
?
REL_HWHEEL
:
REL_WHEEL
,
input_report_rel
(
dev
,
(
int
)
((
packet
[
2
]
>>
4
)
&
8
)
-
(
int
)
((
packet
[
2
]
>>
4
)
&
7
));
packet
[
2
]
&
0x08
?
REL_HWHEEL
:
REL_WHEEL
,
packet
[
0
]
=
packet
[
2
]
|
0x08
;
-
sign_extend32
(
packet
[
2
]
>>
4
,
3
));
packet
[
0
]
=
packet
[
2
]
|
BIT
(
3
);
break
;
break
;
default:
default:
...
@@ -88,16 +92,14 @@ static psmouse_ret_t ps2pp_process_byte(struct psmouse *psmouse)
...
@@ -88,16 +92,14 @@ static psmouse_ret_t ps2pp_process_byte(struct psmouse *psmouse)
(
packet
[
1
]
>>
4
)
|
(
packet
[
0
]
&
0x30
));
(
packet
[
1
]
>>
4
)
|
(
packet
[
0
]
&
0x30
));
break
;
break
;
}
}
psmouse_report_standard_buttons
(
dev
,
packet
[
0
]);
}
else
{
}
else
{
/* Standard PS/2 motion data */
/* Standard PS/2 motion data */
input_report_rel
(
dev
,
REL_X
,
packet
[
1
]
?
(
int
)
packet
[
1
]
-
(
int
)
((
packet
[
0
]
<<
4
)
&
0x100
)
:
0
);
psmouse_report_standard_packet
(
dev
,
packet
);
input_report_rel
(
dev
,
REL_Y
,
packet
[
2
]
?
(
int
)
((
packet
[
0
]
<<
3
)
&
0x100
)
-
(
int
)
packet
[
2
]
:
0
);
}
}
input_report_key
(
dev
,
BTN_LEFT
,
packet
[
0
]
&
1
);
input_report_key
(
dev
,
BTN_MIDDLE
,
(
packet
[
0
]
>>
2
)
&
1
);
input_report_key
(
dev
,
BTN_RIGHT
,
(
packet
[
0
]
>>
1
)
&
1
);
input_sync
(
dev
);
input_sync
(
dev
);
return
PSMOUSE_FULL_PACKET
;
return
PSMOUSE_FULL_PACKET
;
...
@@ -111,13 +113,17 @@ static psmouse_ret_t ps2pp_process_byte(struct psmouse *psmouse)
...
@@ -111,13 +113,17 @@ static psmouse_ret_t ps2pp_process_byte(struct psmouse *psmouse)
* Ugly.
* Ugly.
*/
*/
static
int
ps2pp_cmd
(
struct
psmouse
*
psmouse
,
u
nsigned
char
*
param
,
unsigned
char
command
)
static
int
ps2pp_cmd
(
struct
psmouse
*
psmouse
,
u
8
*
param
,
u8
command
)
{
{
if
(
psmouse_sliced_command
(
psmouse
,
command
))
int
error
;
return
-
1
;
if
(
ps2_command
(
&
psmouse
->
ps2dev
,
param
,
PSMOUSE_CMD_POLL
|
0x0300
))
error
=
ps2_sliced_command
(
&
psmouse
->
ps2dev
,
command
);
return
-
1
;
if
(
error
)
return
error
;
error
=
ps2_command
(
&
psmouse
->
ps2dev
,
param
,
PSMOUSE_CMD_POLL
|
0x0300
);
if
(
error
)
return
error
;
return
0
;
return
0
;
}
}
...
@@ -133,7 +139,7 @@ static int ps2pp_cmd(struct psmouse *psmouse, unsigned char *param, unsigned cha
...
@@ -133,7 +139,7 @@ static int ps2pp_cmd(struct psmouse *psmouse, unsigned char *param, unsigned cha
static
void
ps2pp_set_smartscroll
(
struct
psmouse
*
psmouse
,
bool
smartscroll
)
static
void
ps2pp_set_smartscroll
(
struct
psmouse
*
psmouse
,
bool
smartscroll
)
{
{
struct
ps2dev
*
ps2dev
=
&
psmouse
->
ps2dev
;
struct
ps2dev
*
ps2dev
=
&
psmouse
->
ps2dev
;
u
nsigned
char
param
[
4
];
u
8
param
[
4
];
ps2pp_cmd
(
psmouse
,
param
,
0x32
);
ps2pp_cmd
(
psmouse
,
param
,
0x32
);
...
@@ -171,7 +177,7 @@ static ssize_t ps2pp_attr_set_smartscroll(struct psmouse *psmouse, void *data,
...
@@ -171,7 +177,7 @@ static ssize_t ps2pp_attr_set_smartscroll(struct psmouse *psmouse, void *data,
}
}
PSMOUSE_DEFINE_ATTR
(
smartscroll
,
S_IWUSR
|
S_IRUGO
,
NULL
,
PSMOUSE_DEFINE_ATTR
(
smartscroll
,
S_IWUSR
|
S_IRUGO
,
NULL
,
ps2pp_attr_show_smartscroll
,
ps2pp_attr_set_smartscroll
);
ps2pp_attr_show_smartscroll
,
ps2pp_attr_set_smartscroll
);
/*
/*
* Support 800 dpi resolution _only_ if the user wants it (there are good
* Support 800 dpi resolution _only_ if the user wants it (there are good
...
@@ -179,11 +185,12 @@ PSMOUSE_DEFINE_ATTR(smartscroll, S_IWUSR | S_IRUGO, NULL,
...
@@ -179,11 +185,12 @@ PSMOUSE_DEFINE_ATTR(smartscroll, S_IWUSR | S_IRUGO, NULL,
* also good reasons to use it, let the user decide).
* also good reasons to use it, let the user decide).
*/
*/
static
void
ps2pp_set_resolution
(
struct
psmouse
*
psmouse
,
unsigned
int
resolution
)
static
void
ps2pp_set_resolution
(
struct
psmouse
*
psmouse
,
unsigned
int
resolution
)
{
{
if
(
resolution
>
400
)
{
if
(
resolution
>
400
)
{
struct
ps2dev
*
ps2dev
=
&
psmouse
->
ps2dev
;
struct
ps2dev
*
ps2dev
=
&
psmouse
->
ps2dev
;
u
nsigned
char
param
=
3
;
u
8
param
=
3
;
ps2_command
(
ps2dev
,
NULL
,
PSMOUSE_CMD_SETSCALE11
);
ps2_command
(
ps2dev
,
NULL
,
PSMOUSE_CMD_SETSCALE11
);
ps2_command
(
ps2dev
,
NULL
,
PSMOUSE_CMD_SETSCALE11
);
ps2_command
(
ps2dev
,
NULL
,
PSMOUSE_CMD_SETSCALE11
);
...
@@ -196,7 +203,8 @@ static void ps2pp_set_resolution(struct psmouse *psmouse, unsigned int resolutio
...
@@ -196,7 +203,8 @@ static void ps2pp_set_resolution(struct psmouse *psmouse, unsigned int resolutio
static
void
ps2pp_disconnect
(
struct
psmouse
*
psmouse
)
static
void
ps2pp_disconnect
(
struct
psmouse
*
psmouse
)
{
{
device_remove_file
(
&
psmouse
->
ps2dev
.
serio
->
dev
,
&
psmouse_attr_smartscroll
.
dattr
);
device_remove_file
(
&
psmouse
->
ps2dev
.
serio
->
dev
,
&
psmouse_attr_smartscroll
.
dattr
);
}
}
static
const
struct
ps2pp_info
*
get_model_info
(
unsigned
char
model
)
static
const
struct
ps2pp_info
*
get_model_info
(
unsigned
char
model
)
...
@@ -269,24 +277,24 @@ static void ps2pp_set_model_properties(struct psmouse *psmouse,
...
@@ -269,24 +277,24 @@ static void ps2pp_set_model_properties(struct psmouse *psmouse,
struct
input_dev
*
input_dev
=
psmouse
->
dev
;
struct
input_dev
*
input_dev
=
psmouse
->
dev
;
if
(
model_info
->
features
&
PS2PP_SIDE_BTN
)
if
(
model_info
->
features
&
PS2PP_SIDE_BTN
)
__set_bit
(
BTN_SIDE
,
input_dev
->
keybit
);
input_set_capability
(
input_dev
,
EV_KEY
,
BTN_SIDE
);
if
(
model_info
->
features
&
PS2PP_EXTRA_BTN
)
if
(
model_info
->
features
&
PS2PP_EXTRA_BTN
)
__set_bit
(
BTN_EXTRA
,
input_dev
->
keybit
);
input_set_capability
(
input_dev
,
EV_KEY
,
BTN_EXTRA
);
if
(
model_info
->
features
&
PS2PP_TASK_BTN
)
if
(
model_info
->
features
&
PS2PP_TASK_BTN
)
__set_bit
(
BTN_TASK
,
input_dev
->
keybit
);
input_set_capability
(
input_dev
,
EV_KEY
,
BTN_TASK
);
if
(
model_info
->
features
&
PS2PP_NAV_BTN
)
{
if
(
model_info
->
features
&
PS2PP_NAV_BTN
)
{
__set_bit
(
BTN_FORWARD
,
input_dev
->
keybit
);
input_set_capability
(
input_dev
,
EV_KEY
,
BTN_FORWARD
);
__set_bit
(
BTN_BACK
,
input_dev
->
keybit
);
input_set_capability
(
input_dev
,
EV_KEY
,
BTN_BACK
);
}
}
if
(
model_info
->
features
&
PS2PP_WHEEL
)
if
(
model_info
->
features
&
PS2PP_WHEEL
)
__set_bit
(
REL_WHEEL
,
input_dev
->
relbit
);
input_set_capability
(
input_dev
,
EV_REL
,
REL_WHEEL
);
if
(
model_info
->
features
&
PS2PP_HWHEEL
)
if
(
model_info
->
features
&
PS2PP_HWHEEL
)
__set_bit
(
REL_HWHEEL
,
input_dev
->
relbit
);
input_set_capability
(
input_dev
,
EV_REL
,
REL_HWHEEL
);
switch
(
model_info
->
kind
)
{
switch
(
model_info
->
kind
)
{
...
@@ -318,6 +326,30 @@ static void ps2pp_set_model_properties(struct psmouse *psmouse,
...
@@ -318,6 +326,30 @@ static void ps2pp_set_model_properties(struct psmouse *psmouse,
}
}
}
}
static
int
ps2pp_setup_protocol
(
struct
psmouse
*
psmouse
,
const
struct
ps2pp_info
*
model_info
)
{
int
error
;
psmouse
->
protocol_handler
=
ps2pp_process_byte
;
psmouse
->
pktsize
=
3
;
if
(
model_info
->
kind
!=
PS2PP_KIND_TP3
)
{
psmouse
->
set_resolution
=
ps2pp_set_resolution
;
psmouse
->
disconnect
=
ps2pp_disconnect
;
error
=
device_create_file
(
&
psmouse
->
ps2dev
.
serio
->
dev
,
&
psmouse_attr_smartscroll
.
dattr
);
if
(
error
)
{
psmouse_err
(
psmouse
,
"failed to create smartscroll sysfs attribute, error: %d
\n
"
,
error
);
return
error
;
}
}
return
0
;
}
/*
/*
* Logitech magic init. Detect whether the mouse is a Logitech one
* Logitech magic init. Detect whether the mouse is a Logitech one
...
@@ -328,9 +360,9 @@ static void ps2pp_set_model_properties(struct psmouse *psmouse,
...
@@ -328,9 +360,9 @@ static void ps2pp_set_model_properties(struct psmouse *psmouse,
int
ps2pp_detect
(
struct
psmouse
*
psmouse
,
bool
set_properties
)
int
ps2pp_detect
(
struct
psmouse
*
psmouse
,
bool
set_properties
)
{
{
struct
ps2dev
*
ps2dev
=
&
psmouse
->
ps2dev
;
struct
ps2dev
*
ps2dev
=
&
psmouse
->
ps2dev
;
unsigned
char
param
[
4
];
unsigned
char
model
,
buttons
;
const
struct
ps2pp_info
*
model_info
;
const
struct
ps2pp_info
*
model_info
;
u8
param
[
4
];
u8
model
,
buttons
;
bool
use_ps2pp
=
false
;
bool
use_ps2pp
=
false
;
int
error
;
int
error
;
...
@@ -346,7 +378,7 @@ int ps2pp_detect(struct psmouse *psmouse, bool set_properties)
...
@@ -346,7 +378,7 @@ int ps2pp_detect(struct psmouse *psmouse, bool set_properties)
buttons
=
param
[
1
];
buttons
=
param
[
1
];
if
(
!
model
||
!
buttons
)
if
(
!
model
||
!
buttons
)
return
-
1
;
return
-
ENXIO
;
model_info
=
get_model_info
(
model
);
model_info
=
get_model_info
(
model
);
if
(
model_info
)
{
if
(
model_info
)
{
...
@@ -368,7 +400,8 @@ int ps2pp_detect(struct psmouse *psmouse, bool set_properties)
...
@@ -368,7 +400,8 @@ int ps2pp_detect(struct psmouse *psmouse, bool set_properties)
param
[
0
]
=
0
;
param
[
0
]
=
0
;
if
(
!
ps2_command
(
ps2dev
,
param
,
0x13d1
)
&&
if
(
!
ps2_command
(
ps2dev
,
param
,
0x13d1
)
&&
param
[
0
]
==
0x06
&&
param
[
1
]
==
0x00
&&
param
[
2
]
==
0x14
)
{
param
[
0
]
==
0x06
&&
param
[
1
]
==
0x00
&&
param
[
2
]
==
0x14
)
{
use_ps2pp
=
true
;
use_ps2pp
=
true
;
}
}
...
@@ -387,7 +420,9 @@ int ps2pp_detect(struct psmouse *psmouse, bool set_properties)
...
@@ -387,7 +420,9 @@ int ps2pp_detect(struct psmouse *psmouse, bool set_properties)
}
}
}
else
{
}
else
{
psmouse_warn
(
psmouse
,
"Detected unknown Logitech mouse model %d
\n
"
,
model
);
psmouse_warn
(
psmouse
,
"Detected unknown Logitech mouse model %d
\n
"
,
model
);
}
}
if
(
set_properties
)
{
if
(
set_properties
)
{
...
@@ -395,31 +430,18 @@ int ps2pp_detect(struct psmouse *psmouse, bool set_properties)
...
@@ -395,31 +430,18 @@ int ps2pp_detect(struct psmouse *psmouse, bool set_properties)
psmouse
->
model
=
model
;
psmouse
->
model
=
model
;
if
(
use_ps2pp
)
{
if
(
use_ps2pp
)
{
psmouse
->
protocol_handler
=
ps2pp_process_byte
;
error
=
ps2pp_setup_protocol
(
psmouse
,
model_info
);
psmouse
->
pktsize
=
3
;
if
(
error
)
return
error
;
if
(
model_info
->
kind
!=
PS2PP_KIND_TP3
)
{
psmouse
->
set_resolution
=
ps2pp_set_resolution
;
psmouse
->
disconnect
=
ps2pp_disconnect
;
error
=
device_create_file
(
&
ps2dev
->
serio
->
dev
,
&
psmouse_attr_smartscroll
.
dattr
);
if
(
error
)
{
psmouse_err
(
psmouse
,
"failed to create smartscroll sysfs attribute, error: %d
\n
"
,
error
);
return
-
1
;
}
}
}
}
if
(
buttons
>=
3
)
if
(
buttons
>=
3
)
__set_bit
(
BTN_MIDDLE
,
psmouse
->
dev
->
keybit
);
input_set_capability
(
psmouse
->
dev
,
EV_KEY
,
BTN_MIDDLE
);
if
(
model_info
)
if
(
model_info
)
ps2pp_set_model_properties
(
psmouse
,
model_info
,
use_ps2pp
);
ps2pp_set_model_properties
(
psmouse
,
model_info
,
use_ps2pp
);
}
}
return
use_ps2pp
?
0
:
-
1
;
return
use_ps2pp
?
0
:
-
ENXIO
;
}
}
drivers/input/mouse/psmouse-base.c
View file @
ba521f1b
This diff is collapsed.
Click to expand it.
drivers/input/mouse/psmouse.h
View file @
ba521f1b
...
@@ -131,7 +131,6 @@ struct psmouse {
...
@@ -131,7 +131,6 @@ struct psmouse {
void
psmouse_queue_work
(
struct
psmouse
*
psmouse
,
struct
delayed_work
*
work
,
void
psmouse_queue_work
(
struct
psmouse
*
psmouse
,
struct
delayed_work
*
work
,
unsigned
long
delay
);
unsigned
long
delay
);
int
psmouse_sliced_command
(
struct
psmouse
*
psmouse
,
unsigned
char
command
);
int
psmouse_reset
(
struct
psmouse
*
psmouse
);
int
psmouse_reset
(
struct
psmouse
*
psmouse
);
void
psmouse_set_state
(
struct
psmouse
*
psmouse
,
enum
psmouse_state
new_state
);
void
psmouse_set_state
(
struct
psmouse
*
psmouse
,
enum
psmouse_state
new_state
);
void
psmouse_set_resolution
(
struct
psmouse
*
psmouse
,
unsigned
int
resolution
);
void
psmouse_set_resolution
(
struct
psmouse
*
psmouse
,
unsigned
int
resolution
);
...
@@ -140,6 +139,10 @@ int psmouse_activate(struct psmouse *psmouse);
...
@@ -140,6 +139,10 @@ int psmouse_activate(struct psmouse *psmouse);
int
psmouse_deactivate
(
struct
psmouse
*
psmouse
);
int
psmouse_deactivate
(
struct
psmouse
*
psmouse
);
bool
psmouse_matches_pnp_id
(
struct
psmouse
*
psmouse
,
const
char
*
const
ids
[]);
bool
psmouse_matches_pnp_id
(
struct
psmouse
*
psmouse
,
const
char
*
const
ids
[]);
void
psmouse_report_standard_buttons
(
struct
input_dev
*
,
u8
buttons
);
void
psmouse_report_standard_motion
(
struct
input_dev
*
,
u8
*
packet
);
void
psmouse_report_standard_packet
(
struct
input_dev
*
,
u8
*
packet
);
struct
psmouse_attribute
{
struct
psmouse_attribute
{
struct
device_attribute
dattr
;
struct
device_attribute
dattr
;
void
*
data
;
void
*
data
;
...
...
drivers/input/mouse/sentelic.c
View file @
ba521f1b
...
@@ -710,7 +710,6 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse)
...
@@ -710,7 +710,6 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse)
unsigned
char
*
packet
=
psmouse
->
packet
;
unsigned
char
*
packet
=
psmouse
->
packet
;
unsigned
char
button_status
=
0
,
lscroll
=
0
,
rscroll
=
0
;
unsigned
char
button_status
=
0
,
lscroll
=
0
,
rscroll
=
0
;
unsigned
short
abs_x
,
abs_y
,
fgrs
=
0
;
unsigned
short
abs_x
,
abs_y
,
fgrs
=
0
;
int
rel_x
,
rel_y
;
if
(
psmouse
->
pktcnt
<
4
)
if
(
psmouse
->
pktcnt
<
4
)
return
PSMOUSE_GOOD_DATA
;
return
PSMOUSE_GOOD_DATA
;
...
@@ -840,15 +839,7 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse)
...
@@ -840,15 +839,7 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse)
/*
/*
* Standard PS/2 Mouse
* Standard PS/2 Mouse
*/
*/
input_report_key
(
dev
,
BTN_LEFT
,
packet
[
0
]
&
1
);
psmouse_report_standard_packet
(
dev
,
packet
);
input_report_key
(
dev
,
BTN_MIDDLE
,
(
packet
[
0
]
>>
2
)
&
1
);
input_report_key
(
dev
,
BTN_RIGHT
,
(
packet
[
0
]
>>
1
)
&
1
);
rel_x
=
packet
[
1
]
?
(
int
)
packet
[
1
]
-
(
int
)((
packet
[
0
]
<<
4
)
&
0x100
)
:
0
;
rel_y
=
packet
[
2
]
?
(
int
)((
packet
[
0
]
<<
3
)
&
0x100
)
-
(
int
)
packet
[
2
]
:
0
;
input_report_rel
(
dev
,
REL_X
,
rel_x
);
input_report_rel
(
dev
,
REL_Y
,
rel_y
);
break
;
break
;
}
}
...
...
drivers/input/mouse/synaptics.c
View file @
ba521f1b
...
@@ -84,7 +84,7 @@ static int synaptics_mode_cmd(struct psmouse *psmouse, u8 mode)
...
@@ -84,7 +84,7 @@ static int synaptics_mode_cmd(struct psmouse *psmouse, u8 mode)
u8
param
[
1
];
u8
param
[
1
];
int
error
;
int
error
;
error
=
ps
mouse_sliced_command
(
psmouse
,
mode
);
error
=
ps
2_sliced_command
(
&
psmouse
->
ps2dev
,
mode
);
if
(
error
)
if
(
error
)
return
error
;
return
error
;
...
@@ -190,7 +190,7 @@ static int synaptics_send_cmd(struct psmouse *psmouse, u8 cmd, u8 *param)
...
@@ -190,7 +190,7 @@ static int synaptics_send_cmd(struct psmouse *psmouse, u8 cmd, u8 *param)
{
{
int
error
;
int
error
;
error
=
ps
mouse_sliced_command
(
psmouse
,
cmd
);
error
=
ps
2_sliced_command
(
&
psmouse
->
ps2dev
,
cmd
);
if
(
error
)
if
(
error
)
return
error
;
return
error
;
...
@@ -547,7 +547,7 @@ static int synaptics_set_advanced_gesture_mode(struct psmouse *psmouse)
...
@@ -547,7 +547,7 @@ static int synaptics_set_advanced_gesture_mode(struct psmouse *psmouse)
static
u8
param
=
0xc8
;
static
u8
param
=
0xc8
;
int
error
;
int
error
;
error
=
ps
mouse_sliced_command
(
psmouse
,
SYN_QUE_MODEL
);
error
=
ps
2_sliced_command
(
&
psmouse
->
ps2dev
,
SYN_QUE_MODEL
);
if
(
error
)
if
(
error
)
return
error
;
return
error
;
...
@@ -614,7 +614,7 @@ static int synaptics_pt_write(struct serio *serio, u8 c)
...
@@ -614,7 +614,7 @@ static int synaptics_pt_write(struct serio *serio, u8 c)
u8
rate_param
=
SYN_PS_CLIENT_CMD
;
/* indicates that we want pass-through port */
u8
rate_param
=
SYN_PS_CLIENT_CMD
;
/* indicates that we want pass-through port */
int
error
;
int
error
;
error
=
ps
mouse_sliced_command
(
parent
,
c
);
error
=
ps
2_sliced_command
(
&
parent
->
ps2dev
,
c
);
if
(
error
)
if
(
error
)
return
error
;
return
error
;
...
...
drivers/input/mouse/trackpoint.c
View file @
ba521f1b
...
@@ -33,18 +33,15 @@ static const char * const trackpoint_variants[] = {
...
@@ -33,18 +33,15 @@ static const char * const trackpoint_variants[] = {
*/
*/
static
int
trackpoint_power_on_reset
(
struct
ps2dev
*
ps2dev
)
static
int
trackpoint_power_on_reset
(
struct
ps2dev
*
ps2dev
)
{
{
u8
results
[
2
]
;
u8
param
[
2
]
=
{
TP_POR
}
;
int
tries
=
0
;
int
err
;
/* Issue POR command, and repeat up to once if 0xFC00 received */
err
=
ps2_command
(
ps2dev
,
param
,
MAKE_PS2_CMD
(
1
,
2
,
TP_COMMAND
));
do
{
if
(
err
)
if
(
ps2_command
(
ps2dev
,
NULL
,
MAKE_PS2_CMD
(
0
,
0
,
TP_COMMAND
))
||
return
err
;
ps2_command
(
ps2dev
,
results
,
MAKE_PS2_CMD
(
0
,
2
,
TP_POR
)))
return
-
1
;
}
while
(
results
[
0
]
==
0xFC
&&
results
[
1
]
==
0x00
&&
++
tries
<
2
);
/* Check for success response -- 0xAA00 */
/* Check for success response -- 0xAA00 */
if
(
results
[
0
]
!=
0xAA
||
results
[
1
]
!=
0x00
)
if
(
param
[
0
]
!=
0xAA
||
param
[
1
]
!=
0x00
)
return
-
ENODEV
;
return
-
ENODEV
;
return
0
;
return
0
;
...
@@ -55,49 +52,39 @@ static int trackpoint_power_on_reset(struct ps2dev *ps2dev)
...
@@ -55,49 +52,39 @@ static int trackpoint_power_on_reset(struct ps2dev *ps2dev)
*/
*/
static
int
trackpoint_read
(
struct
ps2dev
*
ps2dev
,
u8
loc
,
u8
*
results
)
static
int
trackpoint_read
(
struct
ps2dev
*
ps2dev
,
u8
loc
,
u8
*
results
)
{
{
if
(
ps2_command
(
ps2dev
,
NULL
,
MAKE_PS2_CMD
(
0
,
0
,
TP_COMMAND
))
||
results
[
0
]
=
loc
;
ps2_command
(
ps2dev
,
results
,
MAKE_PS2_CMD
(
0
,
1
,
loc
)))
{
return
-
1
;
}
return
0
;
return
ps2_command
(
ps2dev
,
results
,
MAKE_PS2_CMD
(
1
,
1
,
TP_COMMAND
))
;
}
}
static
int
trackpoint_write
(
struct
ps2dev
*
ps2dev
,
u8
loc
,
u8
val
)
static
int
trackpoint_write
(
struct
ps2dev
*
ps2dev
,
u8
loc
,
u8
val
)
{
{
if
(
ps2_command
(
ps2dev
,
NULL
,
MAKE_PS2_CMD
(
0
,
0
,
TP_COMMAND
))
||
u8
param
[
3
]
=
{
TP_WRITE_MEM
,
loc
,
val
};
ps2_command
(
ps2dev
,
NULL
,
MAKE_PS2_CMD
(
0
,
0
,
TP_WRITE_MEM
))
||
ps2_command
(
ps2dev
,
NULL
,
MAKE_PS2_CMD
(
0
,
0
,
loc
))
||
ps2_command
(
ps2dev
,
NULL
,
MAKE_PS2_CMD
(
0
,
0
,
val
)))
{
return
-
1
;
}
return
0
;
return
ps2_command
(
ps2dev
,
param
,
MAKE_PS2_CMD
(
3
,
0
,
TP_COMMAND
))
;
}
}
static
int
trackpoint_toggle_bit
(
struct
ps2dev
*
ps2dev
,
u8
loc
,
u8
mask
)
static
int
trackpoint_toggle_bit
(
struct
ps2dev
*
ps2dev
,
u8
loc
,
u8
mask
)
{
{
u8
param
[
3
]
=
{
TP_TOGGLE
,
loc
,
mask
};
/* Bad things will happen if the loc param isn't in this range */
/* Bad things will happen if the loc param isn't in this range */
if
(
loc
<
0x20
||
loc
>=
0x2F
)
if
(
loc
<
0x20
||
loc
>=
0x2F
)
return
-
1
;
return
-
EINVAL
;
if
(
ps2_command
(
ps2dev
,
NULL
,
MAKE_PS2_CMD
(
0
,
0
,
TP_COMMAND
))
||
ps2_command
(
ps2dev
,
NULL
,
MAKE_PS2_CMD
(
0
,
0
,
TP_TOGGLE
))
||
ps2_command
(
ps2dev
,
NULL
,
MAKE_PS2_CMD
(
0
,
0
,
loc
))
||
ps2_command
(
ps2dev
,
NULL
,
MAKE_PS2_CMD
(
0
,
0
,
mask
)))
{
return
-
1
;
}
return
0
;
return
ps2_command
(
ps2dev
,
param
,
MAKE_PS2_CMD
(
3
,
0
,
TP_COMMAND
))
;
}
}
static
int
trackpoint_update_bit
(
struct
ps2dev
*
ps2dev
,
static
int
trackpoint_update_bit
(
struct
ps2dev
*
ps2dev
,
u8
loc
,
u8
mask
,
u8
value
)
u8
loc
,
u8
mask
,
u8
value
)
{
{
int
retval
=
0
;
int
retval
;
u8
data
;
u8
data
;
trackpoint_read
(
ps2dev
,
loc
,
&
data
);
retval
=
trackpoint_read
(
ps2dev
,
loc
,
&
data
);
if
(
retval
)
return
retval
;
if
(((
data
&
mask
)
==
mask
)
!=
!!
value
)
if
(((
data
&
mask
)
==
mask
)
!=
!!
value
)
retval
=
trackpoint_toggle_bit
(
ps2dev
,
loc
,
mask
);
retval
=
trackpoint_toggle_bit
(
ps2dev
,
loc
,
mask
);
...
@@ -142,9 +129,9 @@ static ssize_t trackpoint_set_int_attr(struct psmouse *psmouse, void *data,
...
@@ -142,9 +129,9 @@ static ssize_t trackpoint_set_int_attr(struct psmouse *psmouse, void *data,
return
err
;
return
err
;
*
field
=
value
;
*
field
=
value
;
trackpoint_write
(
&
psmouse
->
ps2dev
,
attr
->
command
,
value
);
err
=
trackpoint_write
(
&
psmouse
->
ps2dev
,
attr
->
command
,
value
);
return
count
;
return
err
?:
count
;
}
}
#define TRACKPOINT_INT_ATTR(_name, _command, _default) \
#define TRACKPOINT_INT_ATTR(_name, _command, _default) \
...
@@ -175,10 +162,11 @@ static ssize_t trackpoint_set_bit_attr(struct psmouse *psmouse, void *data,
...
@@ -175,10 +162,11 @@ static ssize_t trackpoint_set_bit_attr(struct psmouse *psmouse, void *data,
if
(
*
field
!=
value
)
{
if
(
*
field
!=
value
)
{
*
field
=
value
;
*
field
=
value
;
trackpoint_toggle_bit
(
&
psmouse
->
ps2dev
,
attr
->
command
,
attr
->
mask
);
err
=
trackpoint_toggle_bit
(
&
psmouse
->
ps2dev
,
attr
->
command
,
attr
->
mask
);
}
}
return
count
;
return
err
?:
count
;
}
}
...
...
drivers/input/serio/libps2.c
View file @
ba521f1b
This diff is collapsed.
Click to expand it.
include/linux/libps2.h
View file @
ba521f1b
...
@@ -10,7 +10,13 @@
...
@@ -10,7 +10,13 @@
* the Free Software Foundation.
* the Free Software Foundation.
*/
*/
#include <linux/bitops.h>
#include <linux/mutex.h>
#include <linux/types.h>
#include <linux/wait.h>
#define PS2_CMD_SETSCALE11 0x00e6
#define PS2_CMD_SETRES 0x10e8
#define PS2_CMD_GETID 0x02f2
#define PS2_CMD_GETID 0x02f2
#define PS2_CMD_RESET_BAT 0x02ff
#define PS2_CMD_RESET_BAT 0x02ff
...
@@ -20,11 +26,12 @@
...
@@ -20,11 +26,12 @@
#define PS2_RET_NAK 0xfe
#define PS2_RET_NAK 0xfe
#define PS2_RET_ERR 0xfc
#define PS2_RET_ERR 0xfc
#define PS2_FLAG_ACK 1
/* Waiting for ACK/NAK */
#define PS2_FLAG_ACK BIT(0)
/* Waiting for ACK/NAK */
#define PS2_FLAG_CMD 2
/* Waiting for command to finish */
#define PS2_FLAG_CMD BIT(1)
/* Waiting for a command to finish */
#define PS2_FLAG_CMD1 4
/* Waiting for the first byte of command response */
#define PS2_FLAG_CMD1 BIT(2)
/* Waiting for the first byte of command response */
#define PS2_FLAG_WAITID 8
/* Command execiting is GET ID */
#define PS2_FLAG_WAITID BIT(3)
/* Command executing is GET ID */
#define PS2_FLAG_NAK 16
/* Last transmission was NAKed */
#define PS2_FLAG_NAK BIT(4)
/* Last transmission was NAKed */
#define PS2_FLAG_ACK_CMD BIT(5)
/* Waiting to ACK the command (first) byte */
struct
ps2dev
{
struct
ps2dev
{
struct
serio
*
serio
;
struct
serio
*
serio
;
...
@@ -36,21 +43,22 @@ struct ps2dev {
...
@@ -36,21 +43,22 @@ struct ps2dev {
wait_queue_head_t
wait
;
wait_queue_head_t
wait
;
unsigned
long
flags
;
unsigned
long
flags
;
u
nsigned
char
cmdbuf
[
8
];
u
8
cmdbuf
[
8
];
u
nsigned
char
cmdcnt
;
u
8
cmdcnt
;
u
nsigned
char
nak
;
u
8
nak
;
};
};
void
ps2_init
(
struct
ps2dev
*
ps2dev
,
struct
serio
*
serio
);
void
ps2_init
(
struct
ps2dev
*
ps2dev
,
struct
serio
*
serio
);
int
ps2_sendbyte
(
struct
ps2dev
*
ps2dev
,
u
nsigned
char
byte
,
int
timeout
);
int
ps2_sendbyte
(
struct
ps2dev
*
ps2dev
,
u
8
byte
,
unsigned
int
timeout
);
void
ps2_drain
(
struct
ps2dev
*
ps2dev
,
int
maxbytes
,
int
timeout
);
void
ps2_drain
(
struct
ps2dev
*
ps2dev
,
size_t
maxbytes
,
unsigned
int
timeout
);
void
ps2_begin_command
(
struct
ps2dev
*
ps2dev
);
void
ps2_begin_command
(
struct
ps2dev
*
ps2dev
);
void
ps2_end_command
(
struct
ps2dev
*
ps2dev
);
void
ps2_end_command
(
struct
ps2dev
*
ps2dev
);
int
__ps2_command
(
struct
ps2dev
*
ps2dev
,
unsigned
char
*
param
,
int
command
);
int
__ps2_command
(
struct
ps2dev
*
ps2dev
,
u8
*
param
,
unsigned
int
command
);
int
ps2_command
(
struct
ps2dev
*
ps2dev
,
unsigned
char
*
param
,
int
command
);
int
ps2_command
(
struct
ps2dev
*
ps2dev
,
u8
*
param
,
unsigned
int
command
);
int
ps2_handle_ack
(
struct
ps2dev
*
ps2dev
,
unsigned
char
data
);
int
ps2_sliced_command
(
struct
ps2dev
*
ps2dev
,
u8
command
);
int
ps2_handle_response
(
struct
ps2dev
*
ps2dev
,
unsigned
char
data
);
bool
ps2_handle_ack
(
struct
ps2dev
*
ps2dev
,
u8
data
);
bool
ps2_handle_response
(
struct
ps2dev
*
ps2dev
,
u8
data
);
void
ps2_cmd_aborted
(
struct
ps2dev
*
ps2dev
);
void
ps2_cmd_aborted
(
struct
ps2dev
*
ps2dev
);
int
ps2_is_keyboard_id
(
char
id
);
bool
ps2_is_keyboard_id
(
u8
id
);
#endif
/* _LIBPS2_H */
#endif
/* _LIBPS2_H */
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