Drop libevdev usage
This commit is contained in:
parent
f9164c47c4
commit
4d40065a48
3 changed files with 1 additions and 38 deletions
|
|
@ -62,7 +62,6 @@ find_package(EGL REQUIRED)
|
|||
find_package(GLESv2 REQUIRED)
|
||||
|
||||
pkg_check_modules(MIRCLIENT REQUIRED mirclient)
|
||||
pkg_check_modules(LIBEVDEV REQUIRED libevdev)
|
||||
|
||||
#####################################################################
|
||||
# Enable code coverage calculation with gcov/gcovr/lcov
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ include_directories(
|
|||
${GIO_INCLUDE_DIRS}
|
||||
${GIO-UNIX_INCLUDE_DIRS}
|
||||
${MIRCLIENT_INCLUDE_DIRS}
|
||||
${LIBEVDEV_INCLUDE_DIRS}
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${CMAKE_SOURCE_DIR}/external/process-cpp-minimal/include
|
||||
|
|
@ -70,8 +69,6 @@ target_link_libraries(anbox-core
|
|||
${Boost_LIBRARIES}
|
||||
${MIRCLIENT_LDFLAGS}
|
||||
${MIRCLIENT_LIBRARIES}
|
||||
${LIBEVDEV_LDFLAGS}
|
||||
${LIBEVDEV_LIBRARIES}
|
||||
pthread
|
||||
process-cpp
|
||||
OpenglRender)
|
||||
|
|
|
|||
|
|
@ -22,54 +22,21 @@
|
|||
|
||||
#include <stdexcept>
|
||||
|
||||
#include <libevdev/libevdev.h>
|
||||
#include <libevdev/libevdev-uinput.h>
|
||||
|
||||
namespace anbox {
|
||||
InputChannel::InputChannel() :
|
||||
dev_(nullptr) {
|
||||
}
|
||||
|
||||
InputChannel::~InputChannel() {
|
||||
if (dev_)
|
||||
libevdev_uinput_destroy(dev_);
|
||||
}
|
||||
|
||||
void InputChannel::setup(int width, int height) {
|
||||
DEBUG("");
|
||||
auto dev = libevdev_new();
|
||||
libevdev_set_name(dev, "anbox-tp");
|
||||
|
||||
libevdev_enable_event_type(dev, EV_ABS);
|
||||
struct input_absinfo mt_tracking_id = { 0, 0, 255, 0, 0, 0 };
|
||||
libevdev_enable_event_code(dev, EV_ABS, ABS_MT_TRACKING_ID, &mt_tracking_id);
|
||||
struct input_absinfo mt_slot = { 0, 0, 255, 0, 0, 0 };
|
||||
libevdev_enable_event_code(dev, EV_ABS, ABS_MT_SLOT, &mt_slot);
|
||||
struct input_absinfo mt_pos_x = { 0, 0, width, 0, 0, 0 };
|
||||
libevdev_enable_event_code(dev, EV_ABS, ABS_MT_POSITION_X, &mt_pos_x);
|
||||
struct input_absinfo mt_pos_y = { 0, 0, height, 0, 0, 0 };
|
||||
libevdev_enable_event_code(dev, EV_ABS, ABS_MT_POSITION_Y, &mt_pos_y);
|
||||
struct input_absinfo mt_pressure = { 0, 0, 5, 0, 0, 0 };
|
||||
libevdev_enable_event_code(dev, EV_ABS, ABS_MT_PRESSURE, &mt_pressure);
|
||||
|
||||
libevdev_enable_event_type(dev, EV_SYN);
|
||||
|
||||
libevdev_enable_property(dev, INPUT_PROP_DIRECT);
|
||||
|
||||
if (libevdev_uinput_create_from_device(dev, LIBEVDEV_UINPUT_OPEN_MANAGED, &dev_) < 0) {
|
||||
libevdev_free(dev);
|
||||
BOOST_THROW_EXCEPTION(std::runtime_error("Failed to create uinput based device"));
|
||||
}
|
||||
}
|
||||
|
||||
void InputChannel::push_event(const Event &event) {
|
||||
libevdev_uinput_write_event(dev_, event.type, event.code, event.value);
|
||||
}
|
||||
|
||||
std::string InputChannel::dev_path() const {
|
||||
if (!dev_)
|
||||
return "";
|
||||
|
||||
return std::string(libevdev_uinput_get_devnode(dev_));
|
||||
return "";
|
||||
}
|
||||
} // namespace anbox
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue