[PATCH] Add --no-input option to rpi backend

Fernando Herrera fherrera at onirica.com
Fri Apr 18 07:12:25 PDT 2014


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

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,
 		  &param.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, &param);
+	return rpi_compositor_create(display, argc, argv, config, &param, 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



More information about the wayland-devel mailing list