--- xf86-input-synaptics-1.2.0/tools/synclient.c.mode-apply-all 2009-08-21 11:11:56.000000000 +0200 +++ xf86-input-synaptics-1.2.0/tools/synclient.c 2009-11-10 18:58:29.000000000 +0100 @@ -155,9 +155,9 @@ parse_cmd(char* cmd, struct Parameter** if (eqp) { int j; int found = 0; - *eqp = 0; + size_t size = (eqp - cmd); for (j = 0; params[j].name; j++) { - if (strcasecmp(cmd, params[j].name) == 0) { + if (strncasecmp(cmd, params[j].name, size) == 0) { found = 1; break; } @@ -343,7 +343,7 @@ unwind: } static XDevice * -dp_get_device(Display *dpy) +dp_get_device(Display *dpy, int idx) { XDevice* dev = NULL; XDeviceInfo *info = NULL; @@ -353,6 +353,7 @@ dp_get_device(Display *dpy) Atom *properties = NULL; int nprops = 0; int error = 0; + int showfinalerror = (idx < 1); touchpad_type = XInternAtom(dpy, XI_TOUCHPAD, True); synaptics_property = XInternAtom(dpy, SYNAPTICS_PROP_EDGES, True); @@ -360,6 +361,10 @@ dp_get_device(Display *dpy) while(ndevices--) { if (info[ndevices].type == touchpad_type) { + if (idx > 0) { + --idx; + continue; + } dev = XOpenDevice(dpy, info[ndevices].id); if (!dev) { fprintf(stderr, "Failed to open device '%s'.\n", @@ -398,7 +403,8 @@ unwind: XFree(properties); XFreeDeviceList(info); if (!dev) - fprintf(stderr, "Unable to find a synaptics device.\n"); + if (showfinalerror) + fprintf(stderr, "Unable to find a synaptics device.\n"); else if (error && dev) { XCloseDevice(dpy, dev); @@ -577,6 +583,7 @@ main(int argc, char *argv[]) int do_monitor = 0; int dump_settings = 0; int first_cmd; + int idx = 0; Display *dpy; XDevice *dev; @@ -609,14 +616,33 @@ main(int argc, char *argv[]) shm_process_commands(do_monitor, delay); dpy = dp_init(); - if (!dpy || !(dev = dp_get_device(dpy))) + if (!dpy) return 1; - dp_set_variables(dpy, dev, argc, argv, first_cmd); - if (dump_settings) - dp_show_settings(dpy, dev); + /* Apply the settings changes to all synaptics devices */ + while ((dev = dp_get_device(dpy, idx++))) { + dp_set_variables(dpy, dev, argc, argv, first_cmd); + XCloseDevice(dpy, dev); + } + + /* If we didn't open any devices just return. */ + if (idx < 2) { + XCloseDisplay(dpy); + return 1; + } + + if (dump_settings) { + /* Reopen the last one we found to print it out... + This is not really ideal, but it'll do to allow the basic tools to continue */ + dev = dp_get_device(dpy, (idx - 2)); + if (!dev) { + XCloseDisplay(dpy); + return 1; + } - XCloseDevice(dpy, dev); + dp_show_settings(dpy, dev); + XCloseDevice(dpy, dev); + } XCloseDisplay(dpy); return 0;