linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tomasz.pakula.oficjalny@gmail.com
To: Jonathan Denose <jdenose@google.com>,
	Jiri Kosina <jikos@kernel.org>,
	 Benjamin Tissoires	 <bentiss@kernel.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Henrik Rydberg <rydberg@bitmath.org>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-doc@vger.kernel.org, Angela Czubak <aczubak@google.com>,
	Sean O'Brien <seobrien@google.com>
Subject: Re: [PATCH v2 02/11] Input: add FF_HID effect type
Date: Mon, 04 Aug 2025 22:34:29 +0200	[thread overview]
Message-ID: <c7e398e92ecc75f05b575581e79d4cebfa8efb47.camel@gmail.com> (raw)
In-Reply-To: <20250804-support-forcepads-v2-2-138ca980261d@google.com>

On Mon, 2025-08-04 at 14:11 +0000, Jonathan Denose wrote:
> From: Angela Czubak <aczubak@google.com>
> 
> FF_HID effect type can be used to trigger haptic feedback with HID simple
> haptic usages.
> 
> Signed-off-by: Angela Czubak <aczubak@google.com>
> Co-developed-by: Jonathan Denose <jdenose@google.com>
> Signed-off-by: Jonathan Denose <jdenose@google.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 2557eb7b056178b2b8be98d9cea855eba1bd5aaf..3ea7c826c6fb2034e46f95cb95b84ef6f5b866df 100644
> --- a/include/uapi/linux/input.h
> +++ b/include/uapi/linux/input.h
> @@ -428,6 +428,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_waveform_page: 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;
> +};

Wouldn't it make more sense to call this new effect ff_haptic_effect?
hid_effect sound generic, too generic. One could say, all ff effect are
hid effects because most ff apis (linux' included) are based on USB PID
spec.

> +
>  /**
>   * struct ff_effect - defines force feedback effect
>   * @type: type of the effect (FF_CONSTANT, FF_PERIODIC, FF_RAMP, FF_SPRING,
> @@ -464,6 +482,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;
>  };
>  
> @@ -471,6 +490,7 @@ struct ff_effect {
>   * Force feedback effect types
>   */
>  
> +#define FF_HID		0x4f

Again here, FF_HID sounds confusing without having the broader context.
Constant, Sine, Inertia, Spring are way more descriptive. FF_HAPTIC
would be a great name to distinguish such an effect. Or maybe FF_TACTILE
with ff_tactile_effect?

>  #define FF_RUMBLE	0x50
>  #define FF_PERIODIC	0x51
>  #define FF_CONSTANT	0x52
> @@ -480,7 +500,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
>  
>  /*

Overall, I'll keep an eye on this as I'm slowly working towards a
proposal for a revamped and extended ff api on Linux that would make it
fully featured (we're lacking things like device control and querying
effects and their status, arbitrary number of axes and arbitrary axes
themselves).

  reply	other threads:[~2025-08-04 20:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-04 14:11 [PATCH v2 00/11] HID: Implement haptic touchpad support Jonathan Denose
2025-08-04 14:11 ` [PATCH v2 01/11] HID: add haptics page defines Jonathan Denose
2025-08-04 14:11 ` [PATCH v2 02/11] Input: add FF_HID effect type Jonathan Denose
2025-08-04 20:34   ` tomasz.pakula.oficjalny [this message]
2025-08-11 15:26     ` Jonathan Denose
2025-08-04 14:11 ` [PATCH v2 03/11] Input: add INPUT_PROP_HAPTIC_TOUCHPAD Jonathan Denose
2025-08-04 14:11 ` [PATCH v2 04/11] HID: haptic: introduce hid_haptic_device Jonathan Denose
2025-08-04 14:11 ` [PATCH v2 05/11] HID: input: allow mapping of haptic output Jonathan Denose
2025-08-04 14:11 ` [PATCH v2 06/11] HID: haptic: initialize haptic device Jonathan Denose
2025-08-04 14:11 ` [PATCH v2 07/11] HID: input: calculate resolution for pressure Jonathan Denose
2025-08-04 14:11 ` [PATCH v2 08/11] HID: haptic: add functions handling events Jonathan Denose
2025-08-04 14:11 ` [PATCH v2 09/11] Input: MT - add INPUT_MT_TOTAL_FORCE flags Jonathan Denose
2025-08-04 14:11 ` [PATCH v2 10/11] HID: haptic: add hid_haptic_switch_mode Jonathan Denose
2025-08-04 14:11 ` [PATCH v2 11/11] HID: multitouch: add haptic multitouch support Jonathan Denose
2025-08-13  9:22   ` Benjamin Tissoires
2025-08-13 15:52     ` Jonathan Denose

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c7e398e92ecc75f05b575581e79d4cebfa8efb47.camel@gmail.com \
    --to=tomasz.pakula.oficjalny@gmail.com \
    --cc=aczubak@google.com \
    --cc=bentiss@kernel.org \
    --cc=corbet@lwn.net \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jdenose@google.com \
    --cc=jikos@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rydberg@bitmath.org \
    --cc=seobrien@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).