felis / USB_Host_Shield_2.0

Revision 2.0 of USB Host Library for Arduino.
https://chome.nerpa.tech
1.79k stars 780 forks source link

Support for Playstation Buzz! controller #71

Closed dburongarcia closed 9 years ago

dburongarcia commented 10 years ago

Hi, I wonder if it would be possible to add support to Playstation Buzz! controller: http://en.wikipedia.org/wiki/Buzz! Those controllers are really cheap and let you have 4 gigantic buttons and 16 relatively big buttons. Great for custom setup in an easy and fast way, and perfect for disabled.

Does anyone know how it could be done? I managed to get them work in my PC but I'm a bit lost to manage it with an Arduino. Thanks a lot

xxxajk commented 10 years ago

What does the usb HID demo say about it? Also... Get us a trace via wireshark, so we can look at it and give you hints.

dburongarcia commented 10 years ago

Hi, thanks for answering. I have never used Wireshark, I will check it how to use it for that. Do you have any other tips besides this: http://wiki.wireshark.org/CaptureSetup/USB ? Could you tell me what kind of trace do you need to make it useful for you?

By the way, I just have wired Buzz!s but there are also wireless ones relatively cheap that maybe would be helpful for some people. Having 4 sets of 5 buttons wireless sounds cool.

xxxajk commented 10 years ago

Read up on wireshark and get me the trace. I can determine from it how it is set up from your OS as hints. That is how I fixed the ones that I have... basically almost by replaying what the PC pukes out. If you have Linux, this is even better, however it SHOULD work on windows too.

xxxajk commented 10 years ago

The only other tip is use Linux for the trace if you can, since the resulting trace I can follow better and compare with the code in the Linux kernel.

On Sun, Jan 19, 2014 at 4:30 PM, dburongarcia notifications@github.comwrote:

Hi, thanks for answering. I have never used Wireshark, I will check it how to use it for that. Do you have any other tips besides this: http://wiki.wireshark.org/CaptureSetup/USB ? Could you tell me what kind of trace do you need to make it useful for you?

By the way, I just have wired Buzz!s but there are also wireless ones relatively cheap that maybe would be helpful for some people. Having 4 sets of 5 buttons wireless sounds cool.

— Reply to this email directly or view it on GitHubhttps://github.com/felis/USB_Host_Shield_2.0/issues/71#issuecomment-32720507 .

Visit my github for awesome Arduino code @ https://github.com/xxxajk

Lauszus commented 10 years ago

@dburongarcia have you tried it with the following examples: https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/HID/USBHID_desc/USBHID_desc.ino and https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/HID/USBHIDJoystick/USBHIDJoystick.ino.

If you are lucky, then it is just a regular HID device and it should be very easy to modify the code for your needs.

dburongarcia commented 10 years ago

Hi, thanks for the replies, right now it's nearly 1am here so I will get the trace on Windows and Ubuntu (I'm not sure if it will work on Linux, haven't tested) tomorrow.

By the way, I'm sure this can help: http://www.developerfusion.com/article/84338/making-usb-c-friendly/ I'm sure the wired ones are regular HID devices, but maybe the wireless ones not so.

Lauszus commented 10 years ago

Okay. There is no reason to send the Wireshark output, as all the information is available on the link you just sent. Simply just modify this example: https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/HID/USBHIDJoystick/USBHIDJoystick.ino for your needs.

First of all enable serial debugging: https://github.com/felis/USB_Host_Shield_2.0#enable-debugging and after that upload the code to your Arduino. It will then start printing out data whenever you press a button - see: https://github.com/felis/USB_Host_Shield_2.0/blob/master/hiduniversal.cpp#L385-L390.

Basically you should just make a class that inherits the HIDReportParser class like so: https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/HID/USBHIDJoystick/hidjoystickrptparser.h#L20 and then it will automatically parse all the data to that class. Then simply modify the parser for your needs.

