PaulStoffregen / USBHost_t36

USB Host Library for Teensy 3.6 and 4.0
165 stars 85 forks source link

Bluetooth PS4 sketch and supporting some clones #70

Closed KurtE closed 3 years ago

KurtE commented 3 years ago

With previous verison was able to get the Sony PS4 to work but not most of the clones including one by Voyee.

Found that if I disabled some code that was put in for PS4 to force our code to initiate the bind operation. Then the voyee worked... Found later that in the USB Host Shield 2 that they detected the underlying class number and only if 0x2508 did it initiate the bind... voyee is 0x508. So both now appear to want to bind.

Changed the JoystickBT sketch to allow you to hit enter in debug window and switch PS4 from long view to short view of data

Also found information on PS4 binding and some Python code that allowed PS4s to bind without having to do it through BT. So added code like we have for PS3 that allows you to first have the BT dongle in, then plus in PS4, and then hold either L1 or R1 and hit the Share button and it will try to update the PS4 with the pairing information for your BT dongle.

During this found I was displaying the BDADDR byte wise backwards so updated this sketch.

Paul - @mjs513 and myself are still working on some additional controllers that use SDP binding support. But thought would issue PR for this now in case anyone wishes to play with this updated support

KurtE commented 3 years ago

@PaulStoffregen @mjs513 @defragster -

Paul if you are going to do a beta release at some point soon, it might be fun to integrate some of the current PRs... Example this one has a couple of fun things:

a) Works on a few more of the PS4 clones like the Voyee I have but not the one Mike has ;) b) The JoystickBT sketch for PS4, allows you to enter something by Serial port to switch PS4 outputs from really verbose to more constrained and only when something changes. c) Added some Pairing code that allows the user to Pair a PS4 without having to recompile to turn on pairing mode and then recompile it again without it. With this you have to plug in the BT dongle such that we can get it's address. And then plug in the Joystick and hold either L1 or R1 and hit the PS key. It then uses some of the stuff found that allows us to program. The code already does similar for PS3. Actually about the only way to make a PS3 work. d) minor found we were displaying the BDADDR byte wise reversed.

But what I am wondering is, this added a couple of member methods to the Joystick class, to be able to query and set the the BDADDR. So wondering if should add a #define or the like as part of the Joystick class that says something like: SUPPORTS_PS4_PAIRING That code can check before it includes calls that are not defined in previous versions.

Wondering can you do this as part of an enum of a class and use

if defined(JoystickController::SUPPORTS_PS4_PAIRING)

Or does that only work for defines... And/Or should we introduce something like namespaces or just give long unique option names?

Thanks Kurt

PaulStoffregen commented 3 years ago

Merging this now (without review), so it'll get into 1.55-beta1. Hopefully that's ok?