|
@@ -13,16 +13,17 @@
|
|
|
HidGyroController g_hidGyroCtl;
|
|
HidGyroController g_hidGyroCtl;
|
|
|
|
|
|
|
|
static const uint8_t GYRO_HID_DESC[] = {
|
|
static const uint8_t GYRO_HID_DESC[] = {
|
|
|
- 0x05, 0x01, 0x09, 0x05, 0xA1, 0x01, 0x85, 0x01, 0x09, 0x30, 0x09,
|
|
|
|
|
- 0x31, 0x09, 0x32, 0x09, 0x35, 0x15, 0x00, 0x25, 0x07, 0x75, 0x04,
|
|
|
|
|
- 0x95, 0x01, 0x81, 0x42, 0x65, 0x00, 0x05, 0x09, 0x19, 0x01, 0x29,
|
|
|
|
|
- 0x0E, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x0E, 0x81, 0x02,
|
|
|
|
|
- 0x06, 0x00, 0xFF, 0x09, 0x20, 0x75, 0x06, 0x95, 0x01, 0x15, 0x00,
|
|
|
|
|
- 0x25, 0x7F, 0x81, 0x02, 0x05, 0x01, 0x09, 0x33, 0x09, 0x34, 0x15,
|
|
|
|
|
- 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x02, 0x81, 0x02, 0x06,
|
|
|
|
|
- 0x00, 0xFF, 0x09, 0x21, 0x95, 0x36, 0x81, 0x02, 0x85, 0x05, 0x09,
|
|
|
|
|
- 0x22, 0x95, 0x1F, 0x91, 0x02, 0x85, 0x04, 0x09, 0x23, 0x95, 0x24,
|
|
|
|
|
- 0xB1, 0x02, 0x85, 0x02, 0x09, 0x24, 0x95, 0x24, 0xB1, 0x02, 0xC0
|
|
|
|
|
|
|
+ 0x05, 0x01, 0x09, 0x05, 0xA1, 0x01, 0x85, 0x01, 0x09, 0x30, 0x09, 0x31,
|
|
|
|
|
+ 0x09, 0x32, 0x09, 0x35, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95,
|
|
|
|
|
+ 0x04, 0x81, 0x02, 0x09, 0x39, 0x15, 0x00, 0x25, 0x07, 0x75, 0x04, 0x95,
|
|
|
|
|
+ 0x01, 0x81, 0x42, 0x65, 0x00, 0x05, 0x09, 0x19, 0x01, 0x29, 0x0E, 0x15,
|
|
|
|
|
+ 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x0E, 0x81, 0x02, 0x06, 0x00, 0xFF,
|
|
|
|
|
+ 0x09, 0x20, 0x75, 0x06, 0x95, 0x01, 0x15, 0x00, 0x25, 0x7F, 0x81, 0x02,
|
|
|
|
|
+ 0x05, 0x01, 0x09, 0x33, 0x09, 0x34, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75,
|
|
|
|
|
+ 0x08, 0x95, 0x02, 0x81, 0x02, 0x06, 0x00, 0xFF, 0x09, 0x21, 0x95, 0x36,
|
|
|
|
|
+ 0x81, 0x02, 0x85, 0x05, 0x09, 0x22, 0x95, 0x1F, 0x91, 0x02, 0x85, 0x04,
|
|
|
|
|
+ 0x09, 0x23, 0x95, 0x24, 0xB1, 0x02, 0x85, 0x02, 0x09, 0x24, 0x95, 0x24,
|
|
|
|
|
+ 0xB1, 0x02, 0xC0
|
|
|
};
|
|
};
|
|
|
#define DS4_TOUCH_H 942
|
|
#define DS4_TOUCH_H 942
|
|
|
#define DS4_STATUS_USB 0x1B // cable + level 11 (full)
|
|
#define DS4_STATUS_USB 0x1B // cable + level 11 (full)
|
|
@@ -143,6 +144,7 @@ static ds4_setcb_t const DS4_SETCB[NSLOT] = { hidGyroSet0, hidGyroSet1,
|
|
|
static void hidGyroBuild(uint8_t usbSlot, uint8_t slot, uint8_t out[63])
|
|
static void hidGyroBuild(uint8_t usbSlot, uint8_t slot, uint8_t out[63])
|
|
|
{
|
|
{
|
|
|
uint32_t b = psButtonsFromSteam(g_in[slot].buttons);
|
|
uint32_t b = psButtonsFromSteam(g_in[slot].buttons);
|
|
|
|
|
+ psPadClickEdge(slot, (b & (TB_LPADC | TB_RPADC)) != 0);
|
|
|
// A pad mapped to a stick must NOT also report as a touchpad contact -- the host would read the same
|
|
// A pad mapped to a stick must NOT also report as a touchpad contact -- the host would read the same
|
|
|
// finger twice (stick deflection AND a cursor drag).
|
|
// finger twice (stick deflection AND a cursor drag).
|
|
|
bool lTouch = g_padStick[0] == PS_OFF &&
|
|
bool lTouch = g_padStick[0] == PS_OFF &&
|
|
@@ -164,18 +166,13 @@ static void hidGyroBuild(uint8_t usbSlot, uint8_t slot, uint8_t out[63])
|
|
|
((b & TB_STEAM) ? 0x01 : 0);
|
|
((b & TB_STEAM) ? 0x01 : 0);
|
|
|
out[7] = g_in[slot].lt;
|
|
out[7] = g_in[slot].lt;
|
|
|
out[8] = g_in[slot].rt;
|
|
out[8] = g_in[slot].rt;
|
|
|
- out[12] = g_in[slot].gx & 0xFF;
|
|
|
|
|
- out[13] = g_in[slot].gx >> 8;
|
|
|
|
|
- out[14] = g_in[slot].gz & 0xFF;
|
|
|
|
|
- out[15] = g_in[slot].gz >> 8;
|
|
|
|
|
- out[16] = (-g_in[slot].gy) & 0xFF;
|
|
|
|
|
- out[17] = (-g_in[slot].gy) >> 8;
|
|
|
|
|
- out[18] = g_in[slot].ax & 0xFF;
|
|
|
|
|
- out[19] = g_in[slot].ax >> 8;
|
|
|
|
|
- out[20] = g_in[slot].ay & 0xFF;
|
|
|
|
|
- out[21] = g_in[slot].ay >> 8;
|
|
|
|
|
- out[22] = g_in[slot].az & 0xFF;
|
|
|
|
|
- out[23] = g_in[slot].az >> 8;
|
|
|
|
|
|
|
+ PsImuFrame imu = psImuFromSteam(g_in[slot]);
|
|
|
|
|
+ le16(out + 12, imu.gx);
|
|
|
|
|
+ le16(out + 14, imu.gy);
|
|
|
|
|
+ le16(out + 16, imu.gz);
|
|
|
|
|
+ le16(out + 18, imu.ax);
|
|
|
|
|
+ le16(out + 20, imu.ay);
|
|
|
|
|
+ le16(out + 22, imu.az);
|
|
|
out[29] = DS4_STATUS_USB;
|
|
out[29] = DS4_STATUS_USB;
|
|
|
if (lTouch || rTouch) {
|
|
if (lTouch || rTouch) {
|
|
|
uint16_t tlx, tly, trx, trry;
|
|
uint16_t tlx, tly, trx, trry;
|