Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_frameworks_base-old
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Farzin Kazemzadeh
platform_frameworks_base-old
Commits
8f226dcb
Commit
8f226dcb
authored
13 years ago
by
Jeff Brown
Committed by
Android Git Automerger
13 years ago
Browse files
Options
Downloads
Plain Diff
am
ca97671e
: am
6f5a837c
: Merge "Fix getSwitchState according to device capabilities."
* commit '
ca97671e
': Fix getSwitchState according to device capabilities.
parents
b4459d8d
ca97671e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/ui/EventHub.h
+1
-0
1 addition, 0 deletions
include/ui/EventHub.h
libs/ui/EventHub.cpp
+19
-6
19 additions, 6 deletions
libs/ui/EventHub.cpp
with
20 additions
and
6 deletions
include/ui/EventHub.h
+
1
−
0
View file @
8f226dcb
...
...
@@ -239,6 +239,7 @@ private:
String8
name
;
uint32_t
classes
;
uint8_t
*
keyBitmask
;
uint8_t
*
switchBitmask
;
KeyLayoutMap
*
layoutMap
;
String8
keylayoutFilename
;
int
fd
;
...
...
This diff is collapsed.
Click to expand it.
libs/ui/EventHub.cpp
+
19
−
6
View file @
8f226dcb
...
...
@@ -94,11 +94,13 @@ static inline const char* toString(bool value) {
EventHub
::
device_t
::
device_t
(
int32_t
_id
,
const
char
*
_path
,
const
char
*
name
)
:
id
(
_id
),
path
(
_path
),
name
(
name
),
classes
(
0
)
,
keyBitmask
(
NULL
),
layoutMap
(
new
KeyLayoutMap
()),
fd
(
-
1
),
next
(
NULL
)
{
,
keyBitmask
(
NULL
),
switchBitmask
(
NULL
)
,
layoutMap
(
new
KeyLayoutMap
()),
fd
(
-
1
),
next
(
NULL
)
{
}
EventHub
::
device_t
::~
device_t
()
{
delete
[]
keyBitmask
;
delete
[]
switchBitmask
;
delete
layoutMap
;
}
...
...
@@ -243,11 +245,14 @@ int32_t EventHub::getSwitchState(int32_t deviceId, int32_t sw) const {
}
int32_t
EventHub
::
getSwitchStateLocked
(
device_t
*
device
,
int32_t
sw
)
const
{
uint8_t
sw_bitmask
[
sizeof_bit_array
(
SW_MAX
+
1
)];
memset
(
sw_bitmask
,
0
,
sizeof
(
sw_bitmask
));
if
(
ioctl
(
device
->
fd
,
EVIOCGSW
(
sizeof
(
sw_bitmask
)),
sw_bitmask
)
>=
0
)
{
return
test_bit
(
sw
,
sw_bitmask
)
?
AKEY_STATE_DOWN
:
AKEY_STATE_UP
;
if
(
device
->
switchBitmask
!=
NULL
&&
test_bit
(
sw
,
device
->
switchBitmask
))
{
uint8_t
sw_bitmask
[
sizeof_bit_array
(
SW_MAX
+
1
)];
memset
(
sw_bitmask
,
0
,
sizeof
(
sw_bitmask
));
if
(
ioctl
(
device
->
fd
,
EVIOCGSW
(
sizeof
(
sw_bitmask
)),
sw_bitmask
)
>=
0
)
{
return
test_bit
(
sw
,
sw_bitmask
)
?
AKEY_STATE_DOWN
:
AKEY_STATE_UP
;
}
}
return
AKEY_STATE_UNKNOWN
;
}
...
...
@@ -759,6 +764,14 @@ int EventHub::openDevice(const char *deviceName) {
}
if
(
hasSwitches
)
{
device
->
classes
|=
INPUT_DEVICE_CLASS_SWITCH
;
device
->
switchBitmask
=
new
uint8_t
[
sizeof
(
sw_bitmask
)];
if
(
device
->
switchBitmask
!=
NULL
)
{
memcpy
(
device
->
switchBitmask
,
sw_bitmask
,
sizeof
(
sw_bitmask
));
}
else
{
delete
device
;
LOGE
(
"out of memory allocating switch bitmask"
);
return
-
1
;
}
}
#endif
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment