File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -1176,14 +1176,23 @@ int HID_API_EXPORT hid_set_nonblocking(hid_device *dev, int nonblock)
1176
1176
1177
1177
int HID_API_EXPORT hid_send_feature_report (hid_device * dev , const unsigned char * data , size_t length )
1178
1178
{
1179
+ static const int MAX_RETRIES = 50 ;
1180
+ int retry ;
1179
1181
int res ;
1180
1182
1181
1183
register_device_error (dev , NULL );
1182
1184
1183
- res = ioctl (dev -> device_handle , HIDIOCSFEATURE (length ), data );
1184
- if (res < 0 )
1185
- register_device_error_format (dev , "ioctl (SFEATURE): %s" , strerror (errno ));
1185
+ for (retry = 0 ; retry < MAX_RETRIES ; ++ retry ) {
1186
+ res = ioctl (dev -> device_handle , HIDIOCSFEATURE (length ), data );
1187
+ if (res < 0 && errno == EPIPE ) {
1188
+ /* Try again... */
1189
+ continue ;
1190
+ }
1186
1191
1192
+ if (res < 0 )
1193
+ register_device_error_format (dev , "ioctl (SFEATURE): %s" , strerror (errno ));
1194
+ break ;
1195
+ }
1187
1196
return res ;
1188
1197
}
1189
1198
You can’t perform that action at this time.
0 commit comments