diff --git a/core/linux-dist/main.cpp b/core/linux-dist/main.cpp index a198afc14..5a38b072c 100755 --- a/core/linux-dist/main.cpp +++ b/core/linux-dist/main.cpp @@ -34,11 +34,22 @@ #endif #if !defined(ANDROID) && HOST_OS != OS_DARWIN && !defined(TARGET_EMSCRIPTEN) - #include #include #include #endif +#if defined(USE_EVDEV) + #ifdef TARGET_PANDORA + #define EVDEV_DEVICE "/dev/input/event4" + #else + #define EVDEV_DEVICE "/dev/event2" + #endif +#endif + +#if defined(USE_JOYSTICK) + #include +#endif + #ifdef TARGET_PANDORA #include #include @@ -190,20 +201,18 @@ int setup_input_joystick(const char* device) void SetupInput() { - #if HOST_OS != OS_DARWIN && !defined(TARGET_EMSCRIPTEN) - #ifdef TARGET_PANDORA - #define EVDEV_DEVICE "/dev/input/event4" - #else - #define EVDEV_DEVICE "/dev/event2" - #endif + #if defined(USE_EVDEV) evdev_fd = setup_input_evdev(EVDEV_DEVICE); + #endif + + #if defined(USE_JOYSTICK) joystick_fd = setup_input_joystick("/dev/input/js0"); #endif } bool HandleKb(u32 port) { - #if HOST_OS != OS_DARWIN && !defined(TARGET_EMSCRIPTEN) + #if defined(USE_EVDEV) if (evdev_fd < 0) { return false; @@ -318,7 +327,7 @@ bool HandleJoystick(u32 port) return false; } - #if HOST_OS != OS_DARWIN && !defined(TARGET_EMSCRIPTEN) + #if defined(USE_JOYSTICK) struct js_event JE; while(read(joystick_fd, &JE, sizeof(JE)) == sizeof(JE)) if (JE.number < MAP_SIZE) diff --git a/shell/linux/Makefile b/shell/linux/Makefile index 14c4ffb65..3a1c1e314 100644 --- a/shell/linux/Makefile +++ b/shell/linux/Makefile @@ -7,6 +7,8 @@ WEBUI :=1 USE_ALSA := 1 USE_OSS := 1 #USE_PULSEAUDIO := 1 +USE_EVDEV := 1 +USE_JOYSTICK := 1 CXX=${CC_PREFIX}g++ CC=${CC_PREFIX}gcc @@ -209,6 +211,14 @@ ifdef USE_X11 LIBS += -lX11 endif +ifdef USE_EVDEV + CXXFLAGS += -D USE_EVDEV +endif + +ifdef USE_JOYSTICK + CXXFLAGS += -D USE_JOYSTICK +endif + ifdef USE_ALSA CXXFLAGS += -D USE_ALSA LIBS += -lasound