BlueRetro
BlueRetro copied to clipboard
Shanwan PANHAI PS3 clone dont answer L2CAP conf
Made a trace on the UART line inside the controller, it doesn't RX the frame I send!
ESP32 BT controller issue?
It's been a while, but I looked into this one more.
I get the same issue using the ESP32 with BlueZ. This competely remove BlueRetro from the equation. Opened a bug with espressif: https://github.com/espressif/esp-idf/issues/15133
Small recap of what happen with https://github.com/espressif/esp-idf/issues/15133
It was confirmed that the issue with Shanwan controller is specifc to the ESP32 BT controller/radio.
One of the provided debug build of libbtdm_app.a provided in this post does allow the Shanwan controller to connect and work.
Unfortunately the code upstreamed does not include that exact fix and as such do not fix the issue. There was some back & forth but none of the new build worked so I pretty much gave up.
I analyzed with ghidra & ghidriff the working lib and the change that made it work is located in the lc.o object. prefix_lc.o-fix_lc.o.ghidriff.md
A slightly modified version of the ROM function r_lc_con_cmp was added in lc.o and was set to replace the rom function in the bt lib.
The change was to remove the last line of the rom function:
(**(code **)(*piVar1 + 200))(0x517,param_1,param_1);
I extracted the lc.o file from the debug lib and integrated it in the btlib from november 2024 currently used by BlueRetro
ar x libbtdm_app_debug.a
ar r libbtdm_app.a lc.o
See: https://github.com/darthcloud/shanwan_esp32-bt-lib https://github.com/darthcloud/shanwan_esp-idf
Here builds of v25.04 with that patched lib:
v25.04-1-g83afb3b_hw2.zip v25.04-1-g83afb3b_hw1.zip v25.04-1-g83afb3b_dbg.zip
I won't be able to make build like this in the future since I likely won't be able to patch newer version of the bt lib as BlueRetro update to newer esp-idf.
The fix is simple enough, someone more skilled could probably pull it off tho.