Once you have done that, I will help you setting the LEDs ;)

Lauszus commented 10 years ago

@dburongarcia here is also the Linux driver for Sony HID devices: https://github.com/torvalds/linux/blob/master/drivers/hid/hid-sony.c including the source for the Buzz controller.

dburongarcia commented 10 years ago

That's great! I'm right now doing some testing and following your tips. I'll let you know what I find. Thanks

dburongarcia commented 10 years ago

Hi, I tried to get some data, but it seems that maybe the controller needs a bit more power, or maybe I did something wrong. I tried uploading directly the code of USBHIDJoystick.ino and then I created a new USBHIDBuzz.ino with a hidbuzzrptparser class removing the OnHatSwitch method and leaving just the parser, gamepadchange and buttons methods. But no messages at all :(

I don't have any extra power source right now, but I will try to plug a 9V battery to the Arduino to see if that's the problem. I'll be on the road the next days so I will continue when I come back and let you know how did it go. Thanks and if you have any more tips that would be great, I have very little experience with HID.

Lauszus commented 10 years ago

@dburongarcia did you ever get this working? If you did, then please close this issue :)

dburongarcia commented 10 years ago

Hi, sorry for the late reply, I want to use the Buzz! buzzers as a more simple alternative for buttons in this device I'm developing for people with cerebral palsy: http://www.youtube.com/watch?v=3UM5C7Ac-zs

I didn't manage to get any data from the Buzzers using the 9V battery, so I ordered a voltage regulator to try with different voltages. I was waiting for it to arrive so I didn't bother you with power problems and can let you know propertly if I got something working.

Right now I don't know if the lack of response from the buzzer is because I got confused with the way the debugger works or if it's a lack of power. Maybe there is a way to chek it? The regulator shopefully shold be here very soon.

Lauszus commented 10 years ago

@dburongarcia okay. If you can not get it working, just sent me a controller and I will add support for it ;)

Lauszus commented 10 years ago

I just saw your video. I will order a controller now and will let you know when I got it working!

dburongarcia commented 10 years ago

Hi Kristian, thanks! It can be found in Amazon really cheap, but even cheaper in videogame stores like Game or Gamestop. Just remember to get a used one and not a new one. The PS2 version is wired with USB and it can be found for 5 EURO, the PS3 is wireless with a USB dongle and it could cost 12-20 EURO. If you cannot find it let me know and I send you mine, although I think the shipping costs even more than it itself :P As you can see in the videos I'm using arcade buttons, but the idea is to make it as simpler as possible so anyone can use it without having to solder anything.

I've ordered also a USB hub with switches, so the gamepad and Buzz connect to the hub and it to the USB host. I wonder if both could be used at once and also if 2 sets of buttons could be used. Some Buzz! games allow 8 players with 2 sets at the same time, and being able to have 8 big buttons and 32 small ones would be great! Unfortunately the wireless Buzz needs 2 USB dongles, one for each set of 4 buttons (or at least that's what they say)

Btw, if you find a way to lit the LEDs that would be wonderful, it could be use to make games and training programs for disabled. Commercial systems are SO EXPENSIVE. I've seen 4-button boxes for disabled for 600 EURO!

I'll try to make it work next week, this one was the MWC and I had no time (I work as a techblogger too) Thanks again! :)

2014-03-01 3:49 GMT+01:00 Kristian Sloth Lauszus notifications@github.com:

I just saw your video. I will order a controller now and will let you know when I got it working!

Reply to this email directly or view it on GitHubhttps://github.com/felis/USB_Host_Shield_2.0/issues/71#issuecomment-36414018 .

Lauszus commented 10 years ago

@dburongarcia can you send me a link to the correct one, then I will order it :) I do not see any reason why multiple controller shouldn't be able to work at the same time. I should be possible to light the LED as well.

dburongarcia commented 10 years ago

