Page 2 of 2
Re: atmega8+V-USB to emulate PS3 joypad
Posted: Thu Feb 10, 2011 4:28 pm
by ulao
For the most part you have it right. M experience is limited to the Xbox. Now Xbox, as you know was made be non other then... the Us hidden branch of the government ( insert witty name here ) AKA microsoft. Now, m$, them peoples are no dummies, and will always try to stop people like you and I from messing with there stuff. On the Xbox they used a usb host ( modified ) to work with the peripherals. And they made it so it must be a hi speed device ( completely not needed ). IMO, the aim was intentional. On the 360, they gave us a 1UP, no one has figure out how to make a gamepad work on the 360 without a 360 pad present.
So pd3, well I will admit I dont know much about it, but I'm 99% sure you dont need to do this. If I had one of those things, I would defiantly mess with it, I have seen projects use there low speed devices on there with all the analog working. I think its juts a matter if the device descriptor.
Here is a normal 1.0 use device descriptor
Code: Select all
0x81, // bulk IN endpoint number 1
0x03, /* attrib: Interrupt endpoint */
8, 0, /* maximum packet size */
0x04, /* in ms */
Now you can change the packet size to a non 1,0 spec and still be ok.
32, 0, // maximum packet size 32
Now here is toodles's source for ps3
Code: Select all
0x07, //size of desc in bytes
ENDPOINT, //type od desc
0x81, //endpoint address EP1 IN
0x03, //transfer style: interrupt
0x40, 0x00, //max packet size : 64 bytes
0x0A, //interval: 10ms
But in his case I think his version of usb can support 2.0 he does not use v-usb.
Re: atmega8+V-USB to emulate PS3 joypad
Posted: Thu Feb 10, 2011 11:24 pm
by CRP
Wow, that was it!! I just modified the descriptor from size 16 to size 19, then the rest of the code accordingly and now everything works perfectly even with full descriptor.
So the bottom line is that it is fully possible to build PS3 USB controllers with v-usb on an atmega8

Thanks very much for your precious input!!
PS: my source code is available on request if anyone needs to give it a look, maybe I will put it on some site sooner or later
Re: atmega8+V-USB to emulate PS3 joypad
Posted: Fri Feb 11, 2011 2:51 am
by ulao
huh, guess I have to pat myself on the back for that one, that was all conjecture. Glad it worked my friend. Now I need to figure out how to know if I'm connected to a ps3 or pc...
So ps Home was just button bit 13? No extra byre needed? Or only works if you have the maximum packet set to 32(0x20) or 64(0x40)
Re: atmega8+V-USB to emulate PS3 joypad
Posted: Fri Feb 11, 2011 10:53 am
by CRP
PS is button 13, but there are also a few bytes (0x21, 0x26,...) that are to be sent to the PS3 right after the hid report. This is done on v-usb in the usbFunctionSetup function.
If you look at the full HID report descriptor for the Sixaxis there is a whole section at the end which is FEATURE and OUTPUT, so maybe there something can be determined about the host. No way to be sure without a USB sniffer, though.
This guy appears to have looked a bit deeper into how the HID is structured, although there is lots of mysterious stuff in there:
http://kerneltrap.org/mailarchive/linux-usb/2009/1/4/4593554Also, have a look at these pages:
http://diy-machine.blogspot.com/http://code.google.com/p/diyps3controller/Cheers
Chris
Re: atmega8+V-USB to emulate PS3 joypad
Posted: Thu Dec 22, 2011 6:54 pm
by bht67
Chris,
Could you please post your source code?
Thank you.
Re: atmega8+V-USB to emulate PS3 joypad
Posted: Mon Jan 09, 2012 12:33 pm
by bootsector
bht67 wrote:Chris,
Could you please post your source code?
Thank you.
Hi!
You may want to check this opensource/openhardware project out:
https://gitorious.org/usb-retropad-adapterIt's based on V-USB and it supports PS3's PS button!
bootsector
Re: atmega8+V-USB to emulate PS3 joypad
Posted: Wed Jul 05, 2017 10:22 am
by jess10
CRP wrote:Hi, I am currently trying to build a PS2 to USB adapter in order to use PS2 controllers on a PS3. One special feature of PS3 controllers is the "PS" button, which is missing on ordinary
PS3 console. On a PC, it appears that pressing the PS button of a PS3 controller connected via USB corresponds to button 13, but this does not work when implemented on the atmega8.
I found the following information on the internet:
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.
and then:
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.
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.
Unfortunately I was unable to contact the original poster, so I was wondering if someone can help me in figuring out what the above means, and how I can replicate what he has done in my project.
Thanks
Christian
Hello
Is it possible to emulate PS3 Joypad with the help of atmega USB????
Re: atmega8+V-USB to emulate PS3 joypad
Posted: Fri Jul 14, 2017 5:50 pm
by ulao
Yes, I'm doing it.
Re: atmega8+V-USB to emulate PS3 joypad
Posted: Wed Jul 26, 2017 1:15 am
by tiagotauruz
Hi everyone could you solve the ps home button problem could you post the solution to this problem? thank you.

Re: atmega8+V-USB to emulate PS3 joypad
Posted: Wed Jul 26, 2017 4:11 pm
by ulao
There is no simple solution just a lot of gotchas. Most of what you need is in this post.
4 main things need to happen.
1) usb descriptor must have buttons on first 3 reports.
2) third report is home button reportBuffer [ thirdrow ]=0b00010000;
3) you must reply to the controller request in the usbsetup. 0x3000 (0x3001 if you have a report ID)
with these bytes
static uint8_t PROGMEM magic_init_bytes[] = {
0x21, 0x26, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00
};
4) you need the vendor specific, or at least 1 usage for the bytes to work.
example
0x06, 0x00, 0xff, // USAGE_PAGE (Vendor Specific)
0x09, 0x20, // Unknown
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x01, // REPORT_COUNT (1)
Show any code you have troubles with and I can point you in the right direction.
Re: atmega8+V-USB to emulate PS3 joypad
Posted: Fri Jul 28, 2017 6:13 am
by tiagotauruz
I understand thanks for the help, I'm new to v-usb, it's a bit complicated for me. I have this code, could you tell me where I should add these tips in the program, thank you.
code link :
https://pastebin.com/ckXZwqAy
Re: atmega8+V-USB to emulate PS3 joypad
Posted: Fri Jul 28, 2017 2:15 pm
by ulao
You need to included the usb descriptor. I think raph puts its in devdesc or gampad h files.
You also have not added the code in the usbFunctionSetup?
Did you change anything? I can;t write the code for you but if you take a shot at it I will help.
Re: atmega8+V-USB to emulate PS3 joypad
Posted: Tue Aug 01, 2017 8:20 am
by tiagotauruz
How reportBuffer works to specify this value of 0b00010000.
Re: atmega8+V-USB to emulate PS3 joypad
Posted: Tue Aug 01, 2017 1:43 pm
by ulao
As stated on the previous page
reportBuffer [ 3rdrow ]=0b00010000;//ps home pressed. ( or 0b00000000 ) not pressed
I dont have your descriptor but whatever your third row is button is. It's just the last button in the packet. This only works if the conditions are met as I listed above.
buttons are composed of 3 rows.
00000000 () [] X /\ ....
00000000 START SELECT .....
00000000 ? ? l3 r3 pshome
I don't memorize the exact order off hand but this is something you should already know. ps home is last.