PS3 Gamepad With Home Button

Posted by jiGGaK on May 25th, 2010
Teensy++ on a breakout board

It’s no secret the PS3 will work with most USB HID gamepads or joysticks. However the Home button is something special. If you connect your sixaxis controller to your PC and monitor button presses, the Home button comes up as button number 13. If you then create a standard gamepad with the same button mapping, the PS3 will refuse to recognize the Home button.

After some tracing of the USB traffic from an official Madcatz Street Fighter IV FightStick I was able to come up with a solution! There are 8 bytes transfered during the enumeration phase, just after the device sends it’s report descriptor. Mimicking the same exchange results in the Home button functioning correctly when button 13 is pressed.

I used the amazingly awesome Teensy++ development board after being inspired by this guys work. I also used the report descriptor from Toodles UPCB project which appears to come from the SEGA VIRTUA STICK. This descriptor is very similar to the one from the Madcatz controller, except their is one endpoint instead of two which simplifies things somewhat.

I also created a shield (pictured above) which brings several pins on the Teensy to convenient screw terminals.

Source code and Eagle files are available in a git repository. Code is licensed under the GPL v3 and the PCB design is distributed under a Creative Commons license Attribution-ShareAlike 2.5.

Terminal reference

This document can be printed onto transparency for exposing your pre-sensitized copper clad. To use this for toner transfer, be sure to mirror the image first.

And a compiled version of the code in ihex. This is for the teensy++ 2.0. The code might work with other versions of the teensy, but a re-compile will be required.



Fons December 8th, 2011

I get work the PS button in a PIC18F2550, and I don’t use the magic bytes, only de same descriptor… Ivan, your .hex can work with the Mjoy16 project and has analog inputs for pots?

I’m working with the analog axys to build my own stick.

Ivan December 6th, 2011

I get work the PS button in a PIC18F2550, and I don’t use the magic bytes, only de same descriptor…

Ivan November 27th, 2011

Hi, what endpoint send the magic bytes?, i send final the endpoint 0 in pic18f2550 and don’t work…

John September 30th, 2011

I used your sourcecode as a base for my SNES project. Thanks for sharing! I posted an instructable at: http://www.instructables.com/id/SNES-Teensy-USBPS3-Gamepad/

jiGGaK February 19th, 2011

I don’t see why not. Have a look at the gamepad_state_t struct in usb_gamepad.h. The various inputs are labeled well and describe what values need to be sent for analog inputs.

Lyn February 19th, 2011

Hi, Can the analog inputs be added to this?

CRP January 28th, 2011

Hi, just wanted to let you know that I made some progress and found out what Ricky has done. Please have a look at this post if you want to use those atmega8’s:

http://www.wipeoutzone.com/forum/showpost.php?p=192480&postcount=178

jiGGaK January 28th, 2011

Not sure what Ricky was talking about, but regarding the analog triggers if you look at my source code the report descriptor includes all the axis definitions. The gamepad_state_t struct has the R2/L2 values as the last two bytes. 0x00 is fully depressed and 0xff is fully pressed.

CRP January 27th, 2011

Hi, I started working on a PS2 to PS3 adapter based on this project: http://element42.org/PS3negcon/

I got it working, but am stuck at two issues:

  1. the damn PS button: does anyone know what Ricky above means by “you can stack the interrupt end point to send 19 bytes at once”?
  2. trigger buttons: I would like to use the analog buttons on the NegCon to send analog trigger (L2 and R4 on the sixaxis) to the PS3, but I do not know how to set up the reportDescriptor. All examples I have seen treat those as digital buttons…

MaDMaLKaV January 25th, 2011

I was looking into doing this very same thing with an Arduino Uno as a learning project. Thanks for the info!

David January 14th, 2011

Hi jiGGaK,

Thanks for your reply. Aw that’s not good if Ricky do not respond your emails.. I don’t know what more to do to get PS button working.

By the way, maybe you can hel me with another problem. I can’t able to run my board with GT5, it works on menu, but when I try to play, only works “start” button. I tried to put same VID and PID as Sony and Logitech.. but nothing. Any idea? It works with other games, only I have problems in gran turismo.

Thanks! David.

jiGGaK January 3rd, 2011

David,

I wasn’t able to get the PS button to work using the v-usb library. Ricky apparently had better luck but he didn’t respond to my emails regarding sharing his solution.

David January 3rd, 2011

Hey guys, I was trying to get running the PS button on my 18F4550, using 8 bytes report, but I’m not able to get it working, so.. can anybody help me?

Thanks in advance!

David.

jiGGaK November 2nd, 2010

Ignore my question about the at90usb162 target. I see now that it is binary compatible with the atmega8u2.

jiGGaK November 2nd, 2010

Sorry, I don’t have any tips for what could be wrong there. It seems strange that you use at90usb162 as the MCU target for the the UNO’s atmega8u2. Are you certain that’s the right target?

ant.b November 2nd, 2010

Hi jiGGaK, I’m trying to compile your code on a atmega8u2 on a arduino uno. I use at90usb162 code. It seems to enumerate properly and i can see the gamepad on my computer but i can’t send data. The problem is on usb_gamepad_send(void): the if statement (UEINTX & (1<<RWAL)) never come true and there is a timeout. Do you know what can I check to find the error? Thanks for your help.

jiGGaK June 9th, 2010

Ricky,

That is awesome! Any chance you could share your code? I have a few atmega 8 based boards I’d love to get working with the PS3.

If you want I have a forum where you could post. Or send me over the code and I’ll do a write up (giving you full cred of course).

Ricky June 9th, 2010

wow! I was testing my code with the V-USB using an atmega88. I was able to use the Home button using your magic bytes! turns out you can stack the interrupt end point to send 19 bytes at once. Good job on your find man! appreciate it!

Ricky June 9th, 2010

Thanks for your reply! I think the only problem with the V-USB is that the interrupt pipe can only send out 8 bytes of data at once for low speed device while the full speed device can send more data. For this device, it’s over 8 bytes for sure. I will go try to make work on my At90usb1287 since I got one laying around. haha

jiGGaK June 9th, 2010

Ricky,

I actually didn’t do anything special to trigger the host to ask for the hid report. The request just seems to come in automatically on endpoint 0.

I don’t have any saved captures but if you think it will help I’m sure I could get one for you.

A while back I tried to get the PS button working using the V-USB library on an atmega-8 but came to the conclusion that it was not possible. V-USB can support low-speed devices only and I think full-speed is required to make it work (I forget why I came to this conclusion).

Ricky June 9th, 2010

Interesting, I was wondering how did you trigger the host to get HID_GET_REPORT for the magic 8 bytes? Do you use the interrupt pipe? or the default end point? Basically I should send these 8 bytes right after the HID report? Do you have a USB capture showing these magic bytes being sent? I am implementing it on a V-USB firmware. The PS home button is not really working at the moment! :( Thanks for your help!

Ricky