PS3 gamepad with home button

Status
Not open for further replies.

squeeek

Well-known member
Hello!

I am (nearly) a new Teensy 3.1 / LC user. I have several projects in my sleeves, but the current one concerns a Playstation gamepad (including the special "home" button). I know it has already been done using a Teensy ++ 2.0, see here but I would like to do that using Teensyduino so I'll have a bit of work on that first.
For those who are interested but do not want to go into details yet, let's just say that a PS3 can read a standard USB gamepad fairly well, except for the "home" button, which needs some special data exchange to work properly. I guess that any other USB virtual device should be removed from the firmware too (i.e. mouse, keyboard, serial).

So, this is the first step : being able to create a 100% compatible PS3 gamepad that could be programmed with Teensyduino.

The next step is a bit harder, and I don't even know if it is possible or not, so maybe you can help me sort this out : what I would like is that, depending on the state of a digital input at startup, the Teensy behaves either as a PS3 gamepad (when plugged to a PS3), or as a gamepad+keyboard+mouse+serial (whenplugged to a PC).

The aim of my project is to have a reconfigurable arcade gamepad (I already have the hardware, I "just" need to change the board, and program it, of course, which is the main challenge) : several configurations can be stored in EEPROM (e.g. buttons 1-2-3-4 and 5-6-7-8 as gamepad, or 1-2-3-4 and then the same with autofire, or sending keyboard key presses or mouse moves instead when not in PS3 mode...). If you know X-Padder or joy2key, it's a bit the same, except it is embedded in the controller. I already started some of this with UnoJoy and LeoJoy, but I would prefer to switch to Teensy for several reasons (including keyboard type choice, and the extra CPU power and EEPROM of course).

Next step for me : wait for the Teensy LC to be available at Snootlab, and buy one along with a Teensy 3.1

So... ahem... any clue about :
1) where to start to get a "clean" PS3 gamepad available for use in Teensyduino? I would tend to try and modify the usb.c in the cores/usb_hid folder I guess.
2) if the USB behaviour depending on a digital input at startup is possible at all?

Thank you for your help!

Squeeek
 
Hi there!

Just a quick update :
- I received my Teensy 3.1 yesterday! Yay! :)
- I discussed with the guys at Snootlab, they will definitely sell the LC too, one day or another, they just need sore than 24 hours a day huhuhu... same as at PJRC I guess!

More to come within a few feeks (months? Yeah, I'd need more hours too) when I manage to get any further in this project!

Bye!

Squeeek
 
1) where to start to get a "clean" PS3 gamepad available for use in Teensyduino?

Start in usb_desc.h. Use the latest 1.21 beta. The code was reworked after 1.20 to make this much easier.

You'll find comments in usb_desc.h explaining how to customize.

If you run into trouble or get stuck, please make sure you post the complete file you've edited (the "forum rule"). Imprecise descriptions are useless when it comes to USB details. Click "Go Advanced" and there's an option to attach files. Or put it inside the "code" tags in your message.
 
Hi there !

I am digging a bit in my old projects now that I have a bit of time... One of my concerns with the USB part is that I may need to have a pure gaming device (for full PS3 compatibility) : no keyboard , mouse or serial, but I am unsure about what happens to the Teensy reprogramming part. If I only keep the game pad part, will I still be able to reprogram the Teensy (probably a LC) when pressing the button (I suppose the auto reboot function will be lost anyway but this is no issue for me) ?

Thanks for your advice !

Squeeek
 
You probably don't need to touch the Teensy programing interface, nor it's virtual serial port unless the PS3 really is fussy about the USB, but would have expected the design to allow for hubs with multiple devices + controller so expect it'll just ignore anything it doesn't understand and move on with life. And in the process make programming the thing a lot easier. One thing you may have to watch for is that there must be a way for the multiple gamepad type devices to be uniquely identified, unsure if they serial number the controllers, or get clever tracking which port has which controller on it.
 
Hi GremlinWrangler,

Thanks for your answer, but unfortunately I did not mention the "pure gaming device" at random. Mostly it would work using a normal Teensy Joystick I suppose (still have to test what would work exactly though), but the "PS" button will not work without some specific changes such as the "magic bytes" mentionned in this project for example ; I cannot find the source anymore but I have read that the PS3 is quite strict with what is acceptable to have the PS button working.

But then, I suppose you are right : at least at the beginning, I can go with a full featured joystick + everything and see how the rest bahaves (and add the PS button support later). One step at a time... Thanks for tempering my excitation on this optional feature :)
 
It's more a case that the PS3 probably won't care what non game controller devices are plugged in (Serial Debug etc) but may be more picky about what tries to call itself 'PS3 controller' vs 'generic controller'. So you may find the easiest option is actually to fake a standard four axis joystick first and then add a second 'device' that only does the magic button from within the Teensy code (akin to the keyboard+mouse pre built option that pretends to be two independent devices). So the PS3 thinks it has two devices on a hub, but you physically have them both in your hand. Depends a great deal on just what it takes to get that button working, and the least painful way to integrate it all.
 
Thanks for the precisions, this will probably prove helpful at some point.
I did some preliminary tests on SF4 and it will probably be usable with the standard Teensy serial + mouse + keyboard + joystick mode \o/
(I do not actually need the PS button for now, I might add it later on for a clean app though)
 
Status
Not open for further replies.
Back
Top