Hi Kristian, sorry for the delay, I tried to make it work with the new power source but I got nothing :( I've been searching, but there is no Amazon, eBay or Game in Denmark :( I've found an auction in Spanish ebay http://www.ebay.com/itm/Pulsadores-Buzzers-para-juego-BUZZ-PS3-PS2-Playstation-En-muy-buen-estado-/171260466098?pt=ES_Videojuegos&hash=item27dfeb53b2and it would be 8-10 euros with shipping to Denmark. Let me know your address and I'll buy it for you. (send me a pm as soon as you can, the auction finish in 7 hours)

For trying the wireless or having more than 2 sets connected, If you have a local videogames store, ask for used Playstation 2 or Playstation 3 Buzz! controllers (PS2 are wired, PS3 are wireless, but be careful, sometimes they seld the game not the controller) They have used ones incredibly cheap. Thanks!

2014-03-01 17:00 GMT+01:00 Kristian Sloth Lauszus notifications@github.com :

@dburongarcia https://github.com/dburongarcia can you send me a link to the correct one, then I will order it :) I do not see any reason why multiple controller shouldn't be able to work at the same time. I should be possible to light the LED as well.

Reply to this email directly or view it on GitHubhttps://github.com/felis/USB_Host_Shield_2.0/issues/71#issuecomment-36428263 .

Lauszus commented 10 years ago

Hmm I guess the auction has finished now. Note that you will properly not be able to find it here in Denmark - it's just too small a country. Try the UK, US or just get it from China.

Btw I can not send you a PM via Github and you have not provided your email at your Github account. You can contact me via kristianl@tkjelectronics.dk.

Lauszus commented 10 years ago

I finally added support for the Buzz controllers: https://github.com/felis/USB_Host_Shield_2.0/commit/25117ab9260b64b1870c6982d73bc190e00b0313. @dburongarcia please take a look at the example: https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/PSBuzz/PSBuzz.ino and confirm this solves this issue and then close it afterwards.

Lauszus commented 10 years ago

@dburongarcia did you ever try the code? I will close this issue now, as I believe it is working.

dburongarcia commented 10 years ago

Hi, yes, I tried many days ago. I couldn't make it work. I sent you an email some weeks ago explaining the issue. Maybe you haven't received it or maybe I haven't received your reply. I thought you were on holiday so I haven't asked you again, sry. Anyway I include the email here


Hi, sorry I took a bit longer than I expected, someone else had the Buzz controller I was using for developing. I got it today and I couldn't make it work. I pressed all the buttons and got no response besides "PS Buzz Library Started". I tried various combinations of pressing the reset button and pluging/unplugin the Buzz controller to the USB host, and the only response I got was all the LEDs flashing very dim. What was your setting? I'm using a Leonardo plugged to a USB 3.0 with no extra power source. Any tips? Thanks

Lauszus commented 10 years ago

Okay. Yeah that is right - I totally forgot!

Can you try to enable serial debugging: https://github.com/felis/USB_Host_Shield_2.0#enable-debugging and then post the output when you plug it in?

dburongarcia commented 10 years ago

I'll try that this aftenoon after work and let you know here, maybe someone else had the same issue. Thanks :)

Lauszus commented 9 years ago

@dburongarcia did you ever get around to try this?

dburongarcia commented 9 years ago

Hi, I already solved it a long time ago. I'm surprised that no reply appeared here. I'm starting to think that using Boomerang for gmail is not a good idea and that's the reason of all these communication problems. I'm gonna uninstall it ASAP :(

Anyway, as I said, it's solved, the problem was the energy source. The Buzz seems to require far more than the USB input in Arduino is capable of. I plugged in a 12V-4A stable source and now is working great with my own example code. Thanks for your work man, and sorry for the inconvenience of the messages, I should just use the Github site directly for messaging.

Lauszus commented 9 years ago

No problem! Good to hear that it's working. For some reason I did not have any problems at all. I powered everything from my computer's USB port. I will close this issue now then ;)