Merge pull request #12557 from grant2258/logging

fix up logging that can confuse users
This commit is contained in:
Autechre 2021-06-23 00:18:40 +02:00 committed by GitHub
commit 94e4b1883a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -479,7 +479,7 @@ static void udev_handle_mouse(void *data,
} }
} }
static bool udev_input_add_device(udev_input_t *udev, static int udev_input_add_device(udev_input_t *udev,
enum udev_input_dev_type type, const char *devnode, device_handle_cb cb) enum udev_input_dev_type type, const char *devnode, device_handle_cb cb)
{ {
unsigned char keycaps[(KEY_MAX / 8) + 1]; unsigned char keycaps[(KEY_MAX / 8) + 1];
@ -518,7 +518,7 @@ static bool udev_input_add_device(udev_input_t *udev,
if (type == UDEV_INPUT_MOUSE || type == UDEV_INPUT_TOUCHPAD ) if (type == UDEV_INPUT_MOUSE || type == UDEV_INPUT_TOUCHPAD )
{ {
if (ioctl(fd, EVIOCGBIT(EV_KEY, sizeof (keycaps)), keycaps) == -1) if (ioctl(fd, EVIOCGBIT(EV_KEY, sizeof (keycaps)), keycaps) == -1)
return 0; /* gotta have some buttons! :) */ return -1; /* gotta have some buttons! return -1 to skip error logging for this:) */
if (ioctl(fd, EVIOCGABS(ABS_X), &absinfo) >= 0) if (ioctl(fd, EVIOCGABS(ABS_X), &absinfo) >= 0)
{ {
@ -1216,8 +1216,8 @@ static bool open_devices(udev_input_t *udev,
struct udev_list_entry *devs = NULL; struct udev_list_entry *devs = NULL;
struct udev_list_entry *item = NULL; struct udev_list_entry *item = NULL;
struct udev_enumerate *enumerate = udev_enumerate_new(udev->udev); struct udev_enumerate *enumerate = udev_enumerate_new(udev->udev);
int device_index = 0; static int device_keyboard = 0;
static int device_mouse = 0;
if (!enumerate) if (!enumerate)
return false; return false;
@ -1240,20 +1240,32 @@ static bool open_devices(udev_input_t *udev,
if (fd != -1) if (fd != -1)
{ {
bool check = udev_input_add_device(udev, type, devnode, cb); int check = udev_input_add_device(udev, type, devnode, cb);
if (!check && check != -1 )
if (!check) RARCH_DBG("[udev] udev_input_add_device error : %s (%s).\n",
RARCH_DBG("[udev] udev_input_add_device SKIPPED : %s (%s).\n",
devnode, strerror(errno)); devnode, strerror(errno));
else else if (check != -1 && check != 0)
{ {
char ident[255]; char ident[255];
if (ioctl(fd, EVIOCGNAME(sizeof(ident)), ident) < 0) if (ioctl(fd, EVIOCGNAME(sizeof(ident)), ident) < 0)
ident[0] = '\0'; ident[0] = '\0';
RARCH_LOG("[udev]: Added Device %s %s (%s).\n", if ( type == UDEV_INPUT_KEYBOARD)
type == UDEV_INPUT_KEYBOARD ? "Keyboard" : "Mouse", {
RARCH_LOG("[udev]: Added Device Keyboard#%d %s (%s) .\n",
device_keyboard,
ident, ident,
devnode); devnode);
device_keyboard++;
}
else
{
RARCH_LOG("[udev]: Added Device mouse#%d %s (%s) .\n",
device_mouse,
ident,
devnode);
device_mouse++;
}
} }
(void)check; (void)check;