[PATCH] Add --no-input option to rpi backend
Jason Ekstrand
jason at jlekstrand.net
Fri Apr 18 07:34:35 PDT 2014
On Fri, Apr 18, 2014 at 9:12 AM, Fernando Herrera <fherrera at onirica.com>wrote:
> Adds a --no-input option to the rpi backend so weston can be started
> without any input device attached. This is useful for display boxes
> without any keyboard/mouse attached
>
Ok, maybe this is a silly question, but why are we requiring input devices
on start-up at all? I agree that a --no-input option that explicitly
disables input is potentially useful, but shouldn't weston be able to start
up without input devices anyway? Also, It might be a good idea to think
about making such an option global. I don't think making it global would
be easy right now, but it's worth thinking about.
Other than that, the patch looks pretty good to me.
--Jason Ekstrand
> Signed-off-by: Fernando Herrera <fherrera at onirica.com>
> ---
> src/compositor-rpi.c | 29 ++++++++++++++++++-----------
> src/compositor.c | 1 +
> 2 files changed, 19 insertions(+), 11 deletions(-)
>
> diff --git a/src/compositor-rpi.c b/src/compositor-rpi.c
> index 287451d..f39152d 100644
> --- a/src/compositor-rpi.c
> +++ b/src/compositor-rpi.c
> @@ -488,7 +488,8 @@ struct rpi_parameters {
> static struct weston_compositor *
> rpi_compositor_create(struct wl_display *display, int *argc, char *argv[],
> struct weston_config *config,
> - struct rpi_parameters *param)
> + struct rpi_parameters *param,
> + int no_input)
> {
> struct rpi_compositor *compositor;
> uint32_t key;
> @@ -503,10 +504,12 @@ rpi_compositor_create(struct wl_display *display,
> int *argc, char *argv[],
> config) < 0)
> goto out_free;
>
> - compositor->udev = udev_new();
> - if (compositor->udev == NULL) {
> - weston_log("Failed to initialize udev context.\n");
> - goto out_compositor;
> + if (!no_input) {
> + compositor->udev = udev_new();
> + if (compositor->udev == NULL) {
> + weston_log("Failed to initialize udev context.\n");
> + goto out_compositor;
> + }
> }
>
> compositor->session_listener.notify = session_notify;
> @@ -548,11 +551,13 @@ rpi_compositor_create(struct wl_display *display,
> int *argc, char *argv[],
> if (rpi_output_create(compositor, param->output_transform) < 0)
> goto out_renderer;
>
> - if (udev_input_init(&compositor->input,
> - &compositor->base,
> - compositor->udev, "seat0") != 0) {
> - weston_log("Failed to initialize udev input.\n");
> - goto out_renderer;
> + if (!no_input) {
> + if (udev_input_init(&compositor->input,
> + &compositor->base,
> + compositor->udev, "seat0") != 0) {
> + weston_log("Failed to initialize udev input.\n");
> + goto out_renderer;
> + }
> }
>
> return &compositor->base;
> @@ -581,6 +586,7 @@ backend_init(struct wl_display *display, int *argc,
> char *argv[],
> struct weston_config *config)
> {
> const char *transform = "normal";
> + int no_input;
> int ret;
>
> struct rpi_parameters param = {
> @@ -597,6 +603,7 @@ backend_init(struct wl_display *display, int *argc,
> char *argv[],
> { WESTON_OPTION_STRING, "transform", 0, &transform },
> { WESTON_OPTION_BOOLEAN, "opaque-regions", 0,
> ¶m.renderer.opaque_regions },
> + { WESTON_OPTION_BOOLEAN, "no-input", 0, &no_input },
> };
>
> parse_options(rpi_options, ARRAY_LENGTH(rpi_options), argc, argv);
> @@ -607,5 +614,5 @@ backend_init(struct wl_display *display, int *argc,
> char *argv[],
> else
> param.output_transform = ret;
>
> - return rpi_compositor_create(display, argc, argv, config, ¶m);
> + return rpi_compositor_create(display, argc, argv, config, ¶m,
> no_input);
> }
> diff --git a/src/compositor.c b/src/compositor.c
> index 7c29d51..723a4f5 100644
> --- a/src/compositor.c
> +++ b/src/compositor.c
> @@ -3964,6 +3964,7 @@ usage(int error_code)
> "\tnormal 90 180 270 flipped flipped-90 flipped-180
> flipped-270\n"
> " --opaque-regions\tEnable support for opaque regions,
> can be "
> "very slow without support in the GPU firmware.\n"
> + " --no-input\t\tDont create input devices\n"
> "\n");
> #endif
>
> --
> 1.7.10.4
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20140418/0e14f740/attachment-0001.html>
More information about the wayland-devel
mailing list