From daf1c30a9453871ac03ce714cc6d1161f2be8232 Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Sun, 10 May 2020 09:26:31 +0200 Subject: [PATCH] GCAdapter: add libusb error logging on reads/writes --- Source/Core/InputCommon/GCAdapter.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Source/Core/InputCommon/GCAdapter.cpp b/Source/Core/InputCommon/GCAdapter.cpp index f54f85393c..5172000dda 100644 --- a/Source/Core/InputCommon/GCAdapter.cpp +++ b/Source/Core/InputCommon/GCAdapter.cpp @@ -84,8 +84,10 @@ static void Read() int payload_size = 0; while (s_adapter_thread_running.IsSet()) { - libusb_interrupt_transfer(s_handle, s_endpoint_in, s_controller_payload_swap, - sizeof(s_controller_payload_swap), &payload_size, 16); + int err = libusb_interrupt_transfer(s_handle, s_endpoint_in, s_controller_payload_swap, + sizeof(s_controller_payload_swap), &payload_size, 16); + if (err) + ERROR_LOG(SERIALINTERFACE, "adapter libusb read failed: err=%s", libusb_error_name(err)); { std::lock_guard lk(s_mutex); @@ -110,7 +112,10 @@ static void Write() u8 payload[5] = {0x11, s_controller_rumble[0], s_controller_rumble[1], s_controller_rumble[2], s_controller_rumble[3]}; - libusb_interrupt_transfer(s_handle, s_endpoint_out, payload, sizeof(payload), &size, 16); + int err = + libusb_interrupt_transfer(s_handle, s_endpoint_out, payload, sizeof(payload), &size, 16); + if (err) + ERROR_LOG(SERIALINTERFACE, "adapter libusb write failed: err=%s", libusb_error_name(err)); } }