Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frequent disconnectsAdded optional EMPTY_PACKET_DISCONNECT build-flag to disable empty-packet-disconnects #185

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

OriginLegend
Copy link

Might resolve these issues: #170 and #144
This change simply adds a build-flag (via cxxflags) called EMPTY_PACKET_DISCONNECT

In my testing, the receipt of an empty packed does not always mean the controller needs to disconnect.
I am unsure if this is true for all controllers supported, but wanted to add a build-flag to make this configurable.

I have done extensive testing with the setup I do have and it is working flawlessly (no more disconnects)
I have an "XBox Wireless Controller - Pulse Red (Model 1914)"

@alkazar
Copy link

alkazar commented Sep 18, 2021

Amazing work! I can confirm this fixes the issue of my 1914 model Xbox controller disconnecting when idle.

@rojidev
Copy link

rojidev commented Sep 18, 2021

Can confirm this seems to work for me too, thanks a lot ☺

@OriginLegend
Copy link
Author

OriginLegend commented Sep 18, 2021

@alkazar and @rojidev Thanks for the feedback, I'm very happy to hear this is working for others as well :)

@alkazar
Copy link

alkazar commented Sep 19, 2021

Just a small update. I was playing using this patch and after about an hour of play my controller suddenly disconnected while I was actively using it (i.e. not while idle). I think this is a separate issue that has been reported before, but good information to know that this patch doesn't appear to fix that particular issue.

@sberthelot
Copy link

Works for me too !
Thanks for the patch, but it seems quite strange we can just bypass handleControllerDisconnect call :)

@OriginLegend
Copy link
Author

@alkazar I will continue to do more testing (with debug mode on, etc) to see if I run into the same issue as well (maybe multiple things at play here).

@sberthelot Happy it works for you too - definitely seemed odd to me at first too, but the way the comment in the code states, maybe the packet guarantee not to be empty isn't true for this particular model of controller. Much testing will need to happen, which is also why I just made it an optional build-flag for now. There are other places the handleControllerDisconnect gets called, and by-passing there led to crashes for me (since the controller never really "disconnected").

@silvannn
Copy link

silvannn commented Oct 7, 2021

Not working for me.
What I did is:
sudo systemctl stop xow
sudo systemctl disable xow
sudo make uninstall
rm -r xow

git clone https://github.com/medusalix/xow
make BUILD=RELEASE EMPTY_PACKET_DISCONNECT=0
sudo make install
sudo systemctl enable xow
sudo systemctl start xow

@kakra
Copy link
Contributor

kakra commented Oct 7, 2021

@silvannn Cannot work because you didn't clone the repository of the PR author.

@silvannn
Copy link

silvannn commented Oct 7, 2021

@kakra can you tell me exactly how that should be done please?

@OriginLegend
Copy link
Author

@silvannn You need to clone this repo: https://github.com/OriginLegend/xow.git with this branch: frequent-disconnects
Command: git clone -b checkout frequent-disconnects https://github.com/OriginLegend/xow.git

So your steps would be as follows:

sudo systemctl stop xow
sudo systemctl disable xow
sudo make uninstall
cd ..
rm -r xow

git clone -b checkout frequent-disconnects https://github.com/OriginLegend/xow.git
cd xow
make BUILD=RELEASE EMPTY_PACKET_DISCONNECT=0
sudo make install
sudo systemctl enable xow
sudo systemctl start xow

@silvannn
Copy link

silvannn commented Oct 7, 2021

Hi guys,
Thank you for your help @OriginLegend. Your solution is working, but instead of command:
git clone -b checkout frequent-disconnects https://github.com/OriginLegend/xow.git
I used
git clone -b frequent-disconnects https://github.com/OriginLegend/xow.git

No more disconnection when idle. Great job!
Share button still not working.

@BobbyByrne
Copy link

Works on my 1914 model as well. Thanks @OriginLegend hopefully this will be merged soon.

@OriginLegend
Copy link
Author

