diff options
| author | Filoppi <filippotarpini@hotmail.it> | 2021-05-04 23:37:06 +0300 |
|---|---|---|
| committer | Filoppi <filippotarpini@hotmail.it> | 2021-05-05 00:16:08 +0300 |
| commit | 81092cf7e43f9e4cb33fd93aeba2a9f1f9383ce4 (patch) | |
| tree | c8c4517f660390feb5f1050fccbf5cdaa0e8cff7 /Source/Core/InputCommon/GCAdapter.cpp | |
| parent | a8c40eb510df2bb26c9baf54bbafafc4262feabb (diff) | |
InputCommon: replace SerialInterface log with ControllerInterface
where appropriate. SerialInterface was a leftover from the past,
and makes no sense to be used on actual/real controllers.
Diffstat (limited to 'Source/Core/InputCommon/GCAdapter.cpp')
| -rw-r--r-- | Source/Core/InputCommon/GCAdapter.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/Source/Core/InputCommon/GCAdapter.cpp b/Source/Core/InputCommon/GCAdapter.cpp index cf16d06b0c..6041defaa3 100644 --- a/Source/Core/InputCommon/GCAdapter.cpp +++ b/Source/Core/InputCommon/GCAdapter.cpp @@ -88,7 +88,8 @@ static void Read() 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_FMT(SERIALINTERFACE, "adapter libusb read failed: err={}", libusb_error_name(err)); + ERROR_LOG_FMT(CONTROLLERINTERFACE, "adapter libusb read failed: err={}", + libusb_error_name(err)); { std::lock_guard<std::mutex> lk(s_mutex); @@ -121,7 +122,8 @@ static void Write() const int err = libusb_interrupt_transfer(s_handle, s_endpoint_out, payload, sizeof(payload), &size, 16); if (err != 0) - ERROR_LOG_FMT(SERIALINTERFACE, "adapter libusb write failed: err={}", libusb_error_name(err)); + ERROR_LOG_FMT(CONTROLLERINTERFACE, "adapter libusb write failed: err={}", + libusb_error_name(err)); } } @@ -154,7 +156,7 @@ static int HotplugCallback(libusb_context* ctx, libusb_device* dev, libusb_hotpl static void ScanThreadFunc() { Common::SetCurrentThreadName("GC Adapter Scanning Thread"); - NOTICE_LOG_FMT(SERIALINTERFACE, "GC Adapter scanning thread started"); + NOTICE_LOG_FMT(CONTROLLERINTERFACE, "GC Adapter scanning thread started"); #if defined(LIBUSB_API_VERSION) && LIBUSB_API_VERSION >= 0x01000102 #ifndef __FreeBSD__ @@ -170,7 +172,7 @@ static void ScanThreadFunc() nullptr, &s_hotplug_handle) != LIBUSB_SUCCESS) s_libusb_hotplug_enabled = false; if (s_libusb_hotplug_enabled) - NOTICE_LOG_FMT(SERIALINTERFACE, "Using libUSB hotplug detection"); + NOTICE_LOG_FMT(CONTROLLERINTERFACE, "Using libUSB hotplug detection"); } #endif @@ -187,7 +189,7 @@ static void ScanThreadFunc() else Common::SleepCurrentThread(500); } - NOTICE_LOG_FMT(SERIALINTERFACE, "GC Adapter scanning thread stopped"); + NOTICE_LOG_FMT(CONTROLLERINTERFACE, "GC Adapter scanning thread stopped"); } void SetAdapterCallback(std::function<void()> func) @@ -265,7 +267,7 @@ static bool CheckDeviceAccess(libusb_device* device) if (ret != 0) { // could not acquire the descriptor, no point in trying to use it. - ERROR_LOG_FMT(SERIALINTERFACE, "libusb_get_device_descriptor failed with error: {}", ret); + ERROR_LOG_FMT(CONTROLLERINTERFACE, "libusb_get_device_descriptor failed with error: {}", ret); return false; } @@ -275,7 +277,7 @@ static bool CheckDeviceAccess(libusb_device* device) return false; } - NOTICE_LOG_FMT(SERIALINTERFACE, "Found GC Adapter with Vendor: {:X} Product: {:X} Devnum: {}", + NOTICE_LOG_FMT(CONTROLLERINTERFACE, "Found GC Adapter with Vendor: {:X} Product: {:X} Devnum: {}", desc.idVendor, desc.idProduct, 1); // In case of failure, capture the libusb error code into the adapter status @@ -287,14 +289,14 @@ static bool CheckDeviceAccess(libusb_device* device) if (ret == LIBUSB_ERROR_ACCESS) { ERROR_LOG_FMT( - SERIALINTERFACE, + CONTROLLERINTERFACE, "Dolphin does not have access to this device: Bus {:03d} Device {:03d}: ID {:04X}:{:04X}.", bus, port, desc.idVendor, desc.idProduct); return false; } if (ret != 0) { - ERROR_LOG_FMT(SERIALINTERFACE, "libusb_open failed to open device with error = {}", ret); + ERROR_LOG_FMT(CONTROLLERINTERFACE, "libusb_open failed to open device with error = {}", ret); return false; } @@ -303,14 +305,14 @@ static bool CheckDeviceAccess(libusb_device* device) { ret = libusb_detach_kernel_driver(s_handle, 0); if (ret != 0 && ret != LIBUSB_ERROR_NOT_SUPPORTED) - ERROR_LOG_FMT(SERIALINTERFACE, "libusb_detach_kernel_driver failed with error: {}", ret); + ERROR_LOG_FMT(CONTROLLERINTERFACE, "libusb_detach_kernel_driver failed with error: {}", ret); } // This call makes Nyko-brand (and perhaps other) adapters work. // However it returns LIBUSB_ERROR_PIPE with Mayflash adapters. const int transfer = libusb_control_transfer(s_handle, 0x21, 11, 0x0001, 0, nullptr, 0, 1000); if (transfer < 0) - WARN_LOG_FMT(SERIALINTERFACE, "libusb_control_transfer failed with error: {}", transfer); + WARN_LOG_FMT(CONTROLLERINTERFACE, "libusb_control_transfer failed with error: {}", transfer); // this split is needed so that we don't avoid claiming the interface when // detaching the kernel driver is successful @@ -324,7 +326,7 @@ static bool CheckDeviceAccess(libusb_device* device) ret = libusb_claim_interface(s_handle, 0); if (ret != 0) { - ERROR_LOG_FMT(SERIALINTERFACE, "libusb_claim_interface failed with error: {}", ret); + ERROR_LOG_FMT(CONTROLLERINTERFACE, "libusb_claim_interface failed with error: {}", ret); libusb_close(s_handle); s_handle = nullptr; return false; @@ -410,7 +412,7 @@ static void Reset() } if (s_detect_callback != nullptr) s_detect_callback(); - NOTICE_LOG_FMT(SERIALINTERFACE, "GC Adapter detached"); + NOTICE_LOG_FMT(CONTROLLERINTERFACE, "GC Adapter detached"); } GCPadStatus Input(int chan) @@ -436,8 +438,8 @@ GCPadStatus Input(int chan) controller_payload_copy[0] != LIBUSB_DT_HID) { // This can occur for a few frames on initialization. - ERROR_LOG_FMT(SERIALINTERFACE, "error reading payload (size: {}, type: {:02x})", payload_size, - controller_payload_copy[0]); + ERROR_LOG_FMT(CONTROLLERINTERFACE, "error reading payload (size: {}, type: {:02x})", + payload_size, controller_payload_copy[0]); } else { @@ -446,8 +448,8 @@ GCPadStatus Input(int chan) if (type != ControllerTypes::CONTROLLER_NONE && s_controller_type[chan] == ControllerTypes::CONTROLLER_NONE) { - NOTICE_LOG_FMT(SERIALINTERFACE, "New device connected to Port {} of Type: {:02x}", chan + 1, - controller_payload_copy[1 + (9 * chan)]); + NOTICE_LOG_FMT(CONTROLLERINTERFACE, "New device connected to Port {} of Type: {:02x}", + chan + 1, controller_payload_copy[1 + (9 * chan)]); get_origin = true; } @@ -551,7 +553,7 @@ static void ResetRumbleLockNeeded() int size = 0; libusb_interrupt_transfer(s_handle, s_endpoint_out, rumble, sizeof(rumble), &size, 16); - INFO_LOG_FMT(SERIALINTERFACE, "Rumble state reset"); + INFO_LOG_FMT(CONTROLLERINTERFACE, "Rumble state reset"); } void Output(int chan, u8 rumble_command) |
