xelprep / Arduino

My simple Arduino projects
0 stars 0 forks source link

ESP32 Keyboard on PS5 #1

Open fstof opened 4 days ago

fstof commented 4 days ago

I have no idea if you @xelprep are the same person as in this post https://forum.arduino.cc/t/esp32-as-bluetooth-keyboard-question/1250346

So I'm taking a huge chance and asking if you by any chance got the ESP32 bluetooth keyboard working on a PS5.

Sorry for this weird "issue" but yea, just taking a chance here

xelprep commented 3 days ago

Yeah that was me. I did quite a bit of research including buying and returning a PS5 just for input testing. My research resulted in the confirmation that at the time I was working on this (not sure if this has changed recently but I doubt it) the PS5 will only use BLE (4+) pairing for official Sony peripherals, possibly also 3rd party controllers, but not HID keyboards or mice. The BLE logs on my custom BLE HID devices would show the PS5 pairing with the device, interrogating it for capabilities, then abruptly disconnecting and showing an error on the TV screen. I initially thought this was due to my use of "just works" security. Unfortunately this was the same behavior regardless of what BLE security method I had configured or BLE library I utilized.

I did however confirm that PS5 will pair with classic (BT 3 or lower) BT HID input devices. While a lot of ESP32 devices support Bluetooth Classic and LE, very few libraries will utilize a classic BT stack on ESP32. I did end up getting a proof of concept custom Classic BT ESP32 keyboard to pair successfully and function properly with a PS5 using this library and tweaking the example here: https://bluekitchen-gmbh.com/btstack/#examples/examples/index.html#sec:hidkeyboarddemoExample. Also, regarding BT security, it seems the PS5 doesn't care if you utilize a passcode on your classic HID device but it does work if you want to use a passcode.

It wasn't nearly as simple as using Arduino as I had to set up and learn how to use ESP-IDF for the first time. Hopefully this is enough to point you in the right direction. If you're new to ESP-IDF and coming from Arduino like me, I'd recommend using VSCode with the ESP-IDF plugin. You can also import Arduino as a component and with a little research you can modify Arduino libraries to work within ESP-IDF but it is definitely a steep learning curve. If I can do it, anyone can do it.

fstof commented 3 days ago

Thank you so much for the info I have also not worked with ESP-IDF before... lets see how this pans out.

I'll keep you posted Thanks

*EDIT I got that example built and flashed fine, and it works on PC however when PS5 tries to connect the esp crashes and just reboots, with the PS5 complaining about the normal passkey error and whatnot.

So not really sure where to from here