Just wanted to add an additional comment here for more specific directions (as referenced in communications from the issue: #144).

I have added a branch called frequent-disconnects in my fork: https://github.com/OriginLegend/xow/tree/frequent-disconnects
It is built and tested the same way, just includes that additional build-flag EMPTY_PACKET_DISCONNECT

You can follow these steps to update the version running on your computer:

To uninstall the service (if previously installed/running):

sudo systemctl stop xow
sudo systemctl disable xow
sudo make uninstall

To remove the currently cloned repo (or you can put it in a different directory):

cd ..
rm -r xow

Clone the forked repository (frequent-disconnects branch):

git clone -b frequent-disconnects https://github.com/OriginLegend/xow.git
cd xow

Build the new version with the build-flag added and install/setup:

make BUILD=RELEASE EMPTY_PACKET_DISCONNECT=0
sudo make install
sudo systemctl enable xow
sudo systemctl start xow

@ghost
Copy link

ghost commented Nov 10, 2021

Works for me as well, thank you @OriginLegend for your work! Hopefully this can get merged to master.

@viggy96
Copy link

viggy96 commented Jan 13, 2022

This worked for me as well. Are there any concerns blocking this from getting merged?

EDIT: Actually, spoke too soon. I get crashes with the build from OriginLegend.

Jan 15 21:08:39 monochrome xow[24319]: terminate called after throwing an instance of 'InputException'
Jan 15 21:08:39 monochrome xow[24319]:   what():  Error adding key code: Invalid argument
Jan 15 21:08:40 monochrome systemd[1]: xow.service: Main process exited, code=killed, status=6/ABRT
Jan 15 21:08:40 monochrome systemd[1]: xow.service: Failed with result 'signal'.
Jan 15 21:08:40 monochrome systemd[1]: xow.service: Consumed 13min 54.122s CPU time.

@viggy96
Copy link

viggy96 commented Jan 24, 2022

Nevermind, I reinstalled OriginLegend's fix and it works just fine now.

@codevski
Copy link

any progress into getting this merged? or still waiting on more testing

@pdiana
Copy link

pdiana commented Feb 27, 2022

Just wanted to add an additional comment here for more specific directions (as referenced in communications from the issue: #144).

I have added a branch called frequent-disconnects in my fork: https://github.com/OriginLegend/xow/tree/frequent-disconnects It is built and tested the same way, just includes that additional build-flag EMPTY_PACKET_DISCONNECT

You can follow these steps to update the version running on your computer:

To uninstall the service (if previously installed/running):

sudo systemctl stop xow
sudo systemctl disable xow
sudo make uninstall

To remove the currently cloned repo (or you can put it in a different directory):

cd ..
rm -r xow

Clone the forked repository (frequent-disconnects branch):

git clone -b frequent-disconnects https://github.com/OriginLegend/xow.git
cd xow

Build the new version with the build-flag added and install/setup:

make BUILD=RELEASE EMPTY_PACKET_DISCONNECT=0
sudo make install
sudo systemctl enable xow
sudo systemctl start xow

With the main branch I was getting a disconnect every few mins, blinking light on the controller for 10secs or so then it worked again.
I tried this branch but after a few mins it crashes.
xow status returns

● xow.service - Xbox One Wireless Dongle Driver
Loaded: loaded (/etc/systemd/system/xow.service; enabled; vendor preset: enabled)
Active: failed (Result: signal) since Sun 2022-02-27 16:02:42 CET; 53s ago
Process: 1193 ExecStart=/usr/local/bin/xow (code=killed, signal=ABRT)
Main PID: 1193 (code=killed, signal=ABRT)

xow[1193]: 2022-02-27 15:54:33 INFO  - Controller '1' connected
xow[1193]: 2022-02-27 15:54:33 INFO  - Device announced, product id: 0b12
xow[1193]: 2022-02-27 15:54:33 INFO  - Serial number: 09710143615150
xow[1193]: 2022-02-27 15:54:34 INFO  - Battery level: medium
xow[1193]: 2022-02-27 16:02:41 INFO  - Controller '2' connected
xow[1193]: 2022-02-27 16:02:42 INFO  - Device announced, product id: 0b12
xow[1193]: terminate called after throwing an instance of 'InputException'
xow[1193]:   what():  Error adding key code: Invalid argument
systemd[1]: xow.service: Main process exited, code=killed, status=6/ABRT
systemd[1]: xow.service: Failed with result 'signal'.

I'm running Mint 20.3, kernel 5.13.0-30-generic

If you need debug infos just let me know where to fetch them.
Ty for your work!

@codevski
Copy link

Just wanted to add an additional comment here for more specific directions (as referenced in communications from the issue: #144).
I have added a branch called frequent-disconnects in my fork: https://github.com/OriginLegend/xow/tree/frequent-disconnects It is built and tested the same way, just includes that additional build-flag EMPTY_PACKET_DISCONNECT
You can follow these steps to update the version running on your computer:
To uninstall the service (if previously installed/running):

sudo systemctl stop xow
sudo systemctl disable xow
sudo make uninstall

To remove the currently cloned repo (or you can put it in a different directory):

cd ..
rm -r xow

Clone the forked repository (frequent-disconnects branch):

git clone -b frequent-disconnects https://github.com/OriginLegend/xow.git
cd xow

Build the new version with the build-flag added and install/setup:

make BUILD=RELEASE EMPTY_PACKET_DISCONNECT=0
sudo make install
sudo systemctl enable xow
sudo systemctl start xow

With the main branch I was getting a disconnect every few mins, blinking light on the controller for 10secs or so then it worked again. I tried this branch but after a few mins it crashes. xow status returns

● xow.service - Xbox One Wireless Dongle Driver
Loaded: loaded (/etc/systemd/system/xow.service; enabled; vendor preset: enabled)
Active: failed (Result: signal) since Sun 2022-02-27 16:02:42 CET; 53s ago
Process: 1193 ExecStart=/usr/local/bin/xow (code=killed, signal=ABRT)
Main PID: 1193 (code=killed, signal=ABRT)

xow[1193]: 2022-02-27 15:54:33 INFO  - Controller '1' connected
xow[1193]: 2022-02-27 15:54:33 INFO  - Device announced, product id: 0b12
xow[1193]: 2022-02-27 15:54:33 INFO  - Serial number: 09710143615150
xow[1193]: 2022-02-27 15:54:34 INFO  - Battery level: medium
xow[1193]: 2022-02-27 16:02:41 INFO  - Controller '2' connected
xow[1193]: 2022-02-27 16:02:42 INFO  - Device announced, product id: 0b12
xow[1193]: terminate called after throwing an instance of 'InputException'
xow[1193]:   what():  Error adding key code: Invalid argument
systemd[1]: xow.service: Main process exited, code=killed, status=6/ABRT
systemd[1]: xow.service: Failed with result 'signal'.

I'm running Mint 20.3, kernel 5.13.0-30-generic

If you need debug infos just let me know where to fetch them. Ty for your work!

Get the same issue now...

@OriginLegend
Copy link
Author

OriginLegend commented Mar 22, 2022

@pdiana Apologies on delays on this, I will probably get a chance this weekend to look into these errors specifically and will hopefully post an update then.

Were there any updates you made to your system @codevski since the previous change? It does look like my Linux Kernel might be a little behind, as I am running on Linux Mint (20.3 Cinnamon) on Linux Kernel 5.4.0-100-generic, so I might look into what might be different there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants