Skip to content

Commit 9d4174d

Browse files
LawstorantJiri Kosina
authored andcommitted
HID: pidff: Support device error response from PID_BLOCK_LOAD
If an error happens on the device, the driver will no longer fall into the trap of reading this status 60 times before it decides that this reply won't change to success/memory full. Greatly reduces communication overhead during device error situation. Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent e19675c commit 9d4174d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/hid/usbhid/hid-pidff.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ static const u8 pidff_effect_types[] = {
138138

139139
#define PID_BLOCK_LOAD_SUCCESS 0
140140
#define PID_BLOCK_LOAD_FULL 1
141-
static const u8 pidff_block_load_status[] = { 0x8c, 0x8d };
141+
#define PID_BLOCK_LOAD_ERROR 2
142+
static const u8 pidff_block_load_status[] = { 0x8c, 0x8d, 0x8e};
142143

143144
#define PID_EFFECT_START 0
144145
#define PID_EFFECT_STOP 1
@@ -666,6 +667,11 @@ static int pidff_request_effect_upload(struct pidff_device *pidff, int efnum)
666667
pidff->block_load[PID_RAM_POOL_AVAILABLE].value[0] : -1);
667668
return -ENOSPC;
668669
}
670+
if (pidff->block_load_status->value[0] ==
671+
pidff->status_id[PID_BLOCK_LOAD_ERROR]) {
672+
hid_dbg(pidff->hid, "device error during effect creation\n");
673+
return -EREMOTEIO;
674+
}
669675
}
670676
hid_err(pidff->hid, "pid_block_load failed 60 times\n");
671677
return -EIO;

0 commit comments

Comments
 (0)