C0rn3j / sc-controller

User-mode driver and GTK3 based GUI for Steam Controller
GNU General Public License v2.0
13 stars 1 forks source link

DS4 controller fails to load - Failed to determine controller device #13

Open elogicuk opened 2 weeks ago

elogicuk commented 2 weeks ago

Please help sc controller no longer works for me on arch linux :(

here is the output from scc-daemon debug

D SCCDaemon     Starting SCCDaemon...
D SCCDaemon     Initializing drivers...
W SCCDaemon     Skipping disabled driver 'ds5drv'
W SCCDaemon     Skipping disabled driver 'fake'
W SCCDaemon     Skipping disabled driver 'remotepad'
D USB           Registered USB driver for 054c:09cc
D USB           Registered USB driver for 054c:05c4
D USB           Registered USB driver for 28de:1102
D USB           Registered USB driver for 28de:1142
D USB           Registered USB driver for 28de:1205
D Mapper        Creating virtual devices
D Mapper        Keyboard: <scc.uinput.Keyboard object at 0x7ac7f692b5f0>
D Mapper        Mouse:    <scc.uinput.Mouse object at 0x7ac7f6fd7980>
D Mapper        Gamepad:  <scc.uinput.UInput object at 0x7ac7f6948530>
D SCCDaemon     Created control socket /home/home/.config/scc/daemon.socket
D SCCDaemon     Connected to XServer :1
D asyncio       Using selector: EpollSelector
D OSD DaemonCtrl    Connected to daemon, version 0.4.8.13
D OSD DaemonCtrl    Daemon is ready.
I SCCDaemon     Registered scc-osd-daemon
I OSD osd.daemon    Sucessfully registered as scc-osd-daemon
W DS4           Failed to determine controller device
C0rn3j commented 2 weeks ago

image

Works for me, and the debug log of yours (please use triple backticks next time this was illegible) seems fine.

Reboot?

mv ~/.config/scc ~/.config/scc.bak perhaps, if that fixes it, I am curious what exactly broke it.

If not, launch the app, not the daemon, to perhaps see what is wrong.

W SCCDaemon     Wayland detected. Disabling X11 support, some functionality will be unavailable
D asyncio       Using selector: EpollSelector
D USB           USB device added: 28de:1142
D SCDongle      Not requesting serial number for SC sc1
D SCDongle      Got wireless SC with serial sc1
D SCCDaemon     Assigned default_mapper to <SCWireless sc1>
D SCCDaemon     Controller added: <SCWireless sc1>
elogicuk commented 2 weeks ago

Rebooting did not fix it.

And running this did not fix it - mv ~/.config/scc ~/.config/scc.bak

╰─λ scc gui

W ContImage     Area for button DOTS not found
W ContImage     Area for button DOTS not found
W App           Failed to read release notes
E App           g-io-error-quark: Not Found (1)
Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/scc/gui/app.py", line 1559, in http_ready
    stream = f.read_finish(task)
             ^^^^^^^^^^^^^^^^^^^
gi.repository.GLib.GError: g-io-error-quark: Not Found (1)
W App           (above error is not fatal and can be ignored)
C0rn3j commented 2 weeks ago

Looks like https://github.com/C0rn3j/sc-controller/issues/14 is causing this actually, now that it correctly links to this repo.

Change the mentioned file to say .18 for now and see if that fixes it.

I suppose f.read_async(0, None, http_ready, buffer) is the thing that breaks it as it's not being caught for errors..

EDIT: Yep, but that issue causes no problems.

What is your actual problem?

elogicuk commented 2 weeks ago

my actual problem is sc controller is not seeing my DS4 controller (dont work plugged in with usb or with bluetooth)

i wish i never upgraded my system is was working fine before :(

C0rn3j commented 2 weeks ago

Does old version of sc-controller work? You can try the appimages for a quit test I suppose.

elogicuk commented 2 weeks ago

no an older version does not work also

C0rn3j commented 2 weeks ago

https://github.com/C0rn3j/sc-controller/blob/b21c73535d46bc58cf712f136298c3dad42ee69c/scc/drivers/ds4drv.py#L379

The relevant code is here.

You may want to try downgrading kernel (to let's say linux-lts since you're on Arch) and seeing if it works there.

Narrowing down which component that you updated caused this would help.

elogicuk commented 2 weeks ago

i see something in my journal errors log

Aug 29 14:43:24 home-ms7b17 kernel: playstation 0005:054C:09CC.000A: DualShock4 input CRC's check failed

C0rn3j commented 5 days ago

That sounds like an issue with your system/controller unrelated to sc-controller. My dmesg when connecting a (valid) chinese DS4 clone is as such:

[249217.027122] playstation 0005:054C:05C4.0025: unknown main item tag 0x0
[249217.027709] playstation 0005:054C:05C4.0025: hidraw8: BLUETOOTH HID v1.00 Gamepad [Wireless Controller] on ac:50:de:59:12:ca
[249217.311570] input: Wireless Controller as /devices/virtual/misc/uhid/0005:054C:05C4.0025/input/input62
[249217.311694] input: Wireless Controller Motion Sensors as /devices/virtual/misc/uhid/0005:054C:05C4.0025/input/input63
[249217.311749] input: Wireless Controller Touchpad as /devices/virtual/misc/uhid/0005:054C:05C4.0025/input/input64
[249217.311954] playstation 0005:054C:05C4.0025: Registered DualShock4 controller hw_version=0x00006404 fw_version=0x00007008

However it did not seem to work for me for a different reason, and now after adding it as a custom controller I can't even launch scc-daemon, because apparently custom controller logic was not ported to Python 3 during the migration, so that's fun:

Error that is now fixed: ```python [1] % scc-daemon debug D SCCDaemon Starting SCCDaemon... D SCCDaemon Initializing drivers... W SCCDaemon Skipping disabled driver 'fake' W SCCDaemon Skipping disabled driver 'remotepad' Traceback (most recent call last): File "/usr/bin/scc-daemon", line 36, in main() File "/usr/bin/scc-daemon", line 32, in main daemon.debug() File "/usr/lib/python3.12/site-packages/scc/sccdaemon.py", line 1122, in debug self.run() File "/usr/lib/python3.12/site-packages/scc/sccdaemon.py", line 655, in run self.init_drivers() File "/usr/lib/python3.12/site-packages/scc/sccdaemon.py", line 98, in init_drivers if getattr(mod, "init")(self, cfg): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/scc/drivers/hiddrv.py", line 691, in init d = HIDDrv(daemon) ^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/scc/drivers/hiddrv.py", line 568, in __init__ self.scan_files() File "/usr/lib/python3.12/site-packages/scc/drivers/hiddrv.py", line 604, in scan_files self.config_files[vid, pid] = config_file.decode("utf-8") ^^^^^^^^^^^^^^^^^^ AttributeError: 'str' object has no attribute 'decode'. Did you mean: 'encode'? ```

I'll see about fixing that, but we need to look if the rest of the decodes is also needed and it was just forgotten in the Python 3 transition:

scc/parser.py:                  s = s.decode("utf-8")
scc/tools.py:                   (c.decode("utf-8") if type(c) is bytes else c)
scc/tools.py:           #msg = msg if type(msg) is str else msg.decode("utf-8")
scc/lib/xinput.py:                      .decode("utf-8"))
scc/x11/autoswitcher.py:                        buffer += r.decode("utf-8")
scc/sccdaemon.py:                                       filename = message[8:].decode("utf-8").strip("\t ")
scc/sccdaemon.py:                                       text = message[5:].decode("utf-8").strip("\t ")
scc/sccdaemon.py:               s = s.decode("utf-8").strip(" \t\r\n")
scc/gui/svg_widget.py:                          self._tree = ET.fromstring(svgw.current_svg.decode("utf-8"))
scc/gui/daemon_manager.py:                      line = line.decode("utf-8")
scc/gui/importexport/dialog.py:                 if f.decode("utf-8").strip(" \t\r\n").startswith("{"):
scc/gui/global_settings.py:                                     name = name.decode("utf-8")
scc/gui/profile_switcher.py:                            name = name.decode("utf-8")
scc/gui/app.py:                                 self.on_got_release_notes(buffer.decode("utf-8"))
C0rn3j commented 5 days ago

So, I fixed the utf-8 issue for custom controllers, will be available in next release.

I was able to instantly connect the controller via USB.

However, I was not able to connect my controller via BT, and when I added it as HIDRAW(default) instead of evdev, it produced further crashes on an assert that the device is already handled - this seems to be because DS4 hidraw is already there, so if you add it twice (which it lets you), it crashes that way.

Adding it via evdev made it work. So there's something wrong with the hidraw backend and it's not able to pick the controller up.

Again, your issue seems to be related to something else as you get told off immediately in the kernel log, which seems like a BT error.

Run sudo dmesg -w, connect the controller and post what shows up.

D USB Registered USB driver for 054c:05c4 but it does look like wired should be fine?

elogicuk commented 3 days ago

Is working now, maybe i was using a bad usb cable i dont know?

[77136.234905] usb 1-9.2: new full-speed USB device number 13 using xhci_hcd
[77136.374979] usb 1-9.2: New USB device found, idVendor=054c, idProduct=09cc, bcdDevice= 1.00
[77136.374981] usb 1-9.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[77136.374983] usb 1-9.2: Product: Wireless Controller
[77136.374983] usb 1-9.2: Manufacturer: Sony Interactive Entertainment
[77136.412694] playstation 0003:054C:09CC.000A: hidraw9: USB HID v1.11 Gamepad [Sony Interactive Entertainment Wireless Controller] on usb-0000:00:14.0-9.2/input3
[77136.464430] input: Sony Interactive Entertainment Wireless Controller as /devices/pci0000:00/0000:00:14.0/usb1/1-9/1-9.2/1-9.2:1.3/0003:054C:09CC.000A/input/input24
[77136.464617] input: Sony Interactive Entertainment Wireless Controller Motion Sensors as /devices/pci0000:00/0000:00:14.0/usb1/1-9/1-9.2/1-9.2:1.3/0003:054C:09CC.000A/input/input25
[77136.464710] input: Sony Interactive Entertainment Wireless Controller Touchpad as /devices/pci0000:00/0000:00:14.0/usb1/1-9/1-9.2/1-9.2:1.3/0003:054C:09CC.000A/input/input26
[77136.464893] playstation 0003:054C:09CC.000A: Registered DualShock4 controller hw_version=0x00007404 fw_version=0x00008007