(libusb) Add disconnect message, change "Joypad" terminology to

'Device'
This commit is contained in:
twinaphex 2015-04-14 05:36:43 +02:00
parent 7f229e57ab
commit 0057510caf
8 changed files with 18 additions and 24 deletions

View File

@ -218,7 +218,7 @@ static void apple_hid_device_remove(void *data, IOReturn result, void* sender)
{
char msg[PATH_MAX_LENGTH];
snprintf(msg, sizeof(msg), "Joypad #%u (%s) disconnected.",
snprintf(msg, sizeof(msg), "Device #%u (%s) disconnected.",
adapter->slot, adapter->name);
rarch_main_msg_queue_push(msg, 0, 60, false);

View File

@ -19,6 +19,7 @@
#include <queues/fifo_buffer.h>
#include "../connect/joypad_connection.h"
#include "../../driver.h"
#include "../../runloop.h"
#include "../input_autodetect.h"
#include "../input_hid_driver.h"
@ -77,18 +78,7 @@ static void adapter_thread(void *data)
if (fifo_read_avail(adapter->send_control_buffer) >= sizeof(send_command_size))
{
fifo_read(adapter->send_control_buffer, send_command_buf, send_command_size);
#if 0
report_number = send_command_buf[0];
libusb_control_transfer(adapter->handle,
LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE|LIBUSB_ENDPOINT_OUT,
0x09/*HID Set_Report*/,
(2/*HID output*/ << 8) | report_number,
adapter->interface_number,
send_command_buf, send_command_size,
1000/*timeout millis*/);
#else
libusb_interrupt_transfer(adapter->handle, adapter->endpoint_out, send_command_buf, send_command_size, &tmp, 1000);
#endif
}
}
slock_unlock(adapter->send_control_lock);
@ -327,9 +317,14 @@ static int remove_adapter(void *data, struct libusb_device *dev)
{
if (adapter->next->device == dev)
{
fprintf(stderr, "Device 0x%p disconnected.\n", adapter->next->device);
char msg[PATH_MAX_LENGTH];
struct libusb_adapter *new_next = NULL;
fprintf(stderr, "Device 0x%p disconnected.\n", adapter->next->device);
snprintf(msg, sizeof(msg), "Device #%u (%s) disconnected.",
adapter->slot, adapter->next->name);
rarch_main_msg_queue_push(msg, 0, 60, false);
adapter->next->quitting = true;
sthread_join(adapter->next->thread);
@ -345,7 +340,6 @@ static int remove_adapter(void *data, struct libusb_device *dev)
free(adapter->next);
adapter->next = new_next;
return 0;
}

View File

@ -155,12 +155,12 @@ static void handle_plugged_pad(void)
if (g_hotplug)
{
char msg[512];
snprintf(msg, sizeof(msg), "Joypad #%u (%s) disconnected.", idx, linuxraw_pads[idx].ident);
snprintf(msg, sizeof(msg), "Device #%u (%s) disconnected.", idx, linuxraw_pads[idx].ident);
rarch_main_msg_queue_push(msg, 0, 60, false);
}
#endif
RARCH_LOG("[Joypad]: Joypad %s disconnected.\n", linuxraw_pads[idx].ident);
RARCH_LOG("[Joypad]: Device %s disconnected.\n", linuxraw_pads[idx].ident);
close(linuxraw_pads[idx].fd);
linuxraw_pads[idx].buttons = 0;
memset(linuxraw_pads[idx].axes, 0, sizeof(linuxraw_pads[idx].axes));

View File

@ -139,7 +139,7 @@ static void ps3_joypad_poll(void)
char msg[512];
snprintf(msg, sizeof(msg),
"Joypad #%u (%s) disconnected.", port, ps3_joypad.ident);
"Device #%u (%s) disconnected.", port, ps3_joypad.ident);
rarch_main_msg_queue_push(msg, 0, 60, false);
RARCH_LOG("%s\n", msg);

View File

@ -202,14 +202,14 @@ static void sdl_pad_disconnect(unsigned id)
if (sdl_pads[id].controller)
{
SDL_GameControllerClose(sdl_pads[id].controller);
RARCH_LOG("[SDL]: Joypad #%u disconnected.\n", id);
RARCH_LOG("[SDL]: Device #%u disconnected.\n", id);
}
else
#endif
if (sdl_pads[id].joypad)
{
SDL_JoystickClose(sdl_pads[id].joypad);
RARCH_LOG("[SDL]: Joypad #%u disconnected.\n", id);
RARCH_LOG("[SDL]: Device #%u disconnected.\n", id);
}
settings->input.device_names[id][0] = '\0';

View File

@ -471,7 +471,7 @@ static void udev_check_device(struct udev_device *dev, const char *path, bool ho
if (hotplugged)
{
char msg[512];
snprintf(msg, sizeof(msg), "Joypad #%u (%s) connected.", pad, path);
snprintf(msg, sizeof(msg), "Device #%u (%s) connected.", pad, path);
rarch_main_msg_queue_push(msg, 0, 60, false);
RARCH_LOG("[udev]: %s\n", msg);
}
@ -496,7 +496,7 @@ static void udev_joypad_remove_device(const char *path)
{
#ifndef IS_JOYCONFIG
char msg[512];
snprintf(msg, sizeof(msg), "Joypad #%u (%s) disconnected.", i, udev_pads[i].ident);
snprintf(msg, sizeof(msg), "Device #%u (%s) disconnected.", i, udev_pads[i].ident);
rarch_main_msg_queue_push(msg, 0, 60, false);
RARCH_LOG("[udev]: %s\n", msg);
#endif

View File

@ -165,7 +165,7 @@ static void xdk_joypad_poll(void)
pad_state[port] = 0;
char msg[512];
snprintf(msg, sizeof(msg), "Joypad #%u (%s) disconnected.", port, xdk_joypad.ident);
snprintf(msg, sizeof(msg), "Device #%u (%s) disconnected.", port, xdk_joypad.ident);
rarch_main_msg_queue_push(msg, 0, 60, false);
RARCH_LOG("%s\n", msg);
}

View File

@ -120,7 +120,7 @@ static void input_autoconfigure_joypad_add(
input_autoconfigure_joypad_conf(conf,
settings->input.autoconf_binds[params->idx]);
snprintf(msg, sizeof(msg), "Joypad port #%u (%s) configured.",
snprintf(msg, sizeof(msg), "Device port #%u (%s) configured.",
params->idx, params->name);
if (!block_osd_spam)