Skip to content

Commit 1c12f13

Browse files
LawstorantJiri Kosina
authored andcommitted
HID: pidff: Define values used in pidff_find_special_fields
Makes it clear where did these values came from Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com> Reviewed-by: Michał Kopeć <michal@nozomi.space> Reviewed-by: Paul Dino Jones <paul@spacefreak18.xyz> Tested-by: Paul Dino Jones <paul@spacefreak18.xyz> Tested-by: Cristóferson Bueno <cbueno81@gmail.com> Tested-by: Pablo Cisneros <patchkez@protonmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent e4bdc80 commit 1c12f13

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

drivers/hid/usbhid/hid-pidff.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ static const u8 pidff_reports[] = {
4848
/* device_control is really 0x95, but 0x96 specified as it is the usage of
4949
the only field in that report */
5050

51+
/* PID special fields */
52+
53+
#define PID_EFFECT_TYPE 0x25
54+
#define PID_DIRECTION 0x57
55+
#define PID_EFFECT_OPERATION_ARRAY 0x78
56+
#define PID_BLOCK_LOAD_STATUS 0x8b
57+
#define PID_DEVICE_CONTROL_ARRAY 0x96
58+
5159
/* Value usage tables used to put fields and values into arrays */
5260

5361
#define PID_EFFECT_BLOCK_INDEX 0
@@ -1046,23 +1054,24 @@ static int pidff_find_special_fields(struct pidff_device *pidff)
10461054

10471055
pidff->create_new_effect_type =
10481056
pidff_find_special_field(pidff->reports[PID_CREATE_NEW_EFFECT],
1049-
0x25, 1);
1057+
PID_EFFECT_TYPE, 1);
10501058
pidff->set_effect_type =
10511059
pidff_find_special_field(pidff->reports[PID_SET_EFFECT],
1052-
0x25, 1);
1060+
PID_EFFECT_TYPE, 1);
10531061
pidff->effect_direction =
10541062
pidff_find_special_field(pidff->reports[PID_SET_EFFECT],
1055-
0x57, 0);
1063+
PID_DIRECTION, 0);
10561064
pidff->device_control =
10571065
pidff_find_special_field(pidff->reports[PID_DEVICE_CONTROL],
1058-
0x96, !(pidff->quirks & HID_PIDFF_QUIRK_PERMISSIVE_CONTROL));
1066+
PID_DEVICE_CONTROL_ARRAY,
1067+
!(pidff->quirks & HID_PIDFF_QUIRK_PERMISSIVE_CONTROL));
10591068

10601069
pidff->block_load_status =
10611070
pidff_find_special_field(pidff->reports[PID_BLOCK_LOAD],
1062-
0x8b, 1);
1071+
PID_BLOCK_LOAD_STATUS, 1);
10631072
pidff->effect_operation_status =
10641073
pidff_find_special_field(pidff->reports[PID_EFFECT_OPERATION],
1065-
0x78, 1);
1074+
PID_EFFECT_OPERATION_ARRAY, 1);
10661075

10671076
hid_dbg(pidff->hid, "search done\n");
10681077

0 commit comments

Comments
 (0)