the attached patches make xsetwacom support the "get all" option now, not quite as nice in output as the old one (I suppose) since the error reporting is quite verbose. some more work is needed to make it shut up a bit better here.
can be tested with: xsetwacom --get -x "Wacom Intuos4 6x9" all Cheers, Peter
>From 4b9cf268dc5708e05a34d4ccc0b21da082500737 Mon Sep 17 00:00:00 2001 From: Peter Hutterer <[email protected]> Date: Thu, 17 Dec 2009 11:43:00 +1000 Subject: [PATCH 1/2] xsetwacom: split get() into get() and get_param(). This makes get_param() the same signature as the other, specific, get() functions and get() a simple wrapper around it. Signed-off-by: Peter Hutterer <[email protected]> --- tools/xsetwacom.c | 28 +++++++++++++++++----------- 1 files changed, 17 insertions(+), 11 deletions(-) diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c index 824ee3f..e973f96 100644 --- a/tools/xsetwacom.c +++ b/tools/xsetwacom.c @@ -76,6 +76,7 @@ static void get_rotate(Display *dpy, XDevice *dev, param_t *param, int argc, cha static void set_twinview(Display *dpy, XDevice *dev, param_t *param, int argc, char **argv); static void get_twinview(Display *dpy, XDevice *dev, param_t *param, int argc, char **argv); static void set_xydefault(Display *dpy, XDevice *dev, param_t *param, int argc, char **argv); +static void get_param(Display *dpy, XDevice *dev, param_t *param, int argc, char **argv); static void not_implemented(Display *dpy, XDevice *dev, param_t *param, int argc, char **argv) { printf("Not implemented.\n"); @@ -1786,10 +1787,6 @@ static void get(Display *dpy, enum printformat printformat, int argc, char **arg { param_t *param; XDevice *dev = NULL; - Atom prop, type; - int format; - unsigned char* data; - unsigned long nitems, bytes_after; TRACE("'get' requested for '%s'.\n", argv[0]); @@ -1810,17 +1807,29 @@ static void get(Display *dpy, enum printformat printformat, int argc, char **arg if (!param) { printf("Unknown parameter name '%s'.\n", argv[1]); - goto out; + return; } else { param->printformat = printformat; param->device_name = argv[0]; } + get_param(dpy, dev, param, argc - 2, &argv[2]); + + XCloseDevice(dpy, dev); +} + +static void get_param(Display *dpy, XDevice *dev, param_t *param, int argc, char **argv) +{ + Atom prop, type; + int format; + unsigned char* data; + unsigned long nitems, bytes_after; + if (param->get_func) { - param->get_func(dpy, dev, param, argc - 2, &argv[2]); - goto out; + param->get_func(dpy, dev, param, argc, argv); + return; } prop = XInternAtom(dpy, param->prop_name, True); @@ -1828,7 +1837,7 @@ static void get(Display *dpy, enum printformat printformat, int argc, char **arg { fprintf(stderr, "Property for '%s' not available.\n", param->name); - goto out; + return; } XGetDeviceProperty(dpy, dev, prop, 0, 1000, False, AnyPropertyType, @@ -1862,9 +1871,6 @@ static void get(Display *dpy, enum printformat printformat, int argc, char **arg break; } } - -out: - XCloseDevice(dpy, dev); } -- 1.6.5.2
>From d8f182519c5a4691ba78513bbe8c7cb707db4008 Mon Sep 17 00:00:00 2001 From: Peter Hutterer <[email protected]> Date: Thu, 17 Dec 2009 11:44:38 +1000 Subject: [PATCH 2/2] xsetwacom: add support for "xsetwacom --get <device> all" Signed-off-by: Peter Hutterer <[email protected]> --- tools/xsetwacom.c | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c index e973f96..dba054b 100644 --- a/tools/xsetwacom.c +++ b/tools/xsetwacom.c @@ -76,6 +76,7 @@ static void get_rotate(Display *dpy, XDevice *dev, param_t *param, int argc, cha static void set_twinview(Display *dpy, XDevice *dev, param_t *param, int argc, char **argv); static void get_twinview(Display *dpy, XDevice *dev, param_t *param, int argc, char **argv); static void set_xydefault(Display *dpy, XDevice *dev, param_t *param, int argc, char **argv); +static void get_all(Display *dpy, XDevice *dev, param_t *param, int argc, char **argv); static void get_param(Display *dpy, XDevice *dev, param_t *param, int argc, char **argv); static void not_implemented(Display *dpy, XDevice *dev, param_t *param, int argc, char **argv) { @@ -776,6 +777,12 @@ static param_t parameters[] = .set_func = not_implemented, .get_func = not_implemented, }, + { + .name = "all", + .desc = "Get value for all parameters.", + .set_func = not_implemented, + .get_func = get_all, + }, { NULL } }; @@ -1783,6 +1790,22 @@ static void get_button(Display *dpy, XDevice *dev, param_t *param, int argc, XFlush(dpy); } +static void get_all(Display *dpy, XDevice *dev, param_t *param, int argc, char **argv) +{ + param_t *p = parameters; + + while(p->name) + { + if (p != param) + { + p->device_name = param->device_name; + p->printformat = param->printformat; + get_param(dpy, dev, p, argc, argv); + } + p++; + } +} + static void get(Display *dpy, enum printformat printformat, int argc, char **argv) { param_t *param; -- 1.6.5.2
------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________ Linuxwacom-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
