Commit Graph

88 Commits

Author SHA1 Message Date
10e044872d LibusbDevice: Don't detach kernel drivers on macOS 2025-02-01 10:32:20 +13:00
f1f147965b Fix segfault when passing invalid arguments 2025-01-24 20:52:33 +01:00
74ed5e5532 Android/GCAdapter: Don't join current thread
The read thread could call Reset, which in turn tried to join the read
thread, leading to a SIGABRT. This manifested as Dolphin consistently
crashing when disconnecting a GC adapter and having a chance of crashing
a few seconds after connecting a GC adapter.
2024-12-01 12:59:25 +01:00
809766a439 Simplify std::fill with std::array::fill 2024-10-09 17:26:10 -07:00
eb92d6f0a8 Core::GetState: Avoid Global System Accessor 2024-04-08 16:23:23 -07:00
719d76ab2e GCAdapter: Adjust libusb transfer timeout to 100ms. 2024-03-20 18:02:06 -05:00
07c035e659 Core/SystemTimers: Refactor to class, move to System. 2024-01-04 23:35:19 +01:00
7197e3abd0 Use structs for config callback IDs
This way you can't mix up regular config callback IDs and CPU thread
config callback IDs. (It would be rather bad if you did!)
2023-08-17 19:19:26 +02:00
274b11e4e9 GCAdapter: Fix Android unused constant warning
CONTROLLER_OUTPUT_INIT_PAYLOAD_SIZE is only used by the libusb
implementation.
2023-08-12 20:20:42 -07:00
77d33d61de GCAdapter: Fix spelling of constants 2023-08-12 20:20:41 -07:00
5d0f1bd10b Switch libusb_config_descriptor to RAII type 2023-07-05 20:38:22 -07:00
c893ccca58 Workaround GC adapter detection breaking when reset fails 2023-07-05 20:38:22 -07:00
559a16da49 Reset GC adapter upon IO error after sleep-wake
Fixes GC adapter breaking on sleep-wake on Linux and burning a full CPU
core. This is cleaner than alternative approaches.
2023-07-05 20:38:22 -07:00
afb5eff426 Don't burn a CPU core and spam logs when GC Adapter fails 2023-07-05 20:38:22 -07:00
54850e936c Fix memory leak in libusb code 2023-07-05 20:38:22 -07:00
49a84cbc4c Resolve various "no previous declaration" warnings 2023-02-09 16:23:01 -08:00
c9558ecb4c CoreTiming: Refactor to class. 2022-11-27 03:47:12 +01:00
5ed0543430 GCAdapter: Process pad state in read thread and other general cleanups. 2022-10-22 00:38:59 -05:00
27772e01d9 GCAdapter: Compare with LIBUSB_SUCCESS instead of 0 2022-06-08 15:30:22 -07:00
15cbb5c8f9 Log warnings when LibusbUtils::GetDeviceList fails 2022-06-08 15:29:11 -07:00
6823b4d7a0 GCAdapter: Use LibusbUtils::ErrorWrap in log messages 2022-06-02 19:39:36 -07:00
0d8772ccbe GCAdapter: Make local variables const where possible 2022-06-02 19:39:36 -07:00
cd9edeacda GCAdapter: Merge Read logic 2022-06-02 19:39:36 -07:00
9ec65baf46 GCAdapter: Have the read thread control the write thread
This was done for Android in 6cc40b1235.
2022-06-02 19:39:36 -07:00
0fa92694d1 GCAdapter: Exit early if the adapter fails to open on Android
This is only so that indentation is consistent with the non-android code.
2022-06-02 19:39:36 -07:00
749a4ad1ef GCAdapter: Remove check on write size on android
It was removed for non-android in 56239d1ae1, and android already uses a separate thread, so presumably this isn't needed anymore.
2022-06-02 19:39:36 -07:00
27947046af GCAdapter: Harmonize read/write thread variable names 2022-06-02 19:39:36 -07:00
279888da8c GCAdapter: Remove unused includes 2022-06-02 19:39:36 -07:00
3ae775e574 GCAdapter: Use determinism hack on Android
This hack was added in 8f0cbefbe5, and the part of it in SI_DeviceGCAdapter is present on Android already, so I don't see any reason why this part doesn't apply to Android.
2022-06-02 19:39:36 -07:00
55922e6d17 GCAdapter: Convert ControllerType to an enum class 2022-06-02 19:39:36 -07:00
682d86f4da GCAdapter: Fix rumble enabled config on Android
I believe the setting already existed in the UI; it just wasn't implemented in GCAdapter_Android.cpp.
2022-06-02 19:39:36 -07:00
36d4ee0939 GCAdapter: Use std::array for controller read and write payloads 2022-06-02 19:39:36 -07:00
dd6592698e GCAdapter: Merge GCAdapter.cpp and GCAdapter_Android.cpp
This is mostly a brainless merge, #ifdef-ing anything that doesn't match between the two while preserving common logic.  I didn't rename any variables (although similar ones do exist), but I did change one log that was ERROR on android and NOTICE elsewhere to just always be NOTICE.  Further merging will follow.
2022-06-02 19:39:36 -07:00
e0afcb3b94 Merge pull request #10540 from nyanpasu64/fix-gcadapter-atomics
Remove atomic usage and fix mutex locking in GCAdapter code
2022-04-23 22:04:10 +02:00
12cd81bdb3 GCAdapter: don't call libusb_detach_kernel_driver on apple 2022-04-22 09:56:47 -07:00
5cd3cf9072 GCAdapter: fix retval check of libusb_detach_kernel_driver 2022-04-22 09:56:47 -07:00
978c90845b GCAdapter: move libusb context teardown last 2022-04-22 09:56:47 -07:00
1c9dfb7bb6 GCAdapter: some macro cleanup 2022-04-22 09:56:47 -07:00
f52d94832e GCAdapter: set read/write thread names 2022-04-22 07:12:09 -07:00
871b01a5d9 Remove unnecessary atomic usage in GCAdapter.cpp
You can safely read or write non-atomic integers on multiple threads,
as long as every thread reading or writing it holds the same mutex
while doing so (here, s_mutex).

Removing the atomic accesses makes the code faster, but the actual
performance difference is probably negligible.
2022-03-27 22:27:57 -07:00
37806472e1 GCAdapter: Defer initialization until MainWindow::InitControllers
If libusb fails to initialize, an assertion fails, but if that happens before the main window is created, then Dolphin just dies.  Now, the panic alert is properly shown and the user can ignore it.
2022-03-10 10:35:45 -08:00
5c325eef38 Config: Port SI device settings to new config system. 2022-01-08 20:08:21 +01:00
0bfffe4095 Config: Port GC Adapter settings to new config system. 2022-01-05 03:25:19 +01:00
e149ad4f0a treewide: convert GPLv2+ license info to SPDX tags
SPDX standardizes how source code conveys its copyright and licensing
information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX
tags are adopted in many large projects, including things like the Linux
kernel.
2021-07-05 04:35:56 +02:00
ce8004c9c1 Lint: End of namespace 2021-06-07 12:55:52 +04:00
81092cf7e4 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.
2021-05-05 00:16:08 +03:00
a5e1415e74 InputCommon: Migrate logging over to fmt
Continues the migration of the logging calls over to the fmt capable
ones.
2020-10-23 13:16:18 -04:00
0ede5d1537 Use range loop (if possible) 2020-07-18 18:29:16 -05:00
b350d3cca3 InputCommon/GCAdapter: Unbreak Mayflash GCAdapters by allowing libusb_control_transfer call to fail. 2020-07-09 17:17:44 -05:00
f2fd5c7f90 InputCommon/GCAdapter: Fix offbrand "GCAdapters" with a libusb_control_transfer call. 2020-07-07 14:45:19 -05:00