libusb / libusb

A cross-platform library to access USB devices
https://libusb.info
GNU Lesser General Public License v2.1
5.3k stars 1.92k forks source link

Xbox Controller Dongle Issues #746

Closed skrrrm closed 4 years ago

skrrrm commented 4 years ago

Hi, I am experiencing frequent disconnects between dongle and controllers - using recent versions of xow, but the issues only arose after a certain commit. I've opened an issue with xow, where the developer suggests that it might be an issue with libusb:

It seems like there's a relation between my switch from the async libusb API to the sync API in commit 78cdb31 and the problems you are encountering.


System info:

OS:` Manjaro 20.0.3 Lysia
Kernel: x86_64 Linux 5.4.44-1-MANJARO

libusb version: 1.0.23-2

lspci | grep USB:

02:00.0 USB controller: Advanced Micro Devices, Inc. [AMD] X370 Series Chipset USB 3.1 xHCI Controller (rev 02)
07:00.0 USB controller: ASMedia Technology Inc. ASM1143 USB 3.1 Host Controller
0d:00.3 USB controller: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) USB 3.0 Host Controller

I believe I've been using one of the AMD Controllers since the ASMedia controller, would crash the whole USB stack when used with the dongle.

medusalix commented 4 years ago

Some details (I'm xow's maintainer):

This issue only seems to affect xHCI USB controllers, while EHCI and OHCI controllers (and USB 2.0 ports) usually work fine. I don't believe this is a kernel bug, as there seems to be a relation between xow and its use of the libusb APIs.

Thanks for your assistance.

diabolo38 commented 4 years ago

disconnect is rarely caused by s/w unless it cause fault and reboot in the device f/w. Am experiencing such issue with some device (most are dwc3 based otg h/w ) and with with some host controler/Cable . It is linked to LPM (Link power management) of USB 3.0 bus. The device h/w if faulty and rarely fail on link training , but it occur so ofen whith LPM aggressive host that it come radily unusable as you start getting exhange. You may overcome this problem by disabling PM on the root hub controller (if it work often it does nothing) or try to use a hub in between as they tend to fully filter the power management. it work around the problem.

skrrrm commented 4 years ago

I'll try do some testing on a hub.

skrrrm commented 4 years ago

I'm still experiencing the same type of disconnects with a usb-hub inbetween. I doubt my device is faulty since it's working fine on an older version and in Windows. I'll try around with Power Managment settings.

skrrrm commented 4 years ago

I've disabled USB_AUTOSUSPEND through TLP - same result.

mcuee commented 4 years ago

In any case, this is not a libusb problem. This is either a kernel problem or a device problem.

mcuee commented 4 years ago

libusb is a user space API and it should not cause the device to disconnect or the USB controller to crash. Most likely the async API triggered the inherent problem with the device or the kernel USB stack.

mcuee commented 4 years ago

What you can do is to try a few things to rule out kernel problem. 1) Try to update the kernel. 2) Try to generate usbmon traces and ask in the linux-usb mailing list. They should be able to pinpont the problem. https://www.kernel.org/doc/Documentation/usb/usbmon.txt

mcuee commented 4 years ago

Close for now.