@@ -393,7 +393,7 @@ typedef struct GIP_Metadata
393
393
Uint16 version_minor ;
394
394
395
395
GIP_DeviceMetadata device ;
396
-
396
+
397
397
Uint8 num_messages ;
398
398
GIP_MessageMetadata * message_metadata ;
399
399
} GIP_Metadata ;
@@ -575,6 +575,11 @@ static bool GIP_SupportsVendorMessage(GIP_Device *device, Uint8 command, bool up
575
575
static Uint8 GIP_SequenceNext (GIP_Device * device , Uint8 command , bool system )
576
576
{
577
577
Uint8 seq ;
578
+
579
+ if (command == GIP_CMD_DIRECT_MOTOR ) {
580
+ // The motor sequence is optional and always works with 0
581
+ return 0 ;
582
+ }
578
583
if (system ) {
579
584
switch (command ) {
580
585
case GIP_CMD_SECURITY :
@@ -792,7 +797,7 @@ static bool GIP_ParseDeviceMetadata(GIP_Metadata *metadata, const Uint8 *bytes,
792
797
793
798
for (i = 0 ; i < count ; i ++ ) {
794
799
Uint8 message = bytes [buffer_offset + 1 + i ];
795
- device -> in_system_messages [message >> 5 ] |= 1u << (message & 0x1F );
800
+ device -> in_system_messages [message >> 5 ] |= 1u << (message & 0x1F );
796
801
}
797
802
}
798
803
@@ -809,7 +814,7 @@ static bool GIP_ParseDeviceMetadata(GIP_Metadata *metadata, const Uint8 *bytes,
809
814
810
815
for (i = 0 ; i < count ; i ++ ) {
811
816
Uint8 message = bytes [buffer_offset + 1 + i ];
812
- device -> out_system_messages [message >> 5 ] |= 1u << (message & 0x1F );
817
+ device -> out_system_messages [message >> 5 ] |= 1u << (message & 0x1F );
813
818
}
814
819
}
815
820
@@ -1122,7 +1127,7 @@ static bool GIP_SendInitSequence(GIP_Device *device)
1122
1127
1123
1128
static bool GIP_EnsureMetadata (GIP_Device * device )
1124
1129
{
1125
-
1130
+
1126
1131
switch (device -> got_metadata ) {
1127
1132
case GIP_METADATA_GOT :
1128
1133
case GIP_METADATA_FAKED :
@@ -1147,8 +1152,6 @@ static bool GIP_EnsureMetadata(GIP_Device *device)
1147
1152
1148
1153
static bool GIP_SetMetadataDefaults (GIP_Device * device )
1149
1154
{
1150
- int seq ;
1151
-
1152
1155
/* Some decent default settings */
1153
1156
device -> features |= GIP_FEATURE_MOTOR_CONTROL ;
1154
1157
device -> device_type = GIP_TYPE_GAMEPAD ;
@@ -1164,23 +1167,6 @@ static bool GIP_SetMetadataDefaults(GIP_Device *device)
1164
1167
GIP_SendQueryFirmware (device , 2 );
1165
1168
}
1166
1169
1167
- if (device -> features & GIP_FEATURE_MOTOR_CONTROL ) {
1168
- for (seq = 1 ; seq < 0x100 ; seq ++ ) {
1169
- Uint8 message [9 ] = {0 };
1170
-
1171
- /* Try all sequence numbers to reset it to 1 */
1172
- GIP_SendRawMessage (device ,
1173
- GIP_CMD_DIRECT_MOTOR ,
1174
- 0 ,
1175
- (Uint8 ) seq ,
1176
- message ,
1177
- sizeof (message ),
1178
- true,
1179
- NULL ,
1180
- NULL );
1181
- }
1182
- }
1183
-
1184
1170
device -> got_metadata = GIP_METADATA_FAKED ;
1185
1171
device -> hello_deadline = 0 ;
1186
1172
return HIDAPI_JoystickConnected (device -> device , NULL );
@@ -1512,7 +1498,7 @@ static bool GIP_HandleCommandGuideButtonStatus(
1512
1498
if (!joystick ) {
1513
1499
return false;
1514
1500
}
1515
- if (bytes [1 ] == VK_LWIN ) {
1501
+ if (bytes [1 ] == VK_LWIN ) {
1516
1502
SDL_SendJoystickButton (timestamp , joystick , SDL_GAMEPAD_BUTTON_GUIDE , (bytes [0 ] & 0x01 ) != 0 );
1517
1503
}
1518
1504
@@ -1815,7 +1801,7 @@ static bool GIP_HandleLLInputReport(
1815
1801
(bytes [device -> paddle_offset ] & 0x08 ) != 0 );
1816
1802
}
1817
1803
}
1818
-
1804
+
1819
1805
if ((device -> features & GIP_FEATURE_CONSOLE_FUNCTION_MAP ) && num_bytes >= 32 ) {
1820
1806
int function_map_offset = -1 ;
1821
1807
if (device -> features & GIP_FEATURE_DYNAMIC_LATENCY_INPUT ) {
@@ -2057,7 +2043,7 @@ static int GIP_ReceivePacket(GIP_Device *device, const Uint8 *bytes, int num_byt
2057
2043
device -> fragment_data = NULL ;
2058
2044
}
2059
2045
device -> fragment_message = 0 ;
2060
- }
2046
+ }
2061
2047
fragment_offset += header .length ;
2062
2048
device -> fragment_offset = (Uint16 ) fragment_offset ;
2063
2049
}
0 commit comments