On Wed, 2012-04-18 at 14:57 +1000, Peter Hutterer wrote: > Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
Signed-off-by: Bastien Nocera <had...@hadess.net> > --- > data/generate-udev-rules.c | 104 ++++++++++++++++----------------- > test/load.c | 138 > ++++++++++++++++++++++---------------------- > 2 files changed, 121 insertions(+), 121 deletions(-) > > diff --git a/data/generate-udev-rules.c b/data/generate-udev-rules.c > index 93f7bba..d6a40ad 100644 > --- a/data/generate-udev-rules.c > +++ b/data/generate-udev-rules.c > @@ -34,81 +34,81 @@ > > static void print_udev_header (void) > { > - printf ("# udev rules for libwacom supported devices\n"); > - printf ("\n"); > - printf ("ACTION!=\"add|change\", GOTO=\"libwacom_end\"\n"); > - printf ("KERNEL!=\"event[0-9]*\", GOTO=\"libwacom_end\"\n"); > - printf ("\n"); > + printf ("# udev rules for libwacom supported devices\n"); > + printf ("\n"); > + printf ("ACTION!=\"add|change\", GOTO=\"libwacom_end\"\n"); > + printf ("KERNEL!=\"event[0-9]*\", GOTO=\"libwacom_end\"\n"); > + printf ("\n"); > } > > static void print_udev_entry_for_match (WacomDevice *device, const > WacomMatch *match) > { > - WacomBusType type = libwacom_match_get_bustype (match); > - int vendor = libwacom_match_get_vendor_id (match); > - int product = libwacom_match_get_product_id (match); > - int has_touch = libwacom_has_touch (device); > - static char *touchpad; > - > - if (has_touch) > - touchpad = ", ENV{ID_INPUT_TOUCHPAD}=\"1\""; > - else > - touchpad = ""; > - > - switch (type) { > - case WBUSTYPE_USB: > - printf ("ENV{ID_BUS}==\"usb\", ENV{ID_VENDOR_ID}==\"%04x\", > ENV{ID_MODEL_ID}==\"%04x\", ENV{ID_INPUT}=\"1\", > ENV{ID_INPUT_TABLET}=\"1\"%s\n", vendor, product, touchpad); > - break; > - case WBUSTYPE_BLUETOOTH: > - printf ("ENV{ID_BUS}==\"bluetooth\", > ENV{ID_VENDOR_ID}==\"%04x\", ENV{ID_MODEL_ID}==\"%04x\", ENV{ID_INPUT}=\"1\", > ENV{ID_INPUT_TABLET}=\"1\"%s\n", vendor, product, touchpad); > - break; > - default: > - /* Not sure how to deal with serials */ > - break; > - } > + WacomBusType type = libwacom_match_get_bustype (match); > + int vendor = libwacom_match_get_vendor_id (match); > + int product = libwacom_match_get_product_id (match); > + int has_touch = libwacom_has_touch (device); > + static char *touchpad; > + > + if (has_touch) > + touchpad = ", ENV{ID_INPUT_TOUCHPAD}=\"1\""; > + else > + touchpad = ""; > + > + switch (type) { > + case WBUSTYPE_USB: > + printf ("ENV{ID_BUS}==\"usb\", > ENV{ID_VENDOR_ID}==\"%04x\", ENV{ID_MODEL_ID}==\"%04x\", ENV{ID_INPUT}=\"1\", > ENV{ID_INPUT_TABLET}=\"1\"%s\n", vendor, product, touchpad); > + break; > + case WBUSTYPE_BLUETOOTH: > + printf ("ENV{ID_BUS}==\"bluetooth\", > ENV{ID_VENDOR_ID}==\"%04x\", ENV{ID_MODEL_ID}==\"%04x\", ENV{ID_INPUT}=\"1\", > ENV{ID_INPUT_TABLET}=\"1\"%s\n", vendor, product, touchpad); > + break; > + default: > + /* Not sure how to deal with serials */ > + break; > + } > } > > static void print_udev_entry (WacomDevice *device) > { > - WacomMatch **matches; > - int nmatches; > + WacomMatch **matches; > + int nmatches; > > - matches = libwacom_get_matches(device, &nmatches); > - while(nmatches--) > - print_udev_entry_for_match(device, matches[nmatches]); > + matches = libwacom_get_matches(device, &nmatches); > + while(nmatches--) > + print_udev_entry_for_match(device, matches[nmatches]); > } > > static void print_udev_trailer (void) > { > - printf ("\n"); > - printf ("# Match all serial wacom tablets with a serial ID starting with > WACf\n"); > - printf ("ENV{ID_BUS}==\"tty|pnp\", ATTRS{id}==\"WACf*\", > ENV{ID_INPUT}=\"1\", ENV{ID_INPUT_TABLET}=\"1\"\n"); > - printf ("ENV{ID_BUS}==\"tty|pnp\", ATTRS{id}==\"FUJ*\", > ENV{ID_INPUT}=\"1\", ENV{ID_INPUT_TABLET}=\"1\"\n"); > - printf ("\n"); > - printf ("LABEL=\"libwacom_end\"\n"); > + printf ("\n"); > + printf ("# Match all serial wacom tablets with a serial ID starting > with WACf\n"); > + printf ("ENV{ID_BUS}==\"tty|pnp\", ATTRS{id}==\"WACf*\", > ENV{ID_INPUT}=\"1\", ENV{ID_INPUT_TABLET}=\"1\"\n"); > + printf ("ENV{ID_BUS}==\"tty|pnp\", ATTRS{id}==\"FUJ*\", > ENV{ID_INPUT}=\"1\", ENV{ID_INPUT_TABLET}=\"1\"\n"); > + printf ("\n"); > + printf ("LABEL=\"libwacom_end\"\n"); > } > > > int main(int argc, char **argv) > { > - WacomDeviceDatabase *db; > - WacomDevice **list, **p; > + WacomDeviceDatabase *db; > + WacomDevice **list, **p; > > - db = libwacom_database_new_for_path(TOPSRCDIR"/data"); > + db = libwacom_database_new_for_path(TOPSRCDIR"/data"); > > - list = libwacom_list_devices_from_database(db, NULL); > - if (!list) { > - fprintf(stderr, "Failed to load device database.\n"); > - return 1; > - } > + list = libwacom_list_devices_from_database(db, NULL); > + if (!list) { > + fprintf(stderr, "Failed to load device database.\n"); > + return 1; > + } > > - print_udev_header (); > - for (p = list; *p; p++) > - print_udev_entry ((WacomDevice *) *p); > - print_udev_trailer (); > + print_udev_header (); > + for (p = list; *p; p++) > + print_udev_entry ((WacomDevice *) *p); > + print_udev_trailer (); > > - libwacom_database_destroy (db); > + libwacom_database_destroy (db); > > - return 0; > + return 0; > } > > /* vim: set noexpandtab tabstop=8 shiftwidth=8: */ > diff --git a/test/load.c b/test/load.c > index ff4c85f..4af9188 100644 > --- a/test/load.c > +++ b/test/load.c > @@ -35,95 +35,95 @@ > > static void check_multiple_match(WacomDevice *device) > { > - WacomMatch **matches; > - int nmatches; > - int found_bus = 0, > - found_vendor_id = 0, > - found_product_id = 0; > - > - matches = libwacom_get_matches(device, &nmatches); > - assert(nmatches == 2); > - while(nmatches--) > - { > - if (libwacom_match_get_bustype(matches[nmatches]) == > libwacom_get_bustype(device)) > - found_bus = 1; > - if (libwacom_match_get_vendor_id(matches[nmatches]) == > libwacom_get_vendor_id(device)) > - found_vendor_id = 1; > - if (libwacom_match_get_product_id(matches[nmatches]) == > libwacom_get_product_id(device)) > - found_product_id = 1; > - } > - > - assert(found_bus && found_vendor_id && found_product_id); > + WacomMatch **matches; > + int nmatches; > + int found_bus = 0, > + found_vendor_id = 0, > + found_product_id = 0; > + > + matches = libwacom_get_matches(device, &nmatches); > + assert(nmatches == 2); > + while(nmatches--) > + { > + if (libwacom_match_get_bustype(matches[nmatches]) == > libwacom_get_bustype(device)) > + found_bus = 1; > + if (libwacom_match_get_vendor_id(matches[nmatches]) == > libwacom_get_vendor_id(device)) > + found_vendor_id = 1; > + if (libwacom_match_get_product_id(matches[nmatches]) == > libwacom_get_product_id(device)) > + found_product_id = 1; > + } > + > + assert(found_bus && found_vendor_id && found_product_id); > } > > int main(int argc, char **argv) > { > - WacomDeviceDatabase *db; > - WacomDevice *device; > - const char *str; > + WacomDeviceDatabase *db; > + WacomDevice *device; > + const char *str; > > - db = libwacom_database_new_for_path(TOPSRCDIR"/data"); > - if (!db) > - printf("Failed to load data from %s", TOPSRCDIR"/data"); > - assert(db); > + db = libwacom_database_new_for_path(TOPSRCDIR"/data"); > + if (!db) > + printf("Failed to load data from %s", TOPSRCDIR"/data"); > + assert(db); > > - device = libwacom_new_from_usbid(db, 0, 0, NULL); > - assert(!device); > + device = libwacom_new_from_usbid(db, 0, 0, NULL); > + assert(!device); > > - device = libwacom_new_from_usbid(db, 0x56a, 0x00bc, NULL); > - assert(device); > + device = libwacom_new_from_usbid(db, 0x56a, 0x00bc, NULL); > + assert(device); > > - str = libwacom_get_name(device); > - assert(strcmp(str, "Wacom Intuos4 WL") == 0); > - assert(libwacom_get_class(device) == WCLASS_INTUOS4); > - assert(libwacom_get_vendor_id(device) == 0x56a); > - assert(libwacom_get_product_id(device) == 0xbc); > - assert(libwacom_get_bustype(device) == WBUSTYPE_USB); > - assert(libwacom_get_num_buttons(device) == 9); > - assert(libwacom_has_stylus(device)); > - assert(libwacom_is_reversible(device)); > - assert(!libwacom_has_touch(device)); > - assert(libwacom_has_ring(device)); > - assert(!libwacom_has_ring2(device)); > - assert(libwacom_get_num_strips(device) == 0); > - assert(!libwacom_is_builtin(device)); > - assert(libwacom_get_width(device) == 8); > - assert(libwacom_get_height(device) == 5); > + str = libwacom_get_name(device); > + assert(strcmp(str, "Wacom Intuos4 WL") == 0); > + assert(libwacom_get_class(device) == WCLASS_INTUOS4); > + assert(libwacom_get_vendor_id(device) == 0x56a); > + assert(libwacom_get_product_id(device) == 0xbc); > + assert(libwacom_get_bustype(device) == WBUSTYPE_USB); > + assert(libwacom_get_num_buttons(device) == 9); > + assert(libwacom_has_stylus(device)); > + assert(libwacom_is_reversible(device)); > + assert(!libwacom_has_touch(device)); > + assert(libwacom_has_ring(device)); > + assert(!libwacom_has_ring2(device)); > + assert(libwacom_get_num_strips(device) == 0); > + assert(!libwacom_is_builtin(device)); > + assert(libwacom_get_width(device) == 8); > + assert(libwacom_get_height(device) == 5); > > - /* I4 WL has two matches */ > - check_multiple_match(device); > + /* I4 WL has two matches */ > + check_multiple_match(device); > > - libwacom_destroy(device); > + libwacom_destroy(device); > > - device = libwacom_new_from_usbid(db, 0x56a, 0x00b9, NULL); > - assert(device); > + device = libwacom_new_from_usbid(db, 0x56a, 0x00b9, NULL); > + assert(device); > > - assert(libwacom_get_button_flag(device, 'A') & > WACOM_BUTTON_RING_MODESWITCH); > - assert(libwacom_get_button_flag(device, 'I') & WACOM_BUTTON_OLED); > - assert(libwacom_get_button_flag(device, 'J') == WACOM_BUTTON_NONE); > - assert(libwacom_get_ring_num_modes(device) == 4); > + assert(libwacom_get_button_flag(device, 'A') & > WACOM_BUTTON_RING_MODESWITCH); > + assert(libwacom_get_button_flag(device, 'I') & WACOM_BUTTON_OLED); > + assert(libwacom_get_button_flag(device, 'J') == WACOM_BUTTON_NONE); > + assert(libwacom_get_ring_num_modes(device) == 4); > > - libwacom_destroy(device); > + libwacom_destroy(device); > > - device = libwacom_new_from_usbid(db, 0x56a, 0x00f4, NULL); > - assert(device); > + device = libwacom_new_from_usbid(db, 0x56a, 0x00f4, NULL); > + assert(device); > > - assert(libwacom_get_ring_num_modes(device) == 3); > - assert(libwacom_get_ring2_num_modes(device) == 3); > + assert(libwacom_get_ring_num_modes(device) == 3); > + assert(libwacom_get_ring2_num_modes(device) == 3); > > - libwacom_destroy(device); > + libwacom_destroy(device); > > - device = libwacom_new_from_usbid(db, 0x056a, 0x00cc, NULL); > - assert(libwacom_get_num_strips(device) == 2); > - libwacom_destroy(device); > + device = libwacom_new_from_usbid(db, 0x056a, 0x00cc, NULL); > + assert(libwacom_get_num_strips(device) == 2); > + libwacom_destroy(device); > > - device = libwacom_new_from_name(db, "Wacom Serial Tablet WACf004", NULL); > - assert(device); > - assert(libwacom_is_builtin(device)); > + device = libwacom_new_from_name(db, "Wacom Serial Tablet WACf004", > NULL); > + assert(device); > + assert(libwacom_is_builtin(device)); > > - libwacom_database_destroy (db); > + libwacom_database_destroy (db); > > - return 0; > + return 0; > } > > /* vim: set noexpandtab tabstop=8 shiftwidth=8: */ ------------------------------------------------------------------------------ Better than sec? Nothing is better than sec when it comes to monitoring Big Data applications. Try Boundary one-second resolution app monitoring today. Free. http://p.sf.net/sfu/Boundary-dev2dev _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel