]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
HID: pidff: Define values used in pidff_find_special_fields
authorTomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Sat, 1 Feb 2025 11:38:59 +0000 (12:38 +0100)
committerJiri Kosina <jkosina@suse.com>
Mon, 3 Feb 2025 14:17:03 +0000 (15:17 +0100)
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>
drivers/hid/usbhid/hid-pidff.c

index a8698593e432e779e3cfc801e7756561bd19a378..fbb79179e02be69e14cd4b9f9a2bb3613467a04d 100644 (file)
@@ -48,6 +48,14 @@ static const u8 pidff_reports[] = {
 /* device_control is really 0x95, but 0x96 specified as it is the usage of
 the only field in that report */
 
+/* PID special fields */
+
+#define PID_EFFECT_TYPE                        0x25
+#define PID_DIRECTION                  0x57
+#define PID_EFFECT_OPERATION_ARRAY     0x78
+#define PID_BLOCK_LOAD_STATUS          0x8b
+#define PID_DEVICE_CONTROL_ARRAY       0x96
+
 /* Value usage tables used to put fields and values into arrays */
 
 #define PID_EFFECT_BLOCK_INDEX 0
@@ -1046,23 +1054,24 @@ static int pidff_find_special_fields(struct pidff_device *pidff)
 
        pidff->create_new_effect_type =
                pidff_find_special_field(pidff->reports[PID_CREATE_NEW_EFFECT],
-                                        0x25, 1);
+                                        PID_EFFECT_TYPE, 1);
        pidff->set_effect_type =
                pidff_find_special_field(pidff->reports[PID_SET_EFFECT],
-                                        0x25, 1);
+                                        PID_EFFECT_TYPE, 1);
        pidff->effect_direction =
                pidff_find_special_field(pidff->reports[PID_SET_EFFECT],
-                                        0x57, 0);
+                                        PID_DIRECTION, 0);
        pidff->device_control =
                pidff_find_special_field(pidff->reports[PID_DEVICE_CONTROL],
-                       0x96, !(pidff->quirks & HID_PIDFF_QUIRK_PERMISSIVE_CONTROL));
+                       PID_DEVICE_CONTROL_ARRAY,
+                       !(pidff->quirks & HID_PIDFF_QUIRK_PERMISSIVE_CONTROL));
 
        pidff->block_load_status =
                pidff_find_special_field(pidff->reports[PID_BLOCK_LOAD],
-                                        0x8b, 1);
+                                        PID_BLOCK_LOAD_STATUS, 1);
        pidff->effect_operation_status =
                pidff_find_special_field(pidff->reports[PID_EFFECT_OPERATION],
-                                        0x78, 1);
+                                        PID_EFFECT_OPERATION_ARRAY, 1);
 
        hid_dbg(pidff->hid, "search done\n");