[PATCH 2/2] udev-seat: break early when output is found and log the mapping

U. Artie Eoff ullysses.a.eoff at intel.com
Fri Jan 10 10:15:18 PST 2014


When an input device has a WL_OUTPUT udev property specified and
that output is found, log it... also break from the loop immediately.

Log a warning if the requested output is not found.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff at intel.com>
---
 src/udev-seat.c | 38 +++++++++++++++++++++++++++++---------
 1 file changed, 29 insertions(+), 9 deletions(-)

diff --git a/src/udev-seat.c b/src/udev-seat.c
index f9723f2..f4fdae0 100644
--- a/src/udev-seat.c
+++ b/src/udev-seat.c
@@ -105,13 +105,14 @@ device_added(struct udev_device *udev_device, struct udev_input *input)
 					 &device->abs.calibration[4],
 					 &device->abs.calibration[5]) == 6) {
 		device->abs.apply_calibration = 1;
-		weston_log ("Applying calibration: %f %f %f %f %f %f\n",
-			    device->abs.calibration[0],
-			    device->abs.calibration[1],
-			    device->abs.calibration[2],
-			    device->abs.calibration[3],
-			    device->abs.calibration[4],
-			    device->abs.calibration[5]);
+		weston_log_continue(STAMP_SPACE
+				    "applying calibration: %f %f %f %f %f %f\n",
+				    device->abs.calibration[0],
+				    device->abs.calibration[1],
+				    device->abs.calibration[2],
+				    device->abs.calibration[3],
+				    device->abs.calibration[4],
+				    device->abs.calibration[5]);
 	}
 
 	wl_list_insert(seat->devices_list.prev, &device->link);
@@ -125,8 +126,20 @@ device_added(struct udev_device *udev_device, struct udev_input *input)
 	if (output_name) {
 		device->output_name = strdup(output_name);
 		wl_list_for_each(output, &c->output_list, link)
-			if (strcmp(output->name, device->output_name) == 0)
+			if (strcmp(output->name, device->output_name) == 0) {
 				device->output = output;
+				weston_log_continue(
+					STAMP_SPACE
+					"mapping to output: %s\n",
+					device->output->name);
+				break;
+			}
+		if (!device->output || strcmp(device->output->name, device->output_name) != 0) {
+			weston_log_continue(
+				STAMP_SPACE
+				"warning: map to output %s failed... output not found\n",
+				device->output_name);
+		}
 	}
 
 	if (input->enabled == 1)
@@ -354,8 +367,15 @@ notify_output_create(struct wl_listener *listener, void *data)
 
 	wl_list_for_each(device, &seat->devices_list, link)
 		if (device->output_name &&
-		    strcmp(output->name, device->output_name) == 0)
+		    strcmp(output->name, device->output_name) == 0) {
 			device->output = output;
+			weston_log("%s\n", device->devname);
+			weston_log_continue(
+				STAMP_SPACE
+				"mapping to output: %s\n",
+				device->output->name);
+			break;
+		}
 }
 
 static struct udev_seat *
-- 
1.8.4.2



More information about the wayland-devel mailing list