lkml.org 
[lkml]   [2019]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Input: uinput - Add UI_SET_UNIQ ioctl handler
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
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2019-12-01 15:54    [W:0.062 / U:4.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site