From a824d078555b4c763d1c46a259b4d1446ee1efda Mon Sep 17 00:00:00 2001 From: OriginLegend <15822855+OriginLegend@users.noreply.github.com> Date: Fri, 17 Sep 2021 17:52:11 -0400 Subject: [PATCH 1/2] Added optional EMPTY_PACKET_DISCONNECT build-flag to disable empty-packet-disconnects --- Makefile | 5 ++++- README.md | 9 +++++++++ dongle/dongle.cpp | 3 +++ utils/macros.h | 23 +++++++++++++++++++++++ 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 utils/macros.h diff --git a/Makefile b/Makefile index fa5aa64..92c09ad 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,13 @@ BUILD := DEBUG VERSION := $(shell git describe --tags) +EMPTY_PACKET_DISCONNECT := 1 +CONFIG := $(CONFIG) -DEMPTY_PACKET_DISCONNECT=$(EMPTY_PACKET_DISCONNECT) + FLAGS := -Wall -Wpedantic -std=c++11 -MMD -MP DEBUG_FLAGS := -Og -g -DDEBUG RELEASE_FLAGS := -O3 -DEFINES := -DVERSION=\"$(VERSION)\" +DEFINES := -DVERSION=\"$(VERSION)\" $(CONFIG) CXXFLAGS += $(FLAGS) $($(BUILD)_FLAGS) $(DEFINES) LDLIBS += -lpthread -lusb-1.0 diff --git a/README.md b/README.md index bee52dc..586be45 100644 --- a/README.md +++ b/README.md @@ -163,6 +163,15 @@ The controller only remembers the *last* device it was connected to. It will not Some USB controllers are known to cause issues with xow. Plugging your dongle into a USB port that uses an `ASMedia` controller will lead to problems. Most `Intel` USB controllers work well with xow. Power management issues can arise when using a USB 3 controller. These can lead to timeouts of the USB communication. The use of a USB hub can mitigate these problems. +### Controller periodically disconnects (when idle) +Some controllers might periodically disconnect due to xow receiving an empty packet (which should not happen for most controllers). +This usually happens when the controller is not receiving any input, but can still happen when being used. +As a result, you can disable the automatic disconnect when building by using the `EMPTY_PACKET_DISCONNECT` flag as shown below: + +``` +make BUILD=RELEASE EMPTY_PACKET_DISCONNECT=0 +``` + ### Other problems In case of any other problems, please open an issue with all the relevant details (dongle version, controller version, logs, captures, etc.). diff --git a/dongle/dongle.cpp b/dongle/dongle.cpp index b931ff8..22c6d50 100644 --- a/dongle/dongle.cpp +++ b/dongle/dongle.cpp @@ -18,6 +18,7 @@ #include "dongle.h" #include "../utils/log.h" +#include "../utils/macros.h" Dongle::Dongle( std::unique_ptr usbDevice @@ -269,7 +270,9 @@ void Dongle::handleBulkData(const Bytes &data) case EVT_CLIENT_LOST: // Packet is guaranteed not to be empty + #if IS_PROP_ENABLED(EMPTY_PACKET_DISCONNECT) handleControllerDisconnect(packet[0]); + #endif break; } } diff --git a/utils/macros.h b/utils/macros.h new file mode 100644 index 0000000..8798056 --- /dev/null +++ b/utils/macros.h @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2019 Medusalix + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +// Define helper macros for property expansion +#define DO_EXPAND(VAL) VAL ## 1 +#define GET_VALUE(VAL) DO_EXPAND(VAL) +#define IS_PROP_ENABLED(VAL) GET_VALUE(VAL) != 1 + From 3702ed5d1d480fe89e8b94a5d32c819036fe607b Mon Sep 17 00:00:00 2001 From: OriginLegend <15822855+OriginLegend@users.noreply.github.com> Date: Fri, 17 Sep 2021 18:03:42 -0400 Subject: [PATCH 2/2] Marked the XBox Wireless Controller (Model 1914) as 'Working' --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 586be45..ddf4a48 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ The following Xbox One controllers are currently compatible with the driver: | 1698 | 2015 | Elite controller | **Working** | | 1708 | 2016 | Bluetooth connectivity | **Working** | | 1797 | 2019 | Elite controller series 2 | **Working** | -| 1914 | 2020 | Share button and USB-C | **Untested** | +| 1914 | 2020 | Share button and USB-C | **Working** | ## Releases