[PATCH v2 04/14] xf86Xinput: Modify API for server-managed fd support

Mark Kettenis mark.kettenis at xs4all.nl
Tue Feb 4 13:03:37 CET 2014


> From: Hans de Goede <hdegoede at redhat.com>
> Date: Tue,  4 Feb 2014 12:49:10 +0100
> 
> With systemd-logind support, the xserver, rather then the drivers will be
> responsible for opening/closing the fd for input devices.
> 
> This commit adds a new capabilities field to the InputDriverRec and a
> XI86_DRV_CAP_SERVER_FD flag for drivers to indicate that they support server
> managed fds.
> 
> This commit adds a new XI86_SERVER_FD flag to indicate to drivers when the
> server is managing the fd and they should not open/close it. Note that even
> if drivers declare they support server managed fds there is no guarantee they
> will actually get them.
> 
> Since this changes the input driver ABI, this commit bumps it.
> 
> systemd-logind tracks devices by their chardev major + minor
> numbers, since we are breaking ABI anyways also add major and minor
> fields for easy storage / retreival of these.

Isn't the proper type to keep track of devices a dev_t?

>  hw/xfree86/common/xf86Module.h | 2 +-
>  hw/xfree86/common/xf86Xinput.c | 6 ++++++
>  hw/xfree86/common/xf86Xinput.h | 7 +++++++
>  3 files changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
> index b6ec19d..96ac3b0 100644
> --- a/hw/xfree86/common/xf86Module.h
> +++ b/hw/xfree86/common/xf86Module.h
> @@ -81,7 +81,7 @@ typedef enum {
>   */
>  #define ABI_ANSIC_VERSION	SET_ABI_VERSION(0, 4)
>  #define ABI_VIDEODRV_VERSION	SET_ABI_VERSION(15, 0)
> -#define ABI_XINPUT_VERSION	SET_ABI_VERSION(20, 0)
> +#define ABI_XINPUT_VERSION	SET_ABI_VERSION(21, 0)
>  #define ABI_EXTENSION_VERSION	SET_ABI_VERSION(8, 0)
>  #define ABI_FONT_VERSION	SET_ABI_VERSION(0, 6)
>  
> diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
> index 3a01513..6404ef5 100644
> --- a/hw/xfree86/common/xf86Xinput.c
> +++ b/hw/xfree86/common/xf86Xinput.c
> @@ -949,6 +949,12 @@ NewInputDeviceRequest(InputOption *options, InputAttributes * attrs,
>                  goto unwind;
>              }
>          }
> +
> +        if (strcmp(key, "major") == 0)
> +            pInfo->major = atoi(value);
> +
> +        if (strcmp(key, "minor") == 0)
> +            pInfo->minor = atoi(value);
>      }
>  
>      nt_list_for_each_entry(option, options, list.next) {
> diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h
> index f94261a..bf81971 100644
> --- a/hw/xfree86/common/xf86Xinput.h
> +++ b/hw/xfree86/common/xf86Xinput.h
> @@ -64,6 +64,10 @@
>  /* 0x08 is reserved for legacy XI86_SEND_DRAG_EVENTS, do not use for now */
>  /* server-internal only */
>  #define XI86_DEVICE_DISABLED    0x10    /* device was disabled before vt switch */
> +#define XI86_SERVER_FD		0x20	/* fd is managed by xserver */
> +
> +/* Input device driver capabilities */
> +#define XI86_DRV_CAP_SERVER_FD	0x01
>  
>  /* This holds the input driver entry and module information. */
>  typedef struct _InputDriverRec {
> @@ -76,6 +80,7 @@ typedef struct _InputDriverRec {
>                      struct _InputInfoRec * pInfo, int flags);
>      void *module;
>      const char **default_options;
> +    int capabilities;
>  } InputDriverRec, *InputDriverPtr;
>  
>  /* This is to input devices what the ScrnInfoRec is to screens. */
> @@ -96,6 +101,8 @@ typedef struct _InputInfoRec {
>        int *valuators, int first_valuator, int num_valuators);
>  
>      int fd;
> +    int major;
> +    int minor;
>      DeviceIntPtr dev;
>      void *private;
>      const char *type_name;
> -- 
> 1.8.5.3
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 


More information about the xorg-devel mailing list