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

bluetooth unreliable on latest archlinux #7

Closed
nicman23 opened this issue Apr 11, 2020 · 15 comments
Closed

bluetooth unreliable on latest archlinux #7

nicman23 opened this issue Apr 11, 2020 · 15 comments

Comments

@nicman23
Copy link

nicman23 commented Apr 11, 2020

this is with the dkms module with both linux and linux-lts packages. It was previously stable with it (i have only every used the dkms module).

the modules complains for a time out. tested all of my commits, 2 different controllers (one pro, one joy r), downgrading bluez, removing imu

only report i get is:

nintendo 0005:057E:2009.000D: timeout waiting for input report
nintendo 0005:057E:2009.000E: unknown main item tag 0x0
nintendo 0005:057E:2009.000E: hidraw9: BLUETOOTH HID v80.01 Gamepad [Pro Controller] on 00:19:86:00:00:47

___

upowerd[2007]: treating change event as add on /sys/devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb1/1-4/1-4.3/1-4.3:1.0/bluetooth/hci0/hci0:11/0005:057E:2009.000E/power_supply/nintendo_switch_controller_battery_0005:057E:2009.000E
upowerd[2007]: did not recognise type Unknown, please report
upowerd[2007]: did not recognise type Unknown, please report

edit: it seems to be the rumble, reverting support for it makes the bluetooth connection stable again

@nicman23 nicman23 changed the title bluetooth unreliable on latest arch bluetooth unreliable on latest archlinux Apr 11, 2020
@DanielOgorchock
Copy link
Owner

DanielOgorchock commented Apr 11, 2020

Weird, I'm running arch on a 5.6 kernel, and I'm not having this issue. I wonder if it depends on the bluetooth controller in use.

edit: It makes sense that things are less likely to look broken with rumble disabled. That's the only thing frequently sending commands from the PC to the controller. Another test would be (with rumble disabled) seeing if you can reliably turn the player LEDs on/off through the sysfs led interface, since this also requires sending subcommands to the controller.

@nicman23
Copy link
Author

nicman23 commented Apr 12, 2020

while true; do for i in 0005\:057E\:2009.0015\:*/brightness; do echo 0 > "${i}"; echo 255 > "${i}"; done & sleep 0.1; done

ctrl-c

wait

that is what i used to spam the interface. no disconnects when not touching the controller. however with joycond running and testing the analogs it disconnects quite quickly.

running without the daemon, i can spam the interface indefinitely, but as soon as all the jobs finish (wait exits) the controller disconnects!

also the disconnects -with the module compiled for rumble support- happened without any games running / without any reason for the rumble to fire

@psycho-driver
Copy link

psycho-driver commented Apr 15, 2020

I too have been having this problem since patching gentoo kernel 5.5.2-gentoo-r1 with your driver. 1 controller will stay connected for a while sometimes but eventually disconnects. It ranges from 45 seconds to 45 minutes. 2 controllers cause 1 to disconnect pretty quickly, usually within a minute or two.

I was using a dongle with the CSR8510 A10 chipset initially. Today I received a Plugable BCM20702A0 based dongle as well as an 8BitDo SN30 Pro to test with. My 2 Switch Pro controllers behaved exactly the same with the BCM chipset. The 8BitDo hasn't exhibited any connectivity problems so far.

I don't know why I didn't think to try this before, but I removed the hid-nintendo.ko module and just connected the switch pro controllers through the generic input driver, and they've been synced up for about 40 minutes now without issue.

Edit: Removed rumble support and they stay connected with either bluetooth dongle.
Edit2: Leds are working fine, I don't think it has anything to do with the led code unless it's causing a conflict when rumble is enabled.

@DanielOgorchock
Copy link
Owner

When rumble is enabled the driver sends rumble subcommands to the controller several times per second even if the rumble amplitude is zero (i.e. when no program is playing a force feedback effect). I suspect that this extra bluetooth traffic is resulting in the connection being much flakier.

It also makes sense that using the generic HID input driver will be less likely to disconnect. The controller works in a much simpler reporting mode with no analog joysticks or various other features. hid-nintendo places the controller in the full 60Hz reporting mode.

I'll do some further testing with my setup using bluetooth. Admittedly most of my testing has been using USB.

@bernharl
Copy link

Any update on this? I'm still getting constant disconnects. How do i turn of rumble on Arch Linux with the dkms driver?

@DanielOgorchock
Copy link
Owner

DanielOgorchock commented May 31, 2020

Please give this patch a try: 1c27248

It prevents constantly sending rumble subcommands when there is no ongoing rumble effect. This should drastically reduce the bluetooth traffic.

