File tree 1 file changed +12
-3
lines changed 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -1195,14 +1195,23 @@ int HID_API_EXPORT hid_set_nonblocking(hid_device *dev, int nonblock)
1195
1195
1196
1196
int HID_API_EXPORT hid_send_feature_report (hid_device * dev , const unsigned char * data , size_t length )
1197
1197
{
1198
+ static const int MAX_RETRIES = 50 ;
1199
+ int retry ;
1198
1200
int res ;
1199
1201
1200
1202
register_device_error (dev , NULL );
1201
1203
1202
- res = ioctl (dev -> device_handle , HIDIOCSFEATURE (length ), data );
1203
- if (res < 0 )
1204
- register_device_error_format (dev , "ioctl (SFEATURE): %s" , strerror (errno ));
1204
+ for (retry = 0 ; retry < MAX_RETRIES ; ++ retry ) {
1205
+ res = ioctl (dev -> device_handle , HIDIOCSFEATURE (length ), data );
1206
+ if (res < 0 && errno == EPIPE ) {
1207
+ /* Try again... */
1208
+ continue ;
1209
+ }
1205
1210
1211
+ if (res < 0 )
1212
+ register_device_error_format (dev , "ioctl (SFEATURE): %s" , strerror (errno ));
1213
+ break ;
1214
+ }
1206
1215
return res ;
1207
1216
}
1208
1217
You can’t perform that action at this time.
0 commit comments