|
@@ -32,10 +32,11 @@
|
|
|
#include "SDL_evdev.h"
|
|
|
#include "SDL_evdev_kbd.h"
|
|
|
|
|
|
-#include <sys/stat.h>
|
|
|
-#include <unistd.h>
|
|
|
+#include <errno.h>
|
|
|
#include <fcntl.h>
|
|
|
+#include <unistd.h>
|
|
|
#include <sys/ioctl.h>
|
|
|
+#include <sys/stat.h>
|
|
|
#include <linux/input.h>
|
|
|
|
|
|
#include "../../events/SDL_events_c.h"
|
|
@@ -674,7 +675,8 @@ static bool SDL_EVDEV_init_touchscreen(SDL_evdevlist_item *item, int udev_class)
|
|
|
ret = ioctl(item->fd, EVIOCGNAME(sizeof(name)), name);
|
|
|
if (ret < 0) {
|
|
|
SDL_free(item->touchscreen_data);
|
|
|
- return SDL_SetError("Failed to get evdev touchscreen name");
|
|
|
+ SDL_LogError(SDL_LOG_CATEGORY_INPUT, "Failed to get evdev touchscreen name");
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
item->touchscreen_data->name = SDL_strdup(name);
|
|
@@ -687,7 +689,8 @@ static bool SDL_EVDEV_init_touchscreen(SDL_evdevlist_item *item, int udev_class)
|
|
|
if (ret < 0) {
|
|
|
SDL_free(item->touchscreen_data->name);
|
|
|
SDL_free(item->touchscreen_data);
|
|
|
- return SDL_SetError("Failed to get evdev touchscreen limits");
|
|
|
+ SDL_LogError(SDL_LOG_CATEGORY_INPUT, "Failed to get evdev touchscreen limits");
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
if (abs_info.maximum == 0) {
|
|
@@ -704,7 +707,8 @@ static bool SDL_EVDEV_init_touchscreen(SDL_evdevlist_item *item, int udev_class)
|
|
|
if (ret < 0) {
|
|
|
SDL_free(item->touchscreen_data->name);
|
|
|
SDL_free(item->touchscreen_data);
|
|
|
- return SDL_SetError("Failed to get evdev touchscreen limits");
|
|
|
+ SDL_LogError(SDL_LOG_CATEGORY_INPUT, "Failed to get evdev touchscreen limits");
|
|
|
+ return false;
|
|
|
}
|
|
|
item->touchscreen_data->min_x = abs_info.minimum;
|
|
|
item->touchscreen_data->max_x = abs_info.maximum;
|
|
@@ -714,7 +718,8 @@ static bool SDL_EVDEV_init_touchscreen(SDL_evdevlist_item *item, int udev_class)
|
|
|
if (ret < 0) {
|
|
|
SDL_free(item->touchscreen_data->name);
|
|
|
SDL_free(item->touchscreen_data);
|
|
|
- return SDL_SetError("Failed to get evdev touchscreen limits");
|
|
|
+ SDL_LogError(SDL_LOG_CATEGORY_INPUT, "Failed to get evdev touchscreen limits");
|
|
|
+ return false;
|
|
|
}
|
|
|
item->touchscreen_data->min_y = abs_info.minimum;
|
|
|
item->touchscreen_data->max_y = abs_info.maximum;
|
|
@@ -724,7 +729,8 @@ static bool SDL_EVDEV_init_touchscreen(SDL_evdevlist_item *item, int udev_class)
|
|
|
if (ret < 0) {
|
|
|
SDL_free(item->touchscreen_data->name);
|
|
|
SDL_free(item->touchscreen_data);
|
|
|
- return SDL_SetError("Failed to get evdev touchscreen limits");
|
|
|
+ SDL_LogError(SDL_LOG_CATEGORY_INPUT, "Failed to get evdev touchscreen limits");
|
|
|
+ return false;
|
|
|
}
|
|
|
item->touchscreen_data->min_pressure = abs_info.minimum;
|
|
|
item->touchscreen_data->max_pressure = abs_info.maximum;
|
|
@@ -908,8 +914,9 @@ static bool SDL_EVDEV_device_added(const char *dev_path, int udev_class)
|
|
|
|
|
|
item->fd = open(dev_path, O_RDONLY | O_NONBLOCK | O_CLOEXEC);
|
|
|
if (item->fd < 0) {
|
|
|
+ SDL_LogError(SDL_LOG_CATEGORY_INPUT, "Couldn't open %s: %s", dev_path, strerror(errno));
|
|
|
SDL_free(item);
|
|
|
- return SDL_SetError("Unable to open %s", dev_path);
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
item->path = SDL_strdup(dev_path);
|