@bernharl
Copy link

Thanks for the quick reply.

Do I just replace hid_nintendo.c when building the dkms driver then? I'm pretty new to this, sorry!

@nicman23
Copy link
Author

i updated the dkms driver, the patch seems good !

@nicman23
Copy link
Author

it does still dcs if i spam fftest a bit, but when nothing is happening it is fine.

also if i change the effect type in fftest too fast, it eats the input

@bernharl
Copy link

bernharl commented Jun 1, 2020

It works perfectly for me now after installing the updated AUR package!

@joaorb64
Copy link

joaorb64 commented Jun 3, 2020

I also had disconnections before. Yesterday I played for some time with it and didn't have any kind of connection issues!

DanielOgorchock pushed a commit that referenced this issue Jun 6, 2020
[ Upstream commit 20a785a ]

This BUG halt was reported a while back, but the patch somehow got
missed:

PID: 2879   TASK: c16adaa0  CPU: 1   COMMAND: "sctpn"
 #0 [f418dd28] crash_kexec at c04a7d8c
 #1 [f418dd7c] oops_end at c0863e02
 #2 [f418dd90] do_invalid_op at c040aaca
 #3 [f418de28] error_code (via invalid_op) at c08631a5
    EAX: f34baac0  EBX: 00000090  ECX: f418deb0  EDX: f5542950  EBP: 00000000
    DS:  007b      ESI: f34ba800  ES:  007b      EDI: f418dea0  GS:  00e0
    CS:  0060      EIP: c046fa5e  ERR: ffffffff  EFLAGS: 00010286
 #4 [f418de5c] add_timer at c046fa5e
 #5 [f418de68] sctp_do_sm at f8db8c77 [sctp]
 #6 [f418df30] sctp_primitive_SHUTDOWN at f8dcc1b5 [sctp]
 #7 [f418df48] inet_shutdown at c080baf9
 #8 [f418df5c] sys_shutdown at c079eedf
 #9 [f418df70] sys_socketcall at c079fe88
    EAX: ffffffda  EBX: 0000000d  ECX: bfceea90  EDX: 0937af98
    DS:  007b      ESI: 0000000c  ES:  007b      EDI: b7150ae4
    SS:  007b      ESP: bfceea7c  EBP: bfceeaa8  GS:  0033
    CS:  0073      EIP: b775c424  ERR: 00000066  EFLAGS: 00000282

It appears that the side effect that starts the shutdown timer was processed
multiple times, which can happen as multiple paths can trigger it.  This of
course leads to the BUG halt in add_timer getting called.

Fix seems pretty straightforward, just check before the timer is added if its
already been started.  If it has mod the timer instead to min(current
expiration, new expiration)

Its been tested but not confirmed to fix the problem, as the issue has only
occured in production environments where test kernels are enjoined from being
installed.  It appears to be a sane fix to me though.  Also, recentely,
Jere found a reproducer posted on list to confirm that this resolves the
issues

Signed-off-by: Neil Horman <[email protected]>
CC: Vlad Yasevich <[email protected]>
CC: "David S. Miller" <[email protected]>
CC: [email protected]
CC: [email protected]
CC: [email protected]
Acked-by: Marcelo Ricardo Leitner <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
@nicman23
Copy link
Author

is this patch from 085bb27 upstream?

@DanielOgorchock
Copy link
Owner

is this patch from 085bb27 upstream?

No you can completely disregard that patch. I rebased at some point, and that commit message happened to reference an unrelated issue with the same ID. I haven't made further changes to the Bluetooth reliability.

@sirdeiu
Copy link

sirdeiu commented Feb 1, 2021

Hi @DanielOgorchock

I'm seeing issues with the Nintendo Pro controller also, for the following:

openSUSE Tumbleweed with kernel: 5.10.9-1-default
KDE Plasma 5
hid-nintendo 3
joycond

While trying to play Streets of Rage 4, I keep having random disconnects from the Pro Controller, while it is connected via Bluetooth. I have tried it with two Bluetooth adapters (Intel Wifi AX200 and ASUS BT-400 (with firmware).

In game, Streets of Rage 4 has an option to disable rumble (Vibration intensity), setting that to 0% results in the controller working normally and being able to use it while playing.

With rumble enabled, while playing SOR4, the controller disconnected quite fast and randomly.

Reported initially here: https://github.com/nicman23/dkms-hid-nintendo/issues/28

@psycho-driver
Copy link

psycho-driver commented Feb 1, 2021 via email

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

No branches or pull requests

6 participants