(drivers_joypad) get rid of excessive logging

This commit is contained in:
twinaphex 2020-06-11 04:06:33 +02:00
parent a68b942d1d
commit b363ed7d79
10 changed files with 36 additions and 104 deletions

View File

@ -79,10 +79,9 @@ bool dinput_joypad_get_vidpid_from_xinput_index(int32_t index, int32_t *vid, int
for (i = 0; i < ARRAY_SIZE(g_xinput_pad_indexes); i++)
{
/* Found XInput pad? */
if (index == g_xinput_pad_indexes[i])
{
RARCH_LOG("[DINPUT]: Found XInput pad at index %d (DINPUT index %d)\n", index, i);
if (vid)
*vid = g_pads[i].vid;
@ -335,7 +334,7 @@ static BOOL CALLBACK enum_joypad_cb(const DIDEVICEINSTANCE *inst, void *p)
if (FAILED(IDirectInput8_CreateDevice(
g_dinput_ctx, &inst->guidInstance, pad, NULL)))
#endif
return DIENUM_CONTINUE;
return DIENUM_CONTINUE;
g_pads[g_joypad_cnt].joy_name = strdup((const char*)inst->tszProductName);
g_pads[g_joypad_cnt].joy_friendly_name = strdup((const char*)inst->tszInstanceName);
@ -359,11 +358,6 @@ static BOOL CALLBACK enum_joypad_cb(const DIDEVICEINSTANCE *inst, void *p)
g_pads[g_joypad_cnt].vid = inst->guidProduct.Data1 % 0x10000;
g_pads[g_joypad_cnt].pid = inst->guidProduct.Data1 / 0x10000;
RARCH_LOG("[DINPUT]: Device #%u PID: {%04lX} VID:{%04lX}\n",
g_joypad_cnt,
g_pads[g_joypad_cnt].pid,
g_pads[g_joypad_cnt].vid);
#ifdef HAVE_XINPUT
is_xinput_pad = g_xinput_block_pads
&& guid_is_xinput_device(&inst->guidProduct);
@ -424,10 +418,8 @@ static bool dinput_joypad_init(void *data)
g_pads[i].joy_friendly_name = NULL;
}
RARCH_LOG("[DINPUT]: Enumerating joypads ...\n");
IDirectInput8_EnumDevices(g_dinput_ctx, DI8DEVCLASS_GAMECTRL,
enum_joypad_cb, NULL, DIEDFL_ATTACHEDONLY);
RARCH_LOG("[DINPUT]: Done enumerating joypads ...\n");
return true;
}

View File

@ -98,28 +98,16 @@ static bool linuxraw_joypad_init_pad(const char *path,
{
struct epoll_event event;
if (ioctl(pad->fd,
JSIOCGNAME(sizeof(input_device_names[0])), pad->ident) >= 0)
{
RARCH_LOG("[Device]: Found pad: %s on %s.\n", pad->ident, path);
}
else
RARCH_ERR("[Device]: Didn't find ident of %s.\n", path);
ioctl(pad->fd,
JSIOCGNAME(sizeof(input_device_names[0])), pad->ident);
event.events = EPOLLIN;
event.data.ptr = pad;
if (epoll_ctl(linuxraw_epoll, EPOLL_CTL_ADD, pad->fd, &event) < 0)
{
RARCH_ERR("Failed to add FD (%d) to epoll list (%s).\n",
pad->fd, strerror(errno));
}
else
if (epoll_ctl(linuxraw_epoll, EPOLL_CTL_ADD, pad->fd, &event) >= 0)
return true;
}
RARCH_ERR("[Device]: Failed to open pad %s (error: %s).\n",
path, strerror(errno));
return false;
}

View File

@ -116,7 +116,8 @@ static void parport_poll_pad(struct parport_joypad *pad)
BIT32_SET(pad->buttons, 12);
}
static bool parport_joypad_init_pad(const char *path, struct parport_joypad *pad)
static bool parport_joypad_init_pad(
const char *path, struct parport_joypad *pad)
{
int i;
char data;
@ -134,33 +135,26 @@ static bool parport_joypad_init_pad(const char *path, struct parport_joypad *pad
pad->fd = open(path, O_RDWR | O_NONBLOCK);
*pad->ident = '\0';
/* Found parallel port? */
if (pad->fd >= 0)
{
RARCH_LOG("[Joypad]: Found parallel port: %s\n", path);
/* Parport driver does not log failures with RARCH_ERR because they could be
/* Parport driver does not log failures with
* RARCH_ERR because they could be
* a normal result of connected non-joypad devices. */
if (ioctl(pad->fd, PPCLAIM) < 0)
{
RARCH_WARN("[Joypad]: Failed to claim %s\n", path);
goto error;
}
if (ioctl(pad->fd, PPSETMODE, &mode) < 0)
{
RARCH_WARN("[Joypad]: Failed to set byte mode on %s\n", path);
goto error;
}
if (ioctl(pad->fd, PPDATADIR, &datadir) < 0)
{
RARCH_WARN("[Joypad]: Failed to set data direction to input on %s\n", path);
goto error;
}
if (ioctl(pad->fd, PPRDATA, &data) < 0)
{
RARCH_WARN("[Joypad]: Failed to save original data register on %s\n", path);
/* Failed to claim? */
if (ioctl(pad->fd, PPCLAIM) < 0)
goto error;
}
/* Failed to set byte mode? */
if (ioctl(pad->fd, PPSETMODE, &mode) < 0)
goto error;
/* Failed to set data direction to input */
if (ioctl(pad->fd, PPDATADIR, &datadir) < 0)
goto error;
/* Failed to save original data register */
if (ioctl(pad->fd, PPRDATA, &data) < 0)
goto error;
pad->saved_data = data;
if (ioctl(pad->fd, PPRCONTROL, &data) == 0)
@ -168,17 +162,19 @@ static bool parport_joypad_init_pad(const char *path, struct parport_joypad *pad
pad->saved_control = data;
/* Clear strobe bit to set strobe high for pullup +V */
/* Clear control bit 4 to disable interrupts */
frob.mask = PARPORT_CONTROL_STROBE | (UINT8_C(1 << 4));
frob.val = 0;
frob.mask = PARPORT_CONTROL_STROBE | (UINT8_C(1 << 4));
frob.val = 0;
if (ioctl(pad->fd, PPFCONTROL, &frob) == 0)
set_control = true;
}
else
{
data = pad->saved_data;
#if 0
if (ioctl(pad->fd, PPWDATA, &data) < 0)
RARCH_WARN("[Joypad]: Failed to restore original data register on %s\n", path);
RARCH_WARN("[Joypad]: Failed to save original control register on %s\n", path);
#endif
goto error;
}
@ -200,7 +196,6 @@ error:
return false;
}
RARCH_WARN("[Joypad]: Failed to open parallel port %s (error: %s).\n", path, strerror(errno));
return false;
}
@ -264,7 +259,7 @@ static bool parport_joypad_init(void *data)
* and disable any low pins.
*/
parport_poll_pad(pad);
found_enabled_button = false;
found_enabled_button = false;
found_disabled_button = false;
for (j = 0; j < PARPORT_NUM_BUTTONS; j++)

View File

@ -190,7 +190,6 @@ static void ps3_joypad_poll(void)
*state_cur |= (state_tmp.button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_R2) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_R2) : 0;
*state_cur |= (state_tmp.button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_L2) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_L2) : 0;
*state_cur |= (state_tmp.button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_L2) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_L2) : 0;
//RARCH_LOG("lsx : %d (%hd) lsy : %d (%hd) rsx : %d (%hd) rsy : %d (%hd)\n", lsx, ls_x, lsy, ls_y, rsx, rs_x, rsy, rs_y);
uint8_t lsx = (uint8_t)(state_tmp.button[CELL_PAD_BTN_OFFSET_ANALOG_LEFT_X]);
uint8_t lsy = (uint8_t)(state_tmp.button[CELL_PAD_BTN_OFFSET_ANALOG_LEFT_Y]);
uint8_t rsx = (uint8_t)(state_tmp.button[CELL_PAD_BTN_OFFSET_ANALOG_RIGHT_X]);

View File

@ -86,8 +86,6 @@ static bool ps4_joypad_init(void *data)
result = sceUserServiceGetLoginUserIdList(&userIdList);
RARCH_LOG("sceUserServiceGetLoginUserIdList %x ", result);
if (result == 0)
{
unsigned i;
@ -95,8 +93,6 @@ static bool ps4_joypad_init(void *data)
{
SceUserServiceUserId userId = userIdList.userId[i];
RARCH_LOG("USER %d ID %x\n", i, userId);
if (userId != SCE_USER_SERVICE_USER_ID_INVALID)
{
int index = 0;
@ -110,12 +106,10 @@ static bool ps4_joypad_init(void *data)
if (index == num_players)
{
ds_joypad_states[num_players].handle = scePadOpen(userId, 0, 0, NULL);
RARCH_LOG("USER %x HANDLE %x\n", userId, ds_joypad_states[num_players].handle);
if (ds_joypad_states[num_players].handle > 0)
{
ds_joypad_states[num_players].connected = true;
ds_joypad_states[num_players].userId = userId;
RARCH_LOG("NEW PAD: num_players %x \n", num_players);
input_autoconfigure_connect(
ps4_joypad_name(num_players),

View File

@ -153,9 +153,6 @@ static void sdl_pad_connect(unsigned id)
vendor,
product);
RARCH_LOG("[SDL]: Device #%u (%04x:%04x) connected: %s.\n", id, vendor,
product, sdl_joypad_name(id));
#ifdef HAVE_SDL2
if (pad->controller)
{
@ -175,7 +172,7 @@ static void sdl_pad_connect(unsigned id)
pad->num_hats = 0;
pad->num_balls = 0;
RARCH_LOG("[SDL]: Device #%u supports game controller api.\n", id);
/* SDL Device supports Game Controller API. */
}
else
{
@ -183,9 +180,6 @@ static void sdl_pad_connect(unsigned id)
pad->num_buttons = SDL_JoystickNumButtons(pad->joypad);
pad->num_hats = SDL_JoystickNumHats(pad->joypad);
pad->num_balls = SDL_JoystickNumBalls(pad->joypad);
RARCH_LOG("[SDL]: Device #%u has: %u axes, %u buttons, %u hats and %u trackballs.\n",
id, pad->num_axes, pad->num_buttons, pad->num_hats, pad->num_balls);
}
pad->haptic = g_has_haptic ? SDL_HapticOpenFromJoystick(pad->joypad) : NULL;
@ -214,9 +208,6 @@ static void sdl_pad_connect(unsigned id)
pad->num_axes = SDL_JoystickNumAxes(pad->joypad);
pad->num_buttons = SDL_JoystickNumButtons(pad->joypad);
pad->num_hats = SDL_JoystickNumHats(pad->joypad);
RARCH_LOG("[SDL]: Device #%u has: %u axes, %u buttons, %u hats.\n",
id, pad->num_axes, pad->num_buttons, pad->num_hats);
#endif
}

View File

@ -87,11 +87,6 @@ static bool switch_joypad_button(unsigned port_num, uint16_t key)
{
if (port_num >= DEFAULT_MAX_PADS)
return false;
#if 0
RARCH_LOG("button(%d, %d)\n", port_num, key);
#endif
return (pad_state[port_num] & (1 << key));
}

View File

@ -164,11 +164,9 @@ static int udev_add_pad(struct udev_device *dev, unsigned p, int fd, const char
strlcpy(pad->ident, input_device_names[p], sizeof(pad->ident));
/* Failed to get pad name */
if (ioctl(fd, EVIOCGNAME(sizeof(pad->ident)), pad->ident) < 0)
{
RARCH_LOG("[udev]: Failed to get pad name: %s.\n", pad->ident);
return -1;
}
pad->vid = pad->pid = 0;
@ -177,9 +175,6 @@ static int udev_add_pad(struct udev_device *dev, unsigned p, int fd, const char
pad->pid = inputid.product;
}
RARCH_LOG("[udev]: Plugged pad: %s (%u:%u) on port #%u.\n",
pad->ident, pad->vid, pad->pid, p);
if (fstat(fd, &st) < 0)
return -1;
@ -461,16 +456,12 @@ static void udev_joypad_poll(void)
if (val && string_is_equal(val, "1") && devnode)
{
/* Hotplug add */
if (string_is_equal(action, "add"))
{
RARCH_LOG("[udev]: Hotplug add: %s.\n", devnode);
udev_check_device(dev, devnode);
}
/* Hotplug removal */
else if (string_is_equal(action, "remove"))
{
RARCH_LOG("[udev]: Hotplug remove: %s.\n", devnode);
udev_joypad_remove_device(devnode);
}
}
udev_device_unref(dev);

View File

@ -71,7 +71,6 @@ static int get_slot_for_channel(unsigned channel)
int slot = pad_connection_find_vacant_pad(hid_instance.pad_list);
if(slot >= 0)
{
RARCH_LOG("[kpad]: got slot %d\n", slot);
channel_slot_map[channel] = slot;
hid_instance.pad_list[slot].connected = true;
}
@ -257,7 +256,9 @@ static const char *kpad_name(unsigned pad)
return PAD_NAME_WIIMOTE;
case WIIMOTE_TYPE_NONE:
default:
#ifdef DEBUG
RARCH_LOG("[kpad]: Unknown pad type %d\n", wiimotes[pad].type);
#endif
break;
}

View File

@ -293,8 +293,6 @@ static bool xinput_joypad_init(void *data)
for (i = 0; i < 4; ++i)
{
g_xinput_states[i].connected = !(g_XInputGetStateEx(i, &dummy_state) == ERROR_DEVICE_NOT_CONNECTED);
if (g_xinput_states[i].connected)
RARCH_LOG("[XInput]: Found controller, user #%u\n", i);
}
if ( (!g_xinput_states[0].connected) &&
@ -307,12 +305,6 @@ static bool xinput_joypad_init(void *data)
goto error;
#endif
RARCH_LOG("[XInput]: Pads connected: %d\n",
g_xinput_states[0].connected +
g_xinput_states[1].connected +
g_xinput_states[2].connected +
g_xinput_states[3].connected);
#ifdef HAVE_DINPUT
g_xinput_block_pads = true;
@ -327,10 +319,7 @@ static bool xinput_joypad_init(void *data)
for (j = 0; j < MAX_USERS; j++)
{
if (xinput_joypad_name(j))
RARCH_LOG("[XInput]: Attempting autoconf for \"%s\", user #%u\n", xinput_joypad_name(j), j);
else
RARCH_LOG("[XInput]: Attempting autoconf for user #%u\n", j);
const char *name = xinput_joypad_name(j);
if (pad_index_to_xuser_index(j) > -1)
{
@ -340,14 +329,11 @@ static bool xinput_joypad_init(void *data)
int32_t dinput_index = 0;
bool success = dinput_joypad_get_vidpid_from_xinput_index((int32_t)pad_index_to_xuser_index(j), (int32_t*)&vid, (int32_t*)&pid,
(int32_t*)&dinput_index);
if (success)
RARCH_LOG("[XInput]: Found VID/PID (%04X/%04X) from DINPUT index %d for \"%s\", user #%u\n",
vid, pid, dinput_index, xinput_joypad_name(j), j);
/* On success, found VID/PID from dinput index */
#endif
input_autoconfigure_connect(
xinput_joypad_name(j),
name,
NULL,
xinput_joypad.ident,
j,