The patch looks good but although it looks as intended in the shell's output, it's not really writing things in the expected order. The issue is that you're using STDOUT_FILENO to print the devices' configuration but you're printing the separator ('----'...) to stdout and although this would be essencially the same, the latter will be put at the end of the buffer (you can check this out by redirecting the output to a file).
Replacing "fprintf(stdout," with "dprintf(STDOUT_FILENO," will fix it ;) Cheers, -- Joaquim Rocha http://www.joaquimrocha.com ----- Original Message ----- From: "Peter Hutterer" <peter.hutte...@who-t.net> To: linuxwacom-devel@lists.sourceforge.net Cc: jro...@redhat.com Sent: Friday, April 26, 2013 1:39:55 AM Subject: [PATCH libwacom] tools: use stdout for printing, not stdin Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> Reported-by: Joaquim Rocha <jro...@redhat.com> --- oops. tools/list-devices.c | 3 ++- tools/list-local-devices.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/list-devices.c b/tools/list-devices.c index 4a96434..79d13e8 100644 --- a/tools/list-devices.c +++ b/tools/list-devices.c @@ -31,6 +31,7 @@ #include <stdio.h> #include <string.h> #include <assert.h> +#include <unistd.h> #include "libwacom.h" static void print_device_info (WacomDevice *device, WacomBusType bus_type_filter) @@ -40,7 +41,7 @@ static void print_device_info (WacomDevice *device, WacomBusType bus_type_filter for (match = libwacom_get_matches(device); *match; match++) { WacomBusType type = libwacom_match_get_bustype(*match); if (type != bus_type_filter) - libwacom_print_device_description(0, device); + libwacom_print_device_description(STDOUT_FILENO, device); } } diff --git a/tools/list-local-devices.c b/tools/list-local-devices.c index 17cd28c..b6e5b89 100644 --- a/tools/list-local-devices.c +++ b/tools/list-local-devices.c @@ -31,6 +31,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <unistd.h> #include <assert.h> #include <dirent.h> #include <glib/gi18n.h> @@ -98,7 +99,7 @@ int main(int argc, char **argv) dev = libwacom_new_from_path(db, fname, WFALLBACK_NONE, NULL); if (!dev) continue; - libwacom_print_device_description(0, dev); + libwacom_print_device_description(STDOUT_FILENO, dev); libwacom_destroy(dev); fprintf(stdout, "---------------------------------------------------------------\n"); -- 1.8.1.4 ------------------------------------------------------------------------------ Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel