Skip to content

Commit af7fa9b

Browse files
committed
Initial support for gamepads
1 parent 2b33f58 commit af7fa9b

File tree

7 files changed

+920
-0
lines changed

7 files changed

+920
-0
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ option(USE_BACKEND_WESTEROS_MESA "Whether to enable support for the gbm based of
2323
option(USE_INPUT_LIBINPUT "Whether to enable support for the libinput input backend" ON)
2424
option(USE_INPUT_UDEV "Whether to enable support for the libinput input udev lib" ON)
2525
option(USE_INPUT_WAYLAND "Whether to enable support for the wayland input backend" OFF)
26+
option(USE_GENERIC_GAMEPAD "Use generic gamepad implementation" OFF)
2627

2728
find_package(WPE REQUIRED)
2829
find_package(EGL REQUIRED)
@@ -98,6 +99,11 @@ elseif (USE_VIRTUAL_KEYBOARD)
9899
)
99100
endif()
100101

102+
if (USE_GENERIC_GAMEPAD)
103+
include(src/gamepad/CMakeLists.txt)
104+
include(src/gamepad_test/CMakeLists.txt)
105+
endif()
106+
101107
if (USE_BACKEND_BCM_NEXUS)
102108
include(src/bcm-nexus/CMakeLists.txt)
103109
endif ()

src/gamepad/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
add_definitions(-DENABLE_GAMEPAD=1)
2+
3+
list(APPEND WPE_PLATFORM_SOURCES
4+
src/gamepad/linux_gamepad.cpp
5+
)

src/gamepad/interfaces.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* If not stated otherwise in this file or this component's Licenses.txt file the
3+
* following copyright and licenses apply:
4+
*
5+
* Copyright 2020 RDK Management
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
20+
#ifndef linux_gamepad_interfaces_h
21+
#define linux_gamepad_interfaces_h
22+
23+
#include <wpe/wpe.h>
24+
25+
#ifdef __cplusplus
26+
extern "C" {
27+
#endif
28+
29+
extern struct wpe_gamepad_provider_interface gamepad_provider_interface;
30+
extern struct wpe_gamepad_interface gamepad_interface;
31+
32+
#ifdef __cplusplus
33+
}
34+
#endif
35+
36+
#endif /* linux_gamepad_interfaces_h */

0 commit comments

Comments
 (0)