diff mbox series

[02/18] Input: add FF_HID effect type

Message ID 20211221191743.1893185-3-acz@semihalf.com
State Superseded
Headers show
Series *** Implement simple haptic HID support *** | expand

Commit Message

Angela Czubak Dec. 21, 2021, 7:17 p.m. UTC
FF_HID effect type can be used to trigger haptic feedback with HID simple
haptic usages.

Signed-off-by: Angela Czubak <acz@semihalf.com>
---
 include/uapi/linux/input.h | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

Comments

Harry Cutts Dec. 30, 2021, 4:41 p.m. UTC | #1
Hi Angela,

On Tue, 21 Dec 2021 at 11:17, Angela Czubak <acz@semihalf.com> wrote:
>
> FF_HID effect type can be used to trigger haptic feedback with HID simple
> haptic usages.
>
> Signed-off-by: Angela Czubak <acz@semihalf.com>
> ---
>  include/uapi/linux/input.h | 22 +++++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
> index ee3127461ee0..0d4d426cf75a 100644
> --- a/include/uapi/linux/input.h
> +++ b/include/uapi/linux/input.h
> @@ -424,6 +424,24 @@ struct ff_rumble_effect {
>         __u16 weak_magnitude;
>  };
>
> +/**
> + * struct ff_hid_effect
> + * @hid_usage: hid_usage according to Haptics page (WAVEFORM_CLICK, etc.)
> + * @vendor_id: the waveform vendor ID if hid_usage is in the vendor-defined range
> + * @vendor_id: the vendor waveform page if hid_usage is in the vendor-defined range

Looks like you forgot to change vendor_id to vendor_waveform_page on
the line above.

> + * @intensity: strength of the effect as percentage
> + * @repeat_count: number of times to retrigger effect
> + * @retrigger_period: time before effect is retriggered (in ms)
> + */
> +struct ff_hid_effect {
> +       __u16 hid_usage;
> +       __u16 vendor_id;
> +       __u8  vendor_waveform_page;
> +       __u16 intensity;
> +       __u16 repeat_count;
> +       __u16 retrigger_period;
> +};
> +
>  /**
>   * struct ff_effect - defines force feedback effect
>   * @type: type of the effect (FF_CONSTANT, FF_PERIODIC, FF_RAMP, FF_SPRING,
> @@ -460,6 +478,7 @@ struct ff_effect {
>                 struct ff_periodic_effect periodic;
>                 struct ff_condition_effect condition[2]; /* One for each axis */
>                 struct ff_rumble_effect rumble;
> +               struct ff_hid_effect hid;
>         } u;
>  };
>
> @@ -467,6 +486,7 @@ struct ff_effect {
>   * Force feedback effect types
>   */
>
> +#define FF_HID         0x4f
>  #define FF_RUMBLE      0x50
>  #define FF_PERIODIC    0x51
>  #define FF_CONSTANT    0x52
> @@ -476,7 +496,7 @@ struct ff_effect {
>  #define FF_INERTIA     0x56
>  #define FF_RAMP                0x57
>
> -#define FF_EFFECT_MIN  FF_RUMBLE
> +#define FF_EFFECT_MIN  FF_HID
>  #define FF_EFFECT_MAX  FF_RAMP
>
>  /*
> --
> 2.34.1.307.g9b7440fafd-goog
>

Harry Cutts
Chrome OS Touch/Input team
diff mbox series

Patch

diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
index ee3127461ee0..0d4d426cf75a 100644
--- a/include/uapi/linux/input.h
+++ b/include/uapi/linux/input.h
@@ -424,6 +424,24 @@  struct ff_rumble_effect {
 	__u16 weak_magnitude;
 };
 
+/**
+ * struct ff_hid_effect
+ * @hid_usage: hid_usage according to Haptics page (WAVEFORM_CLICK, etc.)
+ * @vendor_id: the waveform vendor ID if hid_usage is in the vendor-defined range
+ * @vendor_id: the vendor waveform page if hid_usage is in the vendor-defined range
+ * @intensity: strength of the effect as percentage
+ * @repeat_count: number of times to retrigger effect
+ * @retrigger_period: time before effect is retriggered (in ms)
+ */
+struct ff_hid_effect {
+	__u16 hid_usage;
+	__u16 vendor_id;
+	__u8  vendor_waveform_page;
+	__u16 intensity;
+	__u16 repeat_count;
+	__u16 retrigger_period;
+};
+
 /**
  * struct ff_effect - defines force feedback effect
  * @type: type of the effect (FF_CONSTANT, FF_PERIODIC, FF_RAMP, FF_SPRING,
@@ -460,6 +478,7 @@  struct ff_effect {
 		struct ff_periodic_effect periodic;
 		struct ff_condition_effect condition[2]; /* One for each axis */
 		struct ff_rumble_effect rumble;
+		struct ff_hid_effect hid;
 	} u;
 };
 
@@ -467,6 +486,7 @@  struct ff_effect {
  * Force feedback effect types
  */
 
+#define FF_HID		0x4f
 #define FF_RUMBLE	0x50
 #define FF_PERIODIC	0x51
 #define FF_CONSTANT	0x52
@@ -476,7 +496,7 @@  struct ff_effect {
 #define FF_INERTIA	0x56
 #define FF_RAMP		0x57
 
-#define FF_EFFECT_MIN	FF_RUMBLE
+#define FF_EFFECT_MIN	FF_HID
 #define FF_EFFECT_MAX	FF_RAMP
 
 /*