linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali.rohar@gmail.com>
To: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Cc: linux-input@vger.kernel.org, linux-bluetooth@vger.kernel.org,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
	Enric Balletbo i Serra <enric.balletbo@collabora.com>,
	linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Logan Gunthorpe <logang@deltatee.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Andrey Smirnov <andrew.smirnov@gmail.com>,
	Kirill Smelkov <kirr@nexedi.com>
Subject: Re: [PATCH] Input: uinput - Add UI_SET_UNIQ ioctl handler
Date: Sun, 1 Dec 2019 15:53:57 +0100	[thread overview]
Message-ID: <20191201145357.ybq5gfty4ulnfasq@pali> (raw)
In-Reply-To: <20191127185139.65048-1-abhishekpandit@chromium.org>

[-- Attachment #1: Type: text/plain, Size: 1504 bytes --]

Hello!

On Wednesday 27 November 2019 10:51:39 Abhishek Pandit-Subedi wrote:
> Support setting the uniq attribute of the input device. The uniq
> attribute is used as a unique identifier for the connected device.
> 
> For example, uinput devices created by BlueZ will store the address of
> the connected device as the uniq property.
> 
> Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>

...

> diff --git a/include/uapi/linux/uinput.h b/include/uapi/linux/uinput.h
> index c9e677e3af1d..d5b7767c1b02 100644
> --- a/include/uapi/linux/uinput.h
> +++ b/include/uapi/linux/uinput.h
> @@ -145,6 +145,7 @@ struct uinput_abs_setup {
>  #define UI_SET_PHYS		_IOW(UINPUT_IOCTL_BASE, 108, char*)
>  #define UI_SET_SWBIT		_IOW(UINPUT_IOCTL_BASE, 109, int)
>  #define UI_SET_PROPBIT		_IOW(UINPUT_IOCTL_BASE, 110, int)
> +#define UI_SET_UNIQ		_IOW(UINPUT_IOCTL_BASE, 111, char*)

I think that usage of char* as type in _IOW would cause compatibility
problems like it is for UI_SET_PHYS (there is UI_SET_PHYS_COMPAT). Size
of char* pointer depends on userspace (32 vs 64bit), so 32bit process on
64bit kernel would not be able to call this new UI_SET_UNIQ ioctl.

I would suggest to define this ioctl as e.g.:

  #define UI_SET_UNIQ		_IOW(_IOC_WRITE, UINPUT_IOCTL_BASE, 111, 0)

And then in uinput.c code handle it as:

  case UI_SET_UNIQ & ~IOCSIZE_MASK:

as part of section /* Now check variable-length commands */

-- 
Pali Rohár
pali.rohar@gmail.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  reply	other threads:[~2019-12-01 14:54 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-27 18:51 [PATCH] Input: uinput - Add UI_SET_UNIQ ioctl handler Abhishek Pandit-Subedi
2019-12-01 14:53 ` Pali Rohár [this message]
2019-12-02  1:23   ` Dmitry Torokhov
2019-12-02  8:47     ` Pali Rohár
2019-12-02 17:54       ` Dmitry Torokhov
2019-12-02 18:53         ` Pali Rohár
2019-12-02 19:36           ` Dmitry Torokhov
2019-12-02 22:54             ` Abhishek Pandit-Subedi
2019-12-02 23:09             ` Pali Rohár
2019-12-03 17:38               ` Pali Rohár
2019-12-03 19:11                 ` Dmitry Torokhov
2019-12-04 12:02                   ` Luiz Augusto von Dentz
2019-12-04 21:59                   ` Abhishek Pandit-Subedi
2019-12-05 10:52                   ` Pali Rohár
2019-12-05 20:03                     ` Abhishek Pandit-Subedi
2019-12-06  9:11                       ` Pali Rohár
2019-12-06 17:40                         ` Dmitry Torokhov
2019-12-16 21:57                           ` Abhishek Pandit-Subedi
2019-12-18 11:02                           ` Pali Rohár
2019-12-18 11:26                             ` Pali Rohár
2020-03-22 15:47                               ` Pali Rohár
2022-06-13 21:36                                 ` Luiz Augusto von Dentz
2024-02-06 17:17                                   ` Chris Morgan
2024-02-06 17:44                                     ` Pali Rohár
2019-12-04  1:49 ` Marcel Holtmann
2022-06-29  9:31 ` macmpi

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=20191201145357.ybq5gfty4ulnfasq@pali \
    --to=pali.rohar@gmail.com \
    --cc=abhishekpandit@chromium.org \
    --cc=andrew.smirnov@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=enric.balletbo@collabora.com \
    --cc=kirr@nexedi.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=logang@deltatee.com \
    --cc=luiz.dentz@gmail.com \
    --cc=tglx@linutronix.de \
    /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).