diff --git a/src/xrt/drivers/psvr/psvr_device.c b/src/xrt/drivers/psvr/psvr_device.c index 23be2dd7c..b33c3dc9b 100644 --- a/src/xrt/drivers/psvr/psvr_device.c +++ b/src/xrt/drivers/psvr/psvr_device.c @@ -482,6 +482,31 @@ handle_calibration_msg(struct psvr_device *psvr, psvr->calibration.last_packet = which; } +static void +handle_control_0x82(struct psvr_device *psvr, unsigned char *buffer, int size) +{ + if (size < 4) { + return; + } + + if (size < (int)sizeof(float) * 6) { + PSVR_DEBUG(psvr, "%02x %02x %02x %02x", buffer[0], buffer[1], + buffer[2], buffer[3]); + } + + float *f = (float *)buffer; + int *i = (int *)buffer; + + PSVR_DEBUG(psvr, + "%02x %02x %02x %02x\n" + "%+f %+f %+f %+f %+f\n" + "0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n" + "% 10i % 10i % 10i % 10i % 10i", + buffer[0], buffer[1], buffer[2], buffer[3], f[1], f[2], f[3], + f[4], f[5], i[1], i[2], i[3], i[4], i[5], i[1], i[2], i[3], + i[4], i[5]); +} + static void handle_control_0xA0(struct psvr_device *psvr, unsigned char *buffer, int size) { @@ -533,10 +558,12 @@ read_control_packets(struct psvr_device *psvr) handle_device_name_msg(psvr, buffer, size); } else if (buffer[0] == PSVR_PKG_CALIBRATION) { handle_calibration_msg(psvr, buffer, size); + } else if (buffer[0] == PSVR_PKG_0x82) { + handle_control_0x82(psvr, buffer, size); } else if (buffer[0] == PSVR_PKG_0xA0) { handle_control_0xA0(psvr, buffer, size); } else { - PSVR_DEBUG(psvr, "Got report, 0x%02x", buffer[0]); + PSVR_ERROR(psvr, "Got report, 0x%02x", buffer[0]); } } while (true); @@ -557,6 +584,12 @@ read_calibration_data(struct psvr_device *psvr) return ret; } + // Request unknown data 0x82. + ret = send_request_data(psvr, PSVR_GET_DATA_ID_0x82, 0); + if (ret < 0) { + return ret; + } + // There are 5 pages of PSVR calibration data. for (int i = 0; i < 5; i++) { // Request the IMU calibration data. diff --git a/src/xrt/drivers/psvr/psvr_device.h b/src/xrt/drivers/psvr/psvr_device.h index 08087a3bf..934077b3a 100644 --- a/src/xrt/drivers/psvr/psvr_device.h +++ b/src/xrt/drivers/psvr/psvr_device.h @@ -59,9 +59,11 @@ enum psvr_status_bits #define PSVR_PKG_DEVICE_NAME 0x80 #define PSVR_PKG_CALIBRATION 0x86 #define PSVR_PKG_0xA0 0xA0 +#define PSVR_PKG_0x82 0x82 #define PSVR_GET_DATA_ID_DEVICE_NAME 0x80 #define PSVR_GET_DATA_ID_CALIBRATION 0x86 +#define PSVR_GET_DATA_ID_0x82 0x82 /*