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

Trouble with PS3 controller via USB #55

Closed
mdeguzis opened this issue Jul 3, 2014 · 18 comments
Closed

Trouble with PS3 controller via USB #55

mdeguzis opened this issue Jul 3, 2014 · 18 comments

Comments

@mdeguzis
Copy link
Owner

mdeguzis commented Jul 3, 2014

Status
Regression in: Ubuntu 3.13.0-30-generic kernel
Kernel Module: sony-hid.ko

Still exists in latest trusty propsed: 3.13.0-31-generic

[  109.778489] sony 0003:054C:0268.0005: Fixing up Sony Sixaxis report descriptor
[  109.828401] sony 0003:054C:0268.0005: input,hiddev0,hidraw2: USB HID v1.11 Joystick [Sony PLAYSTATION(R)3 Controller] on usb-0000:00:1d.1-1/input0
[  109.828406] sony 0003:054C:0268.0005: can't set operational mode
[  109.864280] sony: probe of 0003:054C:0268.0005 failed with error -38

Latest comment on bug of relevance
"Had the same problem with Kernel 3.13.0-30. I upgraded the kernel to 3.14
from linux-image-3.14.0-031400-generic_3.14.0-031400.201403310035_amd64.deb and the controller now works.

brandon@Desktop:~$ uname -a
Linux Desktop 3.14.0-031400-generic #201403310035 SMP Mon Mar 31 04:36:23 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux"

Looks related to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1326725

Source article:
http://gameimps.com/ps3-controller-linux-usb-290

@mdeguzis mdeguzis changed the title Trouble with PS3 via USB Trouble with PS3 controller via USB Jul 3, 2014
@mdeguzis
Copy link
Owner Author

mdeguzis commented Jul 4, 2014

We can upgrade to 3.14 noted here:
http://www.sysads.co.uk/2014/04/installupgrade-linux-kernel-3-14-trusty-ubuntu/

As part of standard install it stays with oldest Canonical can maintain. You can switch to using latest Ubuntu kernel with LTS any time though

@mdeguzis
Copy link
Owner Author

mdeguzis commented Jul 4, 2014

@beaumanvienna , upgrading to 3.14 works!. I will continue to test this out in the beta. If things continue to work well for this week or the next, this could be semi-permant or it could always stay in beta.

Seems xboxdrv is the only way to go. Folks will have to adjust the number of controllers in /etc/default/xboxdrv. You can't "pre-set" 4 controllers as you did with xbox 360.

@beaumanvienna
Copy link
Contributor

That's really good! The RetroRig will make a kernel update? Cool stuff!

@mdeguzis
Copy link
Owner Author

mdeguzis commented Jul 5, 2014

Well...right now I have it as a settings option, and when a user would choose the PS3 USB as a gampead it jumps to that function and warns them about non-supported kernels (if you check that link above you'll see Canonical standard blah blah blah on it). If beta testing goes well....then maybe we can just include this in the setup at the very end, and since they have to reboot anyway...presto chango, finished? So....for now I am going to keep working on the controls for PS3 USB today and refine those, test from scratch, but first I have many errants for a few hours yet.

@mdeguzis mdeguzis closed this as completed Jul 5, 2014
@mdeguzis mdeguzis reopened this Jul 5, 2014
@mdeguzis
Copy link
Owner Author

mdeguzis commented Jul 5, 2014

@beaumanvienna , JC - we need to chat a bit about the PS3 USB support. Is there a way we can build in a check for when the USB connection is severed with the USB PS3 Controller method, so that when it's plugged in the kernel module is again detached like it would on reboot?

Here is the dmesg output:

[ 6290.668128] usb 6-1: USB disconnect, device number 2
[ 6426.868062] usb 6-1: new full-speed USB device number 3 using uhci_hcd
[ 6427.081079] usb 6-1: New USB device found, idVendor=054c, idProduct=0268
[ 6427.081087] usb 6-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 6427.081093] usb 6-1: Product: PLAYSTATION(R)3 Controller
[ 6427.081097] usb 6-1: Manufacturer: Sony
[ 6427.117163] sony 0003:054C:0268.0006: Fixing up Sony Sixaxis report descriptor
[ 6427.161256] input: Sony PLAYSTATION(R)3 Controller as /devices/pci0000:00/0000:00:1d.1/usb6/6-1/6-1:1.0/0003:054C:0268.0006/input/input12
[ 6427.161651] sony 0003:054C:0268.0006: input,hiddev0,hidraw2: USB HID v1.11 Joystick [Sony PLAYSTATION(R)3 Controller] on usb-0000:00:1d.1-1/input0

This small script effectively does what I want to achieve, but I want to see how we can make this better or incorporate this into a service. Maybe rescan can continuously poll for that usb connection and then perform something like this:

#!/bin/bash
sudo rmmod hid_sony
sudo service xboxdrv restart &

I can't blacklist hid_sony, as I think it's used also for a basic connect (I tried). There fore the two lines above are needed.

@mdeguzis
Copy link
Owner Author

mdeguzis commented Jul 6, 2014

The good news, is while connected via USB, the controller does not "time out."

@beaumanvienna
Copy link
Contributor

Cool! I noticed you are working on test instructions right now. Very nice! I can then easily test all your changes. Are we already switching to kernel 3.14 by default? If yes, we could make a small dialog after install asking for a reboot. Like on good old windows :-D

But: I won't start testing right now. The problem is that I use the Ubuntu test install also for xbmc and mednafen development. Right now, I got all tools working really nice :-D . Next weekend then!

I have to admit, I like kdevelop quite a bit now. Haven't had a look at that for years. I like the debugging. It helps a lot to understand which ways a program goes...

@mdeguzis
Copy link
Owner Author

mdeguzis commented Jul 6, 2014

I did put in a reboot call at end, but removed it since the gamepad function already informs the user. I can "force" them to that screen at the end of it all. no problem :) Cool, yea I heard of Kdevelop. Time for some coffee...its 06:44, so its time to just stay up and not go back to sleep haha.

@beaumanvienna
Copy link
Contributor

Just make sure to switch off your computer, otherwise you'll mess up thinks ;-)

@beaumanvienna
Copy link
Contributor

If you use gdb directly (kdevelop is just a front-end), it gives you some more opportunities. When a programs hangs you can stop it it to get a backtrace. That's how I found the deadlocks in xbmc...

I'm just glad now that mednafen is written in plain C. And it's not such a monster like XBMC...

@mdeguzis
Copy link
Owner Author

mdeguzis commented Jul 6, 2014

Oh you know .C is a proper language
-Linus Torvalds

Hahha

On July 6, 2014 7:21:51 AM EDT, Jens-Christian [email protected] wrote:

If you use gdb directly (kdevelop is just a front-end), it gives you
some more opportunities. When a programs hangs you can stop it it to
get a backtrace. That's how I found the deadlocks in xbmc...

I'm just glad now that mednafen is written in plain C. And it's not
such a monster like XBMC...


Reply to this email directly or view it on GitHub:
#55 (comment)

Sent from my Android device with K-9 Mail. Please excuse my brevity.

@beaumanvienna
Copy link
Contributor

I did a re-install from scratch.

Looks impressive! I'm now running on kernel 3.14. The grub menu was updated accordingly. The Nouveou driver had problems with the second monitor, but that was quickly resolved be updating to the Nvidia drivers.

I did exchange xbmc.bin to the latest debug version. No hanging so far.

I still can't run updates in RCB. This time I get to the import dialog, but it leaves me with a blank selection window. The import occurs every time again, when starting RCB. The import itself is less then a second, while it normaly takes 10 or 20s. There's a message popping up, but it's way to fast to read it.

I'm now testing the PS3+USB combination. Good job on this one! Keymapping is fine, same as hotplugging. Awesome!

Some things I noticed during ./retrorig_setup.sh: The cancel option is funny, when it's asking for a reboot after the install.

After testing with USB, I'm now changing to BT. I ran ./retrorig_setup.sh again. It stop xboxdrv and starts. What's funny, I didn't had to press the PS3 after pairing, it started automatically with controller ID 2 (second LED on). Works fine with xbmc. Switching it off and back on leaves it still with ID 1. Hotplugging for BT still works. Really great job! A small thing that I noticed is after the BT pairing, when all is finished and the last dialog shows "Pairing of controller finished" (or something similar), there used to be a display of both BT MAC addresses. That's gone. I've been noticing that actually for three or four days now.

The XBMC icon is still broken when it shows up in the launch bar. Hovering the mouse over it reveals "XBMC media center".

And we got to suppress all these huge amount of text output, when RetroRig is changing the permissions. In gnome-terminal this is pretty fast, but still quite useless. When running the sript in a real TTY, it's much slower and just shows flickering character salad.

But good job! The USB stuff and new kernel that you did in the last days looks really good!

@mdeguzis
Copy link
Owner Author

mdeguzis commented Jul 6, 2014

I still can't run updates in RCB. This time I get to the import dialog, but it leaves me with a blank selection window. The import occurs every time again, when starting RCB. The import itself is less then a second, while it normaly takes 10 or 20s. There's a message popping up, but it's way to fast to read it

Hmm...I have no problem with this. Did you add a ROM, with the proper format to a ROM folder? It's probably just not importing anything. I have no problem with importing. You are seeing a blank window because the MyGames.db file is blank, and no games were imported. Hit the context menu, (Square or C on keyboard) and go to "edit ROM collection" Take a look in there for all the options I have set currently.

Some things I noticed during ./retrorig_setup.sh: The cancel option is funny, when it's asking for a reboot after the install.

done - moved rrs_reboot() outside log brackets
I'll check this out. Actually, this is because all the functions in option 1) are bracketed into the log. So I think this is as simple as moving rrs_reboot()outside the logging braces.

when all is finished and the last dialog shows "Pairing of controller finished" (or something similar), there used to be a display of both BT MAC addresses. That's gone. I've been noticing that actually for three or four days now.

I only had this in for debug purposes. Do you wan it left in for now, while in beta? See lines 96-98 of gamepads.shinc

        # TESING ONLY!!!
        # echo "The USB MAC Address is: $PS3_MAC_P1_USB"
        # echo "The Bluetooth MAC Address is: $PS3_MAC_P1_BLU"

The XBMC icon is still broken when it shows up in the launch bar. Hovering the mouse over it reveals "XBMC media center".

You changed this line earlier:

    # Can't use $HOME in the desktop file, so need to replace $user string
    sed -i "s|/home/test/Pictures|$xdg_pictures_dir|g" "/usr/share/applications/RetroRig.desktop"

Unity pulls the icon and file from the desktop entry in /usr/share/applications/. This is the code that performs the addittion:

gsettings set com.canonical.Unity.Launcher favorites "$(gsettings get com.canonical.Unity.Launcher favorites | sed "s/, *'RetroRig.desktop' *//g" | sed "s/'RetroRig.desktop' *, *//g" | sed -e "s/]$/, 'RetroRig.desktop']/")"

Maybe we need to adjust that? It works just fine for me, but maybe we need a variable set for international languages.

And we got to suppress all these huge amount of text output, when RetroRig is changing the permissions. In gnome-terminal this is pretty fast, but still quite useless. When running the sript in a real TTY, it's much slower and just shows flickering character salad.

done - added small message only if it takes long, they will see a notice rather than a wall of text
I will direct stdout/stderr to /dev/null and get rid of that. I'll put a generic message at the top so users know that permissions are being corrected in case there are many files.

@mdeguzis
Copy link
Owner Author

mdeguzis commented Jul 7, 2014

JC, now I know what you mean:

The XBMC icon is still broken when it shows up in the launch bar. Hovering the mouse over it reveals "XBMC media center".

I can see this when running in windowed mode. The user won't see that "new" icon that is blank and still says XBMC Media Center. I'll tray and track down where that comes from if you don't get it first.

BTW, RCB is broken using the .retrorig dot file. Might just have to make some adjustments in the addon's xml.

@mdeguzis
Copy link
Owner Author

mdeguzis commented Jul 8, 2014

dotfile issue rectified, this is now in beta and functioning. The only problem JC, is disconnecting and reconnecting the controller. I'll have to look at that more.

@beaumanvienna
Copy link
Contributor

Should be fixed with updating the kernel to 3.14, right?

@mdeguzis
Copy link
Owner Author

Yes, you get the kernel module working fine, but if you disconnect and reconnect the controller, the kernel module seems to load alongside xboxdrv and take over. I still have to test this once I fix RCB tonight, but maybe there is something we can do. I don't know much about modifying kernel modules though. I will also check on the bug report filed for this for any patch files. It's possible that one was, or can be released, negating the need for the kernel upgrade we do.

@mdeguzis
Copy link
Owner Author

Merged into #70

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

No branches or pull requests

2 participants