diff --git a/headers/drivers/ps3/PS3Descriptors.h b/headers/drivers/ps3/PS3Descriptors.h index 884557b8a..e5ed56058 100644 --- a/headers/drivers/ps3/PS3Descriptors.h +++ b/headers/drivers/ps3/PS3Descriptors.h @@ -72,7 +72,7 @@ typedef enum { PS3_FEATURE_01 = 0x01, PS3_FEATURE_EF = 0xEF, - PS3_FEATURE_F2 = 0xF2, + PS3_GET_PAIRING_INFO = 0xF2, PS3_FEATURE_F4 = 0xF4, PS3_FEATURE_F5 = 0xF5, PS3_FEATURE_F7 = 0xF7, diff --git a/headers/drivers/ps3/PS3Driver.h b/headers/drivers/ps3/PS3Driver.h index 495d3f96a..15f9c7338 100644 --- a/headers/drivers/ps3/PS3Driver.h +++ b/headers/drivers/ps3/PS3Driver.h @@ -29,6 +29,9 @@ class PS3Driver : public GPDriver { uint8_t last_report[CFG_TUD_ENDPOINT0_SIZE] = { }; PS3Report ps3Report; PS3Features ps3Features; + + // this is an identification byte from the H2D 0xEF feature report that needs to be the same + // in multiple D2H reports for the controller to function uint8_t efByte; }; diff --git a/src/drivers/ps3/PS3Driver.cpp b/src/drivers/ps3/PS3Driver.cpp index c7aedeb95..cd251dae0 100644 --- a/src/drivers/ps3/PS3Driver.cpp +++ b/src/drivers/ps3/PS3Driver.cpp @@ -9,8 +9,6 @@ #include "storagemanager.h" void PS3Driver::initialize() { - //stdio_init_all(); - ps3Report = { .reportID = 1, .reserved = 0, @@ -155,14 +153,14 @@ static constexpr uint8_t output_ps3_0xef[] = { // bluetooth data static constexpr uint8_t output_ps3_0xf2[] = { 0xff, 0xff, - 0x00, 0xac, 0x7a, 0x4d, 0x2c, 0x6d, 0x7a, // device address - 0x00, 0x03, 0x55, 0x03, 0xc3, 0x01, 0x8a, // host address + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // device address + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // host address 0x00, }; // unknown static constexpr uint8_t output_ps3_0xf5[] = { - 0x00, 0x44, 0xd8, 0x32, 0x53, 0x87, 0xc2, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -198,9 +196,6 @@ static constexpr uint8_t output_ps3_0xf8[] = { // tud_hid_get_report_cb uint16_t PS3Driver::get_report(uint8_t report_id, hid_report_type_t report_type, uint8_t *buffer, uint16_t reqlen) { - //uint32_t now = to_ms_since_boot(get_absolute_time()); - //printf("[%d] PS3Driver::get_report RPT: %02x, Type: %02x, Size: %d\n", now, report_id, report_type, reqlen); - if ( report_type == HID_REPORT_TYPE_INPUT ) { memcpy(buffer, &ps3Report, sizeof(PS3Report)); return sizeof(PS3Report); @@ -216,7 +211,7 @@ uint16_t PS3Driver::get_report(uint8_t report_id, hid_report_type_t report_type, memcpy(buffer, output_ps3_0xef, responseLen); buffer[6] = efByte; return responseLen; - case PS3ReportTypes::PS3_FEATURE_F2: + case PS3ReportTypes::PS3_GET_PAIRING_INFO: responseLen = reqlen; memcpy(buffer, output_ps3_0xf2, responseLen); return responseLen; @@ -238,15 +233,7 @@ uint16_t PS3Driver::get_report(uint8_t report_id, hid_report_type_t report_type, return -1; } -// Only PS4 does anything with set report void PS3Driver::set_report(uint8_t report_id, hid_report_type_t report_type, uint8_t const *buffer, uint16_t bufsize) { -// uint32_t now = to_ms_since_boot(get_absolute_time()); -// printf("[%d] PS3Driver::set_report RPT: %02x, Type: %02x, Size: %d\n", now, report_id, report_type, bufsize); -// for (uint8_t i = 0; i < bufsize; i++) { -// printf("%02x ", buffer[i]); -// } -// printf("\n"); - if ( report_type == HID_REPORT_TYPE_FEATURE ) { switch(report_id) { case PS3ReportTypes::PS3_FEATURE_EF: