src/core/linux


Log

Author Commit Date CI Message
Luca Weiss 040bd7a9 2020-12-28T00:55:28 Fix udev not detecting ID_INPUT_KEY devices when udev is not running https://bugzilla.libsdl.org/show_bug.cgi?id=5308 The udev code labels devices that are found by this code with ID_INPUT_KEY which in turn gets used by SDL to label the devices as SDL_UDEV_DEVICE_KEYBOARD. This was missing for the code path when udev is not running and as such devices such as the power button of a phone was not detected as keyboard input and no devices were emitted.
Sam Lantinga bfffa275 2020-12-14T09:23:53 Fixed bug 5397 - Fcitx input is truncated sowfelicity Split the long text input event into multiple shorten text input event.
Ozkan Sezer 15cbddf4 2020-12-13T18:00:20 linux/SDL_threadprio.c: fix build on older systems: SCHED_RESET_ON_FORK is in kernel >= 2.6.32.
Sam Lantinga cb361896 2020-12-09T07:16:22 Fixed bug 5235 - All internal sources should include SDL_assert.h Ryan C. Gordon We should really stick this in SDL_internal.h or something so it's always available.
Sam Lantinga 1822f97e 2020-11-11T19:37:47 Fixed bug 5346 - Add FreeBSD evdev KBIO keyboard input driver wahil1976 This patch adds the KBIO text input driver for FreeBSD, which allows text input to fully work without text spilling out into the console. It also supports accented input, AltGr keys and Alt Lock combinations. Tested with US accent keys layout and various AltGr layouts.
Simon McVittie aae53d59 2020-11-11T19:15:09 evdev: Detect whether input devices are accelerometers Anything with X, Y and Z axes but no buttons is probably an accelerometer (this is the assumption made in udev). Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie fdd945f2 2020-11-11T19:14:52 joystick: Use a better heuristic to guess what is a joystick Previously we only checked for at least one button or key and at least the X and Y absolute axes, but this has both false positives and false negatives. Graphics tablets, trackpads and touchscreens all have buttons and absolute X and Y axes, but we don't want to detect those as joysticks. On normal Linux systems ordinary users do not have access to these device nodes, but members of the 'input' group do. Conversely, some game controllers only have digital buttons and no analogue axes (the Nintendo Wiimote is an example), and some have axes and no buttons (steering wheels or flight simulator rudders might not have buttons). Use the more elaborate heuristic factored out from SDL's udev code path to handle these cases. In an ideal world we could use exactly the same heuristic as udev's input_id builtin, but that isn't under a suitable license for inclusion in SDL, so we have to use a parallel implementation of something vaguely similar. Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie 8db3171b 2020-11-11T19:14:34 udev: Factor out SDL_EVDEV_GuessDeviceClass This works on capability bitfields that can either come from udev or from ioctls, so it is equally applicable to both udev and non-udev input device detection. Signed-off-by: Simon McVittie <smcv@collabora.com>
Sam Lantinga 07eae7d6 2020-11-11T08:47:18 Fix process randomly getting killed when SDL_THREAD_PRIORITY_HIGH/TIME_CRITICAL is set When we request realtime priority from rtkit, we have a rttime limit. If we exceed that limit, the kernel will send SIGKILL to the process to terminate it. This isn't something that most high priority processes will want, only processes that selectively opt into SCHED_RR/FIFO through SDL_HINT_THREAD_PRIORITY_POLICY should be subject to this level of scrutiny. This change: * Switches non-apple posix OSs to use SCHED_OTHER instead of SCHED_RR for SDL_THREAD_PRIORITY_HIGH/SDL_THREAD_PRIORITY_TIME_CRITICAL. * Fixes using a hardcoded RLIMIT_RTTIME, instead queries it from rtkit * Only sets RLIMIT_RTTIME for MakeRealtime rtkit requests * Adds a note regarding the possible SIGKILL with SDL_HINT_THREAD_PRIORITY_POLICY * Introduces SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL to allow apps to acquire realtime scheduling policies on Linux
Sam Lantinga 94924f01 2020-11-09T10:11:55 Fix failing to set high priority for threads on Linux desktop. Debugging inside rtkit showed we were failing the RLIMIT_RTTIME check, now that we're asking for realtime and not just high-priority due to a change in SDL. Between that and the DBus code in SDL being wrong in previous changelist I'm not sure how this could have ever worked.
Sam Lantinga abf9dfd5 2020-11-09T10:11:38 Fix MakeThreadRealtime DBus method call on Linux, type mismatch due to copy paste. Nov 02 20:34:15 redcore rtkit-daemon[2825]: Failed to parse MakeThreadRealtime() method call: Argument 1 is specified to be of type "uint32", but is actually of type "int32" Nov 02 20:34:15 redcore rtkit-daemon[2825]: Failed to parse MakeThreadRealtime() method call: Argument 1 is specified to be of type "uint32", but is actually of type "int32" Docs: http://git.0pointer.net/rtkit.git/tree/README CLIENTS: To be able to make use of realtime scheduling clients may request so with a small D-Bus interface that is accessible on the interface org.freedesktop.RealtimeKit1 as object /org/freedesktop/RealtimeKit1 on the service org.freedesktop.RealtimeKit1: void MakeThreadRealtime(u64 thread_id, u32 priority); void MakeThreadHighPriority(u64 thread_id, s32 priority);
Ozkan Sezer 4ba0a847 2020-06-22T23:24:02 core/linux/SDL_threadprio.c: fix build against older glibc versions
Sam Lantinga cced5eb9 2020-06-04T09:23:18 Fixed bug 5169 - Can not build current sources because of recent thread management changes Manuel Alfayate Corchete I'm trying to build SDL2 with threads support here in GNU/Linux, both X86 and ARM, and it does not seem to be possible ATM: /home/manuel/src/SDLLLL/src/core/linux/SDL_threadprio.c:233:26: error: 'rtkit_max_realtime_priority' undeclared (first use in this function)
Sam Lantinga cc2fe84d 2020-05-26T13:19:48 Getting closer.
Sam Lantinga 0713c579 2020-05-26T13:19:44 More Linux fixes.
Sam Lantinga abd58418 2020-05-26T13:19:19 Make some changes to SDL_SetThreadPriority to try and have SDL transparently handle more of the work. 1. Comment that SDL_SetThreadPriority will make any necessary system changes when applying priority. 2. Add a hint to override SDL's default behavior for scheduler policy. 3. Modify the pthreads SDL_SetThreadPriority so that instead of just using the current thread scheduler policy it will change it to a policy that should work best for the requested priority. 4. Add hint checks in SDL_SetThreadPriority so that #3 can be overridden if desired. 5. Modify the Linux SDL_SetThreadPriority so that in the case that policy, either by SDL defaults or from the hint, is a realtime policy it uses the realtime rtkit API. 6. Prior to calling rtkit on Linux make the necessary thread state changes that rtkit requires. Currently this is done every time as it isn't expected that SDL_SetThreadPriority will be called repeatedly for a thread.
Sam Lantinga eadc8693 2020-05-11T14:31:04 Fixed bug 5103 - Port fcitx support to both fcitx 4 & 5 wengxt Due to the new major fcitx version is coming close, the existing code need to be ported to use new Fcitx dbus interface. The new dbus interface is supported by both fcitx 4 and 5, and has a good side effect, which is that it will work with flatpak for free. Also the patch remove the dependency on fcitx header. Instead, it just hardcodes a few enum value in the code so need to handle the different header for fcitx4 or 5.
Sam Lantinga ba95fa61 2020-04-08T08:42:09 Revert "Fix incorrectly terminated MakeThreadHighPriority dbus message" The first terminator is for input parameters. The second terminator was for the output parameters. If an error occurs when calling MakeThreadHighPriority(), e.g. a bad thread id, then the reply from connection_send_with_reply_and_block() will be null.
Sam Lantinga f4a56d7e 2020-03-30T14:26:15 Enable thread-safety features in libdbus There are multiple SDL APIs that internally sink into dbus calls, e.g. battery status, thread priority. If those calls happen in different threads simultaneously it can result in dbus crashes. To abide by dbus's multithreading guidelines we must call dbus_threads_init_default() to enable dbus's internal locking mechanisms: https://dbus.freedesktop.org/doc/api/html/group__DBusThreads.html#gac7b8a7001befc3eaa8c6b043151008dc Additionally, access to a DBusMessage must be synchronized between threads. SDL was already abiding that guideline as the DBusMessage structs aren't shared. The following email from the dbus mailing list hints that arbitrating access to the DBusConnection on the SDL may also be required: https://lists.freedesktop.org/archives/dbus/2017-September/017306.html
Sam Lantinga 2e667a8b 2020-03-30T14:26:10 Fix incorrectly terminated MakeThreadHighPriority dbus message Currently the message is double terminated, which results in SDL_DBus_CallMethodInternal() incorrectly assuming that the other party is always returning true. I'm not super familiar with dbus, so I'm not sure if this could also be the cause of this bug: https://github.com/ValveSoftware/steam-for-linux/issues/6901
Ryan C. Gordon 369e5f33 2020-03-26T20:28:04 dbus: System bus is optional, we only need a session bus (thanks, tamo!). Fixes Bugzilla #4795.
Fabrice Fontaine cbc65ce8 2020-02-10T13:56:53 src/core/linux/SDL_threadprio.c: fix build without threads Add an include on SDL_error.h to avoid the following build failure without threads: /home/buildroot/autobuild/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabihf/8.3.0/../../../../arm-buildroot-linux-uclibcgnueabihf/bin/ld: build/.libs/SDL_threadprio.o: in function `SDL_LinuxSetThreadPriority_REAL': SDL_threadprio.c:(.text+0x0): undefined reference to `SDL_Unsupported' Fixes: - http://autobuild.buildroot.org/results/7f7712c5bd47de4a3fcec1e0d0526fd5a3ecd532 Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Sam Lantinga a8780c6a 2020-01-16T20:49:25 Updated copyright date for 2020
Sam Lantinga 2bfcf5cd 2019-11-18T14:08:05 Added Linux controller mapping for the Xbox One Elite Series 2 controller in Bluetooth mode
Ryan C. Gordon a747106c 2019-10-09T19:38:16 linux: If D-Bus isn't available on the system, don't keep trying to load it. Fixes Bugzilla #4476.
Sam Lantinga 191fe25b 2019-09-27T15:21:31 Fixed rtkit feature guard
Sam Lantinga 84dc44e2 2019-09-27T15:21:27 Fix the RealtimeKit dbus include guards The SDL_USE_LIBDBUS define is set inside SDL_debug.h, therefore the circular dependency made it impossible for this feature to be enabled. Instead, guard SDL_dbus.h based on the autoconf variable HAVE_DBUS_DBUS_H Additionally, fix one of the rtkit comments. CAP_SYS_NICE isn't required to achieve high priority. But there is some scheduler config that rtkit needs the app to setup.
Sam Lantinga aaec90e5 2019-09-06T08:42:54 Fixed bug 4789 - Linux accelerometers no longer available as joysticks Daniel Drake A long time ago, it was possible to play neverball on Linux using the accelerometer found in HP laptops. The kernel exposes the accelerometer as a joystick (/dev/input/jsX) as well as an evdev device (/dev/input/eventX). I guess it worked fine when SDL was using the js interface, but then stopped working here: http://hg.libsdl.org/SDL/rev/fdaeea9e7567 Looking at current code which uses udev to discover joysticks, it looks for the udev tag ID_INPUT_JOYSTICK. However udev's internal input_id logic specifically tags accelerometers as ID_INPUT_ACCELEROMETER and nothing else. This looks like a good fit for SDL_HINT_ACCELEROMETER_AS_JOYSTICK.
Alex Szpakowski 109cbd6e 2019-08-04T16:56:40 Fix touch-related compile errors on Linux.
Alex Szpakowski d5ec735a 2019-08-01T18:22:12 Add a windowID field to SDL_TouchFingerEvent (bug #4331). This is unimplemented on some platforms and will cause compile errors when building those platform backends for now.
Sam Lantinga 67bb882e 2019-07-03T15:57:55 Fixed bug 4707 - SDL_SetRelativeMouseMode fails on Vivante Cameron Gutman The bugfix in https://hg.libsdl.org/SDL/rev/ca9417a52f18 caused SDL_SetRelativeMouseMode() to begin failing on Vivante (Steam Link). Even though Vivante doesn't have a SetRelativeMouseMode() or WarpMouse() function, it's in relative mode already (because it uses evdev) so the function was actually working as intended. I think providing a no-op SetRelativeMouseMode() function for Vivante is a reasonable fix. Since it's already getting relative events through evdev, it really is a no-op to "enter relative mode". In fact, this is probably the right thing to do for all backends that use evdev (vivante, raspberry, and kmsdrm). Raspberry and kmsdrm both have WarpMouse() implementations so SDL_SetRelativeMouseMode() isn't failing there, but it still seems to make sense not to have to do the fake warping if they're evdev-based anyway.
Ryan C. Gordon d5ebbcb4 2019-07-02T09:43:26 dbus: Don't SimulateUserActivity if we're already inhibiting the screensaver.
Ryan C. Gordon 94658099 2019-07-02T09:38:31 dbus: Add org.freedesktop.ScreenSaver.SimulateUserActivity support.
Sam Lantinga 6c4765a1 2019-06-17T11:10:20 Removed extraneous fprintf() call
Sam Lantinga 93a5e4ce 2019-06-17T08:38:33 Fixed bug 4667 - Build errors on Linux when building without Threads support Manuel Sabogal There is an issue on the latest commit of the mercurial repo when SDL_THREADS_DISABLED is set: src/core/linux/SDL_threadprio.c:79:28: error: unknown type name 'Sint64'; did you mean 'int'
Sam Lantinga d01150ab 2019-06-12T07:55:48 Fixed bug 4665 - Add support for single touch evdev devices Jan Martin Mikkelsen The attached patch adds support for single-touch evdev devices. These devices report ABS_X, ABS_Y and BTN_TOUCH events. This patch sets them up as MT devices with a single slot and handles the appropriate messages.
Sam Lantinga 23569362 2019-06-05T12:01:26 Use SDL sized types
Sam Lantinga 3e329464 2019-06-05T08:54:07 Fixed bug 4656 - SDL_evdev.c uses Linux specific integer types Jan Martin Mikkelsen The file src/core/linux/SDL_evdev.c uses the Linux specific types __u32 and __s32. This breaks things on FreeBSD when building with evdev.
Sylvain Becker ab03892d 2019-04-04T15:19:00 Bug 4576: track both FingerId and TrackId
Sylvain Becker 6bc2d9de 2019-04-02T17:03:58 Bug 4576: remove touch/mouse duplication for linux/EVDEV
Sylvain Becker 052b4f29 2019-03-12T14:20:37 SDL_EVDEV_kbd_init: uninitialized data for ioctl (Bug 4530) Only two chars are used but the full prototype is: int tioclinux(struct tty_struct *tty, unsigned long arg) ==5010== Syscall param ioctl(TIOCLINUX) points to uninitialised byte(s) ==5010== at 0x53E73C7: ioctl (syscall-template.S:78) ==5010== by 0x4A887DA: SDL_EVDEV_Init (SDL_evdev.c:163) ==5010== by 0x4A7D157: KMSDRM_VideoInit (SDL_kmsdrmvideo.c:509) ==5010== by 0x497D959: SDL_VideoInit_REAL (SDL_video.c:529) ==5010== by 0x487ACBC: SDL_InitSubSystem_REAL (SDL.c:171) ==5010== by 0x487B052: SDL_Init_REAL (SDL.c:256) ==5010== by 0x488F7D6: SDL_Init (SDL_dynapi_procs.h:85)
Ryan C. Gordon 861a21f9 2019-01-14T19:43:25 evdev: don't debug log on a BTN_TOUCH from a non-touch device.
Ryan C. Gordon 2755a505 2019-01-14T19:36:54 evdev: Add touchscreen mouse emulation and pressure support (thanks, Zach!). This also solves reports of this log message: "INFO: The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list <https://discourse.libsdl.org/> EVDEV KeyCode 330" (EVDEV KeyCode 330 is BTN_TOUCH.) Fixes Bugzilla #4147.
Sam Lantinga 5e13087b 2019-01-04T22:01:14 Updated copyright for 2019
Ryan C. Gordon c7b71371 2018-12-05T17:53:38 Whoops, forgot to add a new source file. :/
Ryan C. Gordon 1689e9f9 2018-12-05T16:51:22 linux: Move SDL_LinuxSetThreadPriority() elsewhere to fix build. Fixes Bugzilla #4393.
Ryan C. Gordon fac40f8e 2018-12-01T11:14:20 Patched to compile on Linux with threads enabled. (whoops!)
Ryan C. Gordon c4bc59a5 2018-12-01T10:36:26 Patched to compile on Linux with --disable-threads. Fixes Bugzilla #4393.
Alex Szpakowski 5029d50e 2018-11-10T16:15:48 Add SDL_TouchDeviceType enum and SDL_GetTouchDeviceType(SDL_TouchID id). Touch device types include SDL_TOUCH_DEVICE_DIRECT (a touch screen with window-relative coordinates for touches), SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE (a trackpad-style device with absolute device coordinates), and SDL_TOUCH_DEVICE_INDIRECT_RELATIVE (a trackpad-style device with screen cursor-relative coordinates). Phone screens are an example of a direct device type. Mac trackpads are the indirect-absolute touch device type. The Apple TV remote is an indirect-relative touch device type.
Sam Lantinga 9af581bd 2018-10-31T15:01:20 Fixed bug 4347 - Keyboard LEDs don't work on linux console Rainer Sabelka When using SLD2 on a Linux console with the KMS/DRM video backend and Linux evdev keyboard support, the caps lock, scroll lock, and num lock leds do not work. The attached patch adds ioctls for setting the LED state in SDL_evdev_kbd.c
Micha? Janiszewski 91820998 2018-10-28T21:36:48 Add and update include guards Include guards in most changed files were missing, I added them keeping the same style as other SDL files. In some cases I moved the include guards around to be the first thing the header has to take advantage of any possible improvements compiler may have for inclusion guards.
Ryan C. Gordon 93fb710a 2018-10-03T16:54:24 evdev: Don't initialize struct sigaction with "{ 0 }". It causes warnings on some platforms, depending on the actual definition of sigaction, and since this is static data, it'll be zero'd out anyhow.
Sam Lantinga cd90e2ca 2018-09-24T16:33:14 Fixed bug 4267 - linkage failure with --enable-hidapi because of missing libudev symbols Ozkan Sezer hidapi dynamic udev initial patch
Sam Lantinga 5febdfce 2018-09-24T11:49:25 Fixed whitespace
Ozkan Sezer b6aaefc7 2018-08-29T11:04:02 SDL_evdev.c: undefine _THIS before redefining it. src/core/linux/SDL_evdev.c:104:1: warning: "_THIS" redefined In file included from src/core/linux/../../events/SDL_events_c.h:26, from src/core/linux/SDL_evdev.c:45: src/core/linux/../../events/../video/SDL_sysvideo.h:146:1: warning: this is the location of the previous definition
Ryan C. Gordon f59b0056 2018-08-07T16:56:46 evdev: On sudden termination, make sure keyboard isn't lost (thanks, Tadek!) "In release 2.0.6, when Linux evdev keyboard support has been moved to a separate source file, a feature was added to disable normal keyboard event processing to prevent "spilling" keystrokes to background virtual console. This feature has one unpleasant side effect: if application fails to call `SDL_Exit` before termination or crashes with fatal signal, console is left in unusable state with keyboard not working and no possibility to switch virtual console. If user has a chance, he can login remotely and restore keyboard with `kbd_mode`, otherwise the only option is to reboot the machine. This patch fixes that problem by intercepting fatal signals (with `sigaction`) and process termination (with `atexit`), to restore keyboard state, if it wasn't properly restored with `SDL_Exit`. The function registered with `atexit` also restores original signal handlers, to prevent leaving invalid handlers after SDL library is unloaded, if it was loaded dynamically with `dlopen`. No signal handlers or `atexit` function are installed if SDL boolean hint `SDL_HINT_NO_SIGNAL_HANDLERS` is `SDL_TRUE`. Additionally, if environment variable `SDL_INPUT_LINUX_KEEP_KBD` exists, keyboard initialization function completely skips disabling keyboard. This can be useful for debugging." Fixes Bugzilla #4193.
Ryan C. Gordon b5a420cb 2018-07-13T17:53:24 dbus: Deal with undefined behavior with va_args. Parse out a copy of the varargs ourselves to get to the reply portion, since the original passed to D-Bus might modify or not modify the caller's copy, depending on system ABI.
Sam Lantinga 9924a8e3 2018-06-14T00:51:45 Fixed bug 4094 - No SDL_TEXTEDITING after pressing Alt key on Raspberry Pi Linux This was reproducible by running an SDL app on the console from an ssh login. In this case the terminal wasn't owned by the user running the app, so we were using the default keymap, which didn't have state transitions defined for ctrl and alt, so once we entered that state keypresses would no longer transition out of that state, nor would they generate text. As a workaround, we'll just reset to the default shift state if that happens, which means we'll get text for keys pressed while ctrl is held down, but I don't think that's a big problem. Note that in this case we also can't mute the keyboard, so the keypresses go to the console, which probably isn't what you want...
Sam Lantinga f6366c09 2018-02-13T08:15:39 Fixed bug 3920 - IBus not work with SDL 2.0.7 cjacker After updating from 2.0.5 to 2.0.7, Ibus not work anymore(fcitx still works). Compare with 2.0.5, there are two issues in SDL_ibus.c. 1, SetupConnection always return SDL_FALSE in 2.0.7. 2, 'SetCapabilities' method should be called on 'ibus_conn'. Patch attached.
Sam Lantinga 714085d3 2018-02-13T08:07:52 Fixed bug 3950 - Don't always call dbus_shutdown in SDL_DBus Alexander Larsson dbus_shutdown() is a debug feature which closes all global resources in the dbus library. Calling this should be done by the app, not a library, because if there are multiple users of dbus in the process then SDL could shut it down even though another part is using it. For example, i had an issue with this in mGBA, which uses both Qt and SDL, both using libdbus. I had a session bus, but no system bus (this was in a flatpak sandbox), and when SDL_DBus_Init() failed to init the system bus it called dbus_shudown() and continued on. This caused issues for Qt when running due to its session bus connections having disappeared beneath it.
sezero 40b27fd5 2018-02-12T17:00:00 revert the recent typecast assignment changes (see bug #4079) also change the void* typedefs for the two vulkan function pointers added in vulkan_internal.h into generic function pointer typedefs.
Sam Lantinga 90e72bf4 2018-01-30T18:08:34 Fixed ISO C99 compatibility SDL now builds with gcc 7.2 with the following command line options: -Wall -pedantic-errors -Wno-deprecated-declarations -Wno-overlength-strings --std=c99
Sam Lantinga e3cc5b2c 2018-01-03T10:03:25 Updated copyright for 2018
Ethan Lee 84fb4893 2017-10-10T20:22:15 Check SDL_UDEV_DYNAMIC first, then SDL_UDEV_LIBS separately
Sam Lantinga 312da262 2017-10-05T09:37:28 Fixed bug 3854 - arguments to dbus_type_is_basic() were incorrect Aaron As of 2.0.6, all of my games are failing with the following error: process 31778: arguments to dbus_type_is_basic() were incorrect, assertion "dbus_type_is_valid (typecode) || typecode == DBUS_TYPE_INVALID" failed in file dbus-signature.c line 322. This is normally a bug in some application using the D-Bus library. D-Bus not built with -rdynamic so unable to print a backtrace (patch by Ozkan Sezer)
Brandon Schaefer e564da78 2017-09-29T10:15:44 revert files I didnt mean to commit!
Brandon Schaefer e27f12e0 2017-09-29T10:07:37 wayland: Fix bug 3814 -Wmissing-field-initializers
Sam Lantinga fb835f9e 2017-08-14T20:22:19 Fixed bug 2330 - Debian bug report: SDL2 X11 driver buffer overflow with large X11 file descriptor manuel.montezelo Original bug report (note that it was against 2.0.0, it might have been fixed in between): http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=733015 -------------------------------------------------------- Package: libsdl2-2.0-0 Version: 2.0.0+dfsg1-3 Severity: normal Tags: patch I have occasional crashes here caused by the X11 backend of SDL2. It seems to be caused by the X11_Pending function trying to add a high number (> 1024) file descriptor to a fd_set before doing a select on it to avoid busy waiting on X11 events. This causes a buffer overflow because the file descriptor is larger (or equal) than the limit FD_SETSIZE. Attached is a possible workaround patch. Please also keep in mind that fd_set are also used in following files which may have similar problems. src/audio/bsd/SDL_bsdaudio.c src/audio/paudio/SDL_paudio.c src/audio/qsa/SDL_qsa_audio.c src/audio/sun/SDL_sunaudio.c src/joystick/linux/SDL_sysjoystick.c -------------------------------------------------------- On Tuesday 24 December 2013 00:43:13 Sven Eckelmann wrote: > I have occasional crashes here caused by the X11 backend of SDL2. It seems > to be caused by the X11_Pending function trying to add a high number (> > 1024) file descriptor to a fd_set before doing a select on it to avoid busy > waiting on X11 events. This causes a buffer overflow because the file > descriptor is larger (or equal) than the limit FD_SETSIZE. I personally experienced this problem while hacking on the python bindings package for SDL2 [1] (while doing make runtest). But it easier to reproduce in a smaller, synthetic testcase.
Sam Lantinga de91b124 2017-08-14T06:28:21 Fixed bug 3745 - specify SDLCALL as the calling convention for API callbacks Patches contributed by Ozkan Sezer
Brandon Schaefer be005b7c 2017-07-28T12:00:10 evdev: Fix 'Syscall param ioctl(TIOCLINUX) points to uninitialised byte' https://pastebin.com/raw/tQjG0kG0
Philipp Wiesemann a725efa4 2017-06-15T23:30:50 linux: Fixed using wrong constant for input text size.
Philipp Wiesemann 22c221f3 2017-06-11T22:30:58 linux: Changed internal functions to be static.
Ryan C. Gordon b135557d 2017-05-29T02:48:51 linux: Don't crash if fcitx support is requested but unavailable. Fixes Bugzilla #3642.
Ryan C. Gordon a1faea98 2017-05-29T00:54:08 fcitx: removed incompatibly-licensed code.
Ryan C. Gordon 1c5f483a 2017-05-29T00:51:02 linux: removed IBus_utf8_strlen(), use SDL_utf8strlen() instead.
Ryan C. Gordon 643f1cb7 2017-05-28T07:14:11 power: Add Linux org.freedesktop.UPower D-Bus implementation. Fixes Bugzilla #3485. (I think.)
Ryan C. Gordon b3f94acb 2017-05-28T07:11:52 linux: Simplify D-Bus interface, remove lots of boilerplate.
Ryan C. Gordon 191f578b 2017-05-28T07:08:10 linux: Make system D-Bus connection available (in addition to session).
Philipp Wiesemann 90ed3daa 2017-05-26T22:45:52 Changed messages about not recognized keys to include discourse link.
Philipp Wiesemann f6eb23a6 2017-04-09T23:00:42 linux: Changed two variables to be static.
Philipp Wiesemann 42d02890 2017-03-04T23:05:11 Linux: Fixed error message.
Sam Lantinga ad7c26ff 2017-01-09T11:58:01 We only need the first few keymaps corresponding to the following constants: K_NORMTAB, K_SHIFTTAB, K_ALTTAB, K_ALTSHIFTTAB In the normal case we'll load all the keymaps from the kernel, but this reduces the size of the SDL library for the fallback case when we can't get to the tty.
Sam Lantinga e0a40fb6 2017-01-09T02:54:42 Implemented full evdev keyboard text support This is based on the Linux kernel driver, and has fallback mapping tables in case we aren't connected to a virtual terminal.
Sam Lantinga 49292705 2017-01-08T20:03:18 Fixed bug 3545 - SDL_EVDEV_do_text_input() may be too eager to find error cases Rob I've ran into an issue where I successfully receive SDL_KEY[UP,DOWN] events but not SDL_TEXTINPUT or SDL_TEXTEDITING. In my case the code in SDL_EVDEV_do_text_input() is returning early (on error) prior to calling SDL_SendKeyboardText(). I'm running on the RaspberryPi 3, without X11. In SDL_EVDEV_do_text_input() there is a condition to check keysyms with a type value below 0xf0, then subtract 0xf0 from type. Without understanding the purpose of this code, I disabled it, recompiled, and I'm getting correct SDL_TEXTINPUT events. I'm going to guess that my hack/fix is going to be problematic in some other environment, but after some initial testing it looks like everything is running fine in my setup.
Sam Lantinga 7b66295e 2017-01-08T19:04:38 Removed console check, let the kernel decide whether muting is appropriate on this terminal. We don't fail the init if we can't mute the terminal (we might be running from ssh, or on a system without virtual terminals, etc.)
Sam Lantinga b8ab4eb9 2017-01-08T10:15:22 SDL_evdev.c: fix building against old kernel headers (K_OFF may not be defined.)
Sam Lantinga 7e505b0d 2017-01-07T16:49:23 Don't fail if we can't open the tty, this can be a legitimate use case.
Ryan C. Gordon 61a3ba30 2017-01-07T17:09:14 Replaced a few single-line "//" comments.
Sam Lantinga e9c2dcda 2017-01-07T10:13:04 Fixed bug 3469 - Keypresses leak to the console with 2.0.5 tvc I believe this patch should fix it, instead of looping through all the tty's and seemingly selecting the wrong one and corrupting the console I've just made SDL open /dev/tty which is the console attached to the current process anyway.
Sam Lantinga 41be9756 2017-01-05T23:26:13 Fixed bug 3546 - SDL_EVDEV_is_console() uses type of wrong size when calling ioctl Rob When calling ioctl(fd, KDGKBTYPE, &type) in SDL_EVDEV_is_console(), we declare type as an 'int'. This should be a 'char'. The subsequent syscall, and kernel code, only writes the lower byte of the word. See: http://lxr.free-electrons.com/source/drivers/tty/vt/vt_ioctl.c?v=4.4#L399 ucval = KB_101; ret = put_user(ucval, (char __user *)arg); I've observed intermittent behavior related to this, and I can force an error condition by using an int initialized to 0xFFFFFFFF. The resulting ioctl will set type to 0XFFFFFF02, and the conditional return in SDL_EVDEV_is_console() will fail. Recommend changing to char, or masking off unused bits.
Sam Lantinga 45b774e3 2017-01-01T18:33:28 Updated copyright for 2017
Sam Lantinga b4e069e7 2016-12-26T02:12:21 Fixed bug 3517 - Compiler warnings with gcc -Wstrict-prototypes felix Compiling even a simple SDL2 'hello world' program with gcc -Wstrict-prototypes (GCC 6.2.1) results in warnings like: /usr/include/SDL2/SDL_gamecontroller.h:143:1: attention : function declaration isn't a prototype [-Wstrict-prototypes] extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(); ^~~~~~ It seems there is a missing 'void' between the parentheses.
Sam Lantinga 1e8f074c 2016-11-29T05:34:20 Avoid conflicts with multiple versions of udev by first trying the library that is linked with the executable, if any, and then picking the one that is in the build environment. This fixes joystick detection for applications using the Steam Linux Runtime
Sam Lantinga 36156335 2016-11-20T21:34:54 Renaming of guard header names to quiet -Wreserved-id-macro Patch contributed by Sylvain
Sam Lantinga 0d24495b 2016-11-15T01:24:58 Removed unused constants Except for SDL_bmp.c where they are historically interesting and I've left them in.
Sam Lantinga 57d01d7d 2016-11-13T22:57:41 Patch from Sylvain to fix clang warnings
Sam Lantinga 539afc5d 2016-11-01T10:33:44 Fixed bug 3473 - can't build on linux with an old kernel
Philipp Wiesemann 099e8a68 2016-10-15T20:02:17 Linux: Fixed compile warnings about unused variables.
Sam Lantinga 3f38bd91 2016-10-14T08:22:48 Fixed warning about redefining DECLSPEC
Sam Lantinga 3663dbe8 2016-10-14T08:20:40 Fixed warning about missing field initializers in SDL_DBusContext Static variables are automatically initialized to zero.