(input drivers) cleanup log spam

This commit is contained in:
twinaphex 2020-06-11 05:37:40 +02:00
parent d924c656b7
commit 703cc7198d
5 changed files with 29 additions and 98 deletions

View File

@ -205,36 +205,28 @@ static bool android_input_lookup_name_prekitkat(char *buf,
JNIEnv *env = (JNIEnv*)jni_thread_getenv();
if (!env)
goto error;
RARCH_LOG("Using old lookup");
return false;
FIND_CLASS(env, class, "android/view/InputDevice");
if (!class)
goto error;
return false;
GET_STATIC_METHOD_ID(env, method, class, "getDevice",
"(I)Landroid/view/InputDevice;");
if (!method)
goto error;
return false;
CALL_OBJ_STATIC_METHOD_PARAM(env, device, class, method, (jint)id);
if (!device)
{
RARCH_ERR("Failed to find device for ID: %d\n", id);
goto error;
}
return false;
GET_METHOD_ID(env, getName, class, "getName", "()Ljava/lang/String;");
if (!getName)
goto error;
return false;
CALL_OBJ_METHOD(env, name, device, getName);
if (!name)
{
RARCH_ERR("Failed to find name for device ID: %d\n", id);
goto error;
}
return false;
buf[0] = '\0';
@ -243,11 +235,7 @@ static bool android_input_lookup_name_prekitkat(char *buf,
strlcpy(buf, str, size);
(*env)->ReleaseStringUTFChars(env, name, str);
RARCH_LOG("device name: %s\n", buf);
return true;
error:
return false;
}
static bool android_input_lookup_name(char *buf,
@ -264,36 +252,28 @@ static bool android_input_lookup_name(char *buf,
JNIEnv *env = (JNIEnv*)jni_thread_getenv();
if (!env)
goto error;
RARCH_LOG("Using new lookup");
return false;
FIND_CLASS(env, class, "android/view/InputDevice");
if (!class)
goto error;
return false;
GET_STATIC_METHOD_ID(env, method, class, "getDevice",
"(I)Landroid/view/InputDevice;");
if (!method)
goto error;
return false;
CALL_OBJ_STATIC_METHOD_PARAM(env, device, class, method, (jint)id);
if (!device)
{
RARCH_ERR("Failed to find device for ID: %d\n", id);
goto error;
}
return false;
GET_METHOD_ID(env, getName, class, "getName", "()Ljava/lang/String;");
if (!getName)
goto error;
return false;
CALL_OBJ_METHOD(env, name, device, getName);
if (!name)
{
RARCH_ERR("Failed to find name for device ID: %d\n", id);
goto error;
}
return false;
buf[0] = '\0';
@ -302,28 +282,20 @@ static bool android_input_lookup_name(char *buf,
strlcpy(buf, str, size);
(*env)->ReleaseStringUTFChars(env, name, str);
RARCH_LOG("device name: %s\n", buf);
GET_METHOD_ID(env, getVendorId, class, "getVendorId", "()I");
if (!getVendorId)
goto error;
return false;
CALL_INT_METHOD(env, *vendorId, device, getVendorId);
RARCH_LOG("device vendor id: %d\n", *vendorId);
GET_METHOD_ID(env, getProductId, class, "getProductId", "()I");
if (!getProductId)
goto error;
return false;
*productId = 0;
CALL_INT_METHOD(env, *productId, device, getProductId);
RARCH_LOG("device product id: %d\n", *productId);
return true;
error:
return false;
}
static void android_input_poll_main_cmd(void)
@ -354,12 +326,9 @@ static void android_input_poll_main_cmd(void)
android_app->inputQueue = android_app->pendingInputQueue;
if (android_app->inputQueue)
{
RARCH_LOG("Attaching input queue to looper");
AInputQueue_attachLooper(android_app->inputQueue,
android_app->looper, LOOPER_ID_INPUT, NULL,
NULL);
}
scond_broadcast(android_app->cond);
slock_unlock(android_app->mutex);
@ -451,7 +420,6 @@ static void android_input_poll_main_cmd(void)
break;
case APP_CMD_DESTROY:
RARCH_LOG("APP_CMD_DESTROY\n");
android_app->destroyRequested = 1;
break;
case APP_CMD_VIBRATE_KEYPRESS:
@ -534,10 +502,7 @@ static bool android_input_init_handle(void)
if ((p_AMotionEvent_getAxisValue = dlsym(RTLD_DEFAULT,
"AMotionEvent_getAxisValue")))
{
RARCH_LOG("Set engine_handle_dpad to 'Get Axis Value' (for reading extra analog sticks)");
engine_handle_dpad = engine_handle_dpad_getaxisvalue;
}
p_AMotionEvent_getButtonState = dlsym(RTLD_DEFAULT,"AMotionEvent_getButtonState");
#endif
@ -566,8 +531,6 @@ static void *android_input_init(const char *joypad_driver)
frontend_android_get_version_sdk(&sdk);
RARCH_LOG("sdk version: %d\n", sdk);
if (sdk >= 19)
engine_lookup_name = android_input_lookup_name;
else
@ -959,20 +922,12 @@ static void handle_hotplug(android_input_t *android,
frontend_android_get_name(device_model, sizeof(device_model));
RARCH_LOG("Device model: (%s).\n", device_model);
if (*port > DEFAULT_MAX_PADS)
{
RARCH_ERR("Max number of pads reached.\n");
return;
}
if (!engine_lookup_name(device_name, &vendorId,
&productId, sizeof(device_name), id))
{
RARCH_ERR("Could not look up device name or IDs.\n");
return;
}
/* FIXME - per-device hacks for NVidia Shield, Xperia Play and
* similar devices
@ -1010,7 +965,7 @@ static void handle_hotplug(android_input_t *android,
RARCH_LOG("- Pads Mapped: %d\n- Device Name: %s\n- IDS: %d, %d, %d",
android->pads_connected, device_name, id, pad_id1, pad_id2);
#endif
/* remove the remote or virtual controller device if it is mapped */
/* Remove the remote or virtual controller device if it is mapped */
if (strstr(android->pad_states[0].name,"SHIELD Remote") ||
strstr(android->pad_states[0].name,"SHIELD Virtual Controller"))
{

View File

@ -284,7 +284,6 @@ static void ps3_input_free_input(void *data)
static void* ps3_input_init(const char *joypad_driver)
{
int status;
unsigned i;
ps3_input_t *ps3 = (ps3_input_t*)calloc(1, sizeof(*ps3));
if (!ps3)
@ -299,13 +298,8 @@ static void* ps3_input_init(const char *joypad_driver)
input_keymaps_init_keyboard_lut(rarch_key_map_psl1ght);
status = ioKbInit(MAX_KB_PORT_NUM);
RARCH_LOG("Calling ioKbInit(%d) returned %d\r\n", MAX_KB_PORT_NUM, status);
status = ioKbGetInfo(&ps3->kbinfo);
RARCH_LOG("Calling ioKbGetInfo() returned %d\r\n", status);
RARCH_LOG("KbInfo:\r\nMax Kbs: %u\r\nConnected Kbs: %u\r\nInfo Field: %08x\r\n", ps3->kbinfo.max, ps3->kbinfo.connected, ps3->kbinfo.info);
ioKbInit(MAX_KB_PORT_NUM);
ioKbGetInfo(&ps3->kbinfo);
for (i = 0; i < MAX_KB_PORT_NUM; i++)
{
@ -331,14 +325,12 @@ static uint64_t ps3_input_get_capabilities(void *data)
static bool ps3_input_set_sensor_state(void *data, unsigned port,
enum retro_sensor_action action, unsigned event_rate)
{
RARCH_LOG("alive " __FILE__ ":%d\n", __LINE__);
return false;
}
static bool ps3_input_set_rumble(void *data, unsigned port,
enum retro_rumble_effect effect, uint16_t strength)
{
RARCH_LOG("alive " __FILE__ ":%d\n", __LINE__);
return false;
}

View File

@ -292,6 +292,7 @@ static void qnx_handle_device(qnx_input_t *qnx,
* we still might need to adjust. */
qnx_input_autodetect_gamepad(qnx, controller);
#ifdef DEBUG
if (controller->type == SCREEN_EVENT_GAMEPAD)
RARCH_LOG("Gamepad Device Connected:\n");
else if (controller->type == SCREEN_EVENT_JOYSTICK)
@ -304,6 +305,7 @@ static void qnx_handle_device(qnx_input_t *qnx,
RARCH_LOG("\tProduct ID: %s\n", controller->pid);
RARCH_LOG("\tButton Count: %d\n", controller->buttonCount);
RARCH_LOG("\tAnalog Count: %d\n", controller->analogCount);
#endif
}
/* Find currently connected gamepads. */

View File

@ -52,7 +52,6 @@ static void *sdl_input_init(const char *joypad_driver)
sdl->joypad = input_joypad_init_driver(joypad_driver, sdl);
RARCH_LOG("[SDL]: Input driver initialized.\n");
return sdl;
}

View File

@ -633,18 +633,12 @@ static void udev_input_handle_hotplug(udev_input_t *udev)
else
goto end;
/* Hotplug add */
if (string_is_equal(action, "add"))
{
RARCH_LOG("[udev]: Hotplug add %s: %s.\n",
g_dev_type_str[dev_type], devnode);
udev_input_add_device(udev, dev_type, devnode, cb);
}
/* Hotplug remove */
else if (string_is_equal(action, "remove"))
{
RARCH_LOG("[udev]: Hotplug remove %s: %s.\n",
g_dev_type_str[dev_type], devnode);
udev_input_remove_device(udev, devnode);
}
end:
udev_device_unref(dev);
@ -1176,7 +1170,9 @@ static bool open_devices(udev_input_t *udev,
struct udev_list_entry *devs = NULL;
struct udev_list_entry *item = NULL;
struct udev_enumerate *enumerate = udev_enumerate_new(udev->udev);
#ifdef DEBUG
int device_index = 0;
#endif
if (!enumerate)
return false;
@ -1200,13 +1196,17 @@ static bool open_devices(udev_input_t *udev,
if (fd != -1)
{
if (!udev_input_add_device(udev, type, devnode, cb))
bool check = udev_input_add_device(udev, type, devnode, cb);
#ifdef DEBUG
if (!check)
RARCH_ERR("[udev] Failed to open device: %s (%s).\n",
devnode, strerror(errno));
else
RARCH_LOG("[udev]: %s #%d (%s).\n",
type == UDEV_INPUT_KEYBOARD ? "Keyboard" : "Mouse",
device_index++, devnode);
#endif
(void)check;
close(fd);
}
}
@ -1231,10 +1231,7 @@ static void *udev_input_init(const char *joypad_driver)
udev->udev = udev_new();
if (!udev->udev)
{
RARCH_ERR("Failed to create udev handle.\n");
goto error;
}
udev->monitor = udev_monitor_new_from_netlink(udev->udev, "udev");
if (udev->monitor)
@ -1254,38 +1251,23 @@ static void *udev_input_init(const char *joypad_driver)
#if defined(HAVE_EPOLL)
fd = epoll_create(32);
if (fd < 0)
{
RARCH_ERR("Failed to create poll file descriptor.\n");
goto error;
}
#elif defined(HAVE_KQUEUE)
fd = kqueue();
if (fd == -1)
{
RARCH_ERR("Failed to create poll file descriptor.\n");
goto error;
}
#endif
udev->fd = fd;
if (!open_devices(udev, UDEV_INPUT_KEYBOARD, udev_handle_keyboard))
{
RARCH_ERR("Failed to open keyboard.\n");
goto error;
}
if (!open_devices(udev, UDEV_INPUT_MOUSE, udev_handle_mouse))
{
RARCH_ERR("Failed to open mouse.\n");
goto error;
}
if (!open_devices(udev, UDEV_INPUT_TOUCHPAD, udev_handle_mouse))
{
RARCH_ERR("Failed to open touchpads.\n");
goto error;
}
/* If using KMS and we forgot this,
* we could lock ourselves out completely. */
@ -1300,6 +1282,7 @@ static void *udev_input_init(const char *joypad_driver)
#endif
#ifndef HAVE_X11
/* TODO/FIXME - this can't be hidden behind a compile-time ifdef */
RARCH_WARN("[udev]: Full-screen pointer won't be available.\n");
#endif