/**************************************************************************/ /* joypad_linux.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* https://godotengine.org */ /**************************************************************************/ /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ /* "Software"), to deal in the Software without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of the Software, and to */ /* permit persons to whom the Software is furnished to do so, subject to */ /* the following conditions: */ /* */ /* The above copyright notice and this permission notice shall be */ /* included in all copies or substantial portions of the Software. */ /* */ /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ #ifdef JOYDEV_ENABLED #include "joypad_linux.h" #include "core/os/os.h" #include <dirent.h> #include <errno.h> #include <fcntl.h> #include <linux/input.h> #include <unistd.h> #ifdef UDEV_ENABLED #ifdef SOWRAP_ENABLED #include "libudev-so_wrap.h" #else #include <libudev.h> #endif #endif #define LONG_BITS … #define test_bit(nr, addr) … #define NBITS(x) … #ifdef UDEV_ENABLED static const char *ignore_str = …; #endif // On Linux with Steam Input Xbox 360 devices have an index appended to their device name, this index is // the Steam Input gamepad index #define VALVE_GAMEPAD_NAME_PREFIX … // IDs used by Steam Input virtual controllers. // See https://partner.steamgames.com/doc/features/steam_controller/steam_input_gamepad_emulation_bestpractices #define VALVE_GAMEPAD_VID … #define VALVE_GAMEPAD_PID … JoypadLinux::Joypad::~Joypad() { … } void JoypadLinux::Joypad::reset() { … } JoypadLinux::JoypadLinux(Input *in) { … } JoypadLinux::~JoypadLinux() { … } void JoypadLinux::monitor_joypads_thread_func(void *p_user) { … } void JoypadLinux::monitor_joypads_thread_run() { … } #ifdef UDEV_ENABLED void JoypadLinux::enumerate_joypads(udev *p_udev) { … } void JoypadLinux::monitor_joypads(udev *p_udev) { … } #endif void JoypadLinux::monitor_joypads() { … } void JoypadLinux::close_joypads() { … } void JoypadLinux::close_joypad(const char *p_devpath) { … } void JoypadLinux::close_joypad(Joypad &p_joypad, int p_id) { … } static String _hex_str(uint8_t p_byte) { … } void JoypadLinux::setup_joypad_properties(Joypad &p_joypad) { … } void JoypadLinux::open_joypad(const char *p_path) { … } void JoypadLinux::joypad_vibration_start(Joypad &p_joypad, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp) { … } void JoypadLinux::joypad_vibration_stop(Joypad &p_joypad, uint64_t p_timestamp) { … } float JoypadLinux::axis_correct(const input_absinfo *p_abs, int p_value) const { … } void JoypadLinux::joypad_events_thread_func(void *p_user) { … } void JoypadLinux::joypad_events_thread_run() { … } void JoypadLinux::process_joypads() { … } #endif // JOYDEV_ENABLED