All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
To: Vicki Pfau <vi@endrift.com>
Cc: "open list:HID CORE LAYER" <linux-input@vger.kernel.org>,
	Roderick Colenbrander <roderick.colenbrander@sony.com>,
	Jiri Kosina <jikos@kernel.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>
Subject: Re: [PATCH 2/6] HID: hid-playstation: Add touchpad_mouse param
Date: Thu, 5 May 2022 10:52:45 +0200	[thread overview]
Message-ID: <CAO-hwJ+ekkNpyXwdWmCW3mLqayNExVfC8gxR4MZYxmSXBa0NXQ@mail.gmail.com> (raw)
In-Reply-To: <20220427224526.35657-2-vi@endrift.com>

Hi Vicki,

On Thu, Apr 28, 2022 at 12:52 AM Vicki Pfau <vi@endrift.com> wrote:
>
> Add parameter "touchpad_mouse" to enable disabling or re-enabling exposing the
> touchpad input_dev, which can be changed while the module is loaded.

What's the point of exposing this new parameter?
Patch 3/6 automatically disables touchpad when hidraw is opened, so
who will be the user of this parameter?

The problem I have with kernel parameter is that they are effectively
kernel API, and we need to keep them forever, so I'd rather have good
arguments on why this is needed.

Cheers,
Benjamin

>
> Signed-off-by: Vicki Pfau <vi@endrift.com>
> ---
>  drivers/hid/hid-playstation.c | 41 +++++++++++++++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
>
> diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c
> index f859a8dd8a2e..ad0da4470615 100644
> --- a/drivers/hid/hid-playstation.c
> +++ b/drivers/hid/hid-playstation.c
> @@ -23,6 +23,8 @@ static LIST_HEAD(ps_devices_list);
>
>  static DEFINE_IDA(ps_player_id_allocator);
>
> +static bool touchpad_mouse = true;
> +
>  #define HID_PLAYSTATION_VERSION_PATCH 0x8000
>
>  /* Base class for playstation devices. */
> @@ -1343,6 +1345,45 @@ static void ps_remove(struct hid_device *hdev)
>         hid_hw_stop(hdev);
>  }
>
> +static int ps_param_set_touchpad_mouse(const char *val,
> +                                       const struct kernel_param *kp)
> +{
> +       struct ps_device *dev;
> +       struct dualsense *ds;
> +       struct input_dev *touchpad;
> +       int ret;
> +
> +       ret = param_set_bool(val, kp);
> +       if (ret)
> +               return ret;
> +
> +       mutex_lock(&ps_devices_lock);
> +       list_for_each_entry(dev, &ps_devices_list, list) {
> +               mutex_lock(&dev->mutex);
> +               if (dev->hdev->product == USB_DEVICE_ID_SONY_PS5_CONTROLLER) {
> +                       ds = container_of(dev, struct dualsense, base);
> +                       if (touchpad_mouse) {
> +                               touchpad = ps_touchpad_create(dev->hdev, DS_TOUCHPAD_WIDTH, DS_TOUCHPAD_HEIGHT, 2);
> +                               if (IS_ERR(touchpad))
> +                                       continue;
> +                               rcu_assign_pointer(ds->touchpad, touchpad);
> +                       } else
> +                               dualsense_unregister_touchpad(ds);
> +               }
> +               mutex_unlock(&dev->mutex);
> +       }
> +       mutex_unlock(&ps_devices_lock);
> +       return 0;
> +}
> +
> +static const struct kernel_param_ops ps_touchpad_mouse_ops = {
> +       .set    = ps_param_set_touchpad_mouse,
> +       .get    = param_get_bool,
> +};
> +
> +module_param_cb(touchpad_mouse, &ps_touchpad_mouse_ops, &touchpad_mouse, 0644);
> +MODULE_PARM_DESC(touchpad_mouse, "Enable mouse emulation using the touchpad");
> +
>  static const struct hid_device_id ps_devices[] = {
>         { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS5_CONTROLLER) },
>         { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS5_CONTROLLER) },
> --
> 2.36.0
>


  reply	other threads:[~2022-05-05  8:53 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-27 22:45 [PATCH 1/6] HID: hid-playstation: Allow removal of touchpad Vicki Pfau
2022-04-27 22:45 ` [PATCH 2/6] HID: hid-playstation: Add touchpad_mouse param Vicki Pfau
2022-05-05  8:52   ` Benjamin Tissoires [this message]
2022-05-05 22:00     ` Vicki Pfau
2022-04-27 22:45 ` [PATCH 3/6] HID: hid-playstation: Disable touchpad reporting when hidraw open Vicki Pfau
2022-05-05  8:57   ` Benjamin Tissoires
2022-05-05 22:03     ` Vicki Pfau
2022-05-06  6:00       ` Roderick Colenbrander
2022-05-06  6:54         ` Benjamin Tissoires
2022-05-06  6:57       ` Benjamin Tissoires
2022-04-27 22:45 ` [PATCH 4/6] HID: hid-sony: Allow removal of touchpad Vicki Pfau
2022-04-27 22:45 ` [PATCH 5/6] HID: hid-sony: Add touchpad_mouse param Vicki Pfau
2022-04-27 22:45 ` [PATCH 6/6] HID: hid-sony: Disable touchpad reporting when hidraw open Vicki Pfau
2022-05-05  8:50 ` [PATCH 1/6] HID: hid-playstation: Allow removal of touchpad Benjamin Tissoires
2022-05-05 16:55   ` Dmitry Torokhov
2022-05-06  5:21     ` Roderick Colenbrander
2022-05-06  6:46       ` Vicki Pfau
2022-05-06  6:59     ` Roderick Colenbrander
2022-05-06  8:23       ` Benjamin Tissoires
2022-05-05 21:57   ` Vicki Pfau

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=CAO-hwJ+ekkNpyXwdWmCW3mLqayNExVfC8gxR4MZYxmSXBa0NXQ@mail.gmail.com \
    --to=benjamin.tissoires@redhat.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=roderick.colenbrander@sony.com \
    --cc=vi@endrift.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.