예제 #1
0
static gint
clutter_input_device_xi2_get_group_n_modes (ClutterInputDevice *device,
                                            gint                group)
{
#ifdef HAVE_LIBWACOM
  ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (device);

  if (device_xi2->wacom_device)
    {
      if (group == 0)
        {
          if (libwacom_has_ring (device_xi2->wacom_device))
            return libwacom_get_ring_num_modes (device_xi2->wacom_device);
          else if (libwacom_get_num_strips (device_xi2->wacom_device) >= 1)
            return libwacom_get_strips_num_modes (device_xi2->wacom_device);
        }
      else if (group == 1)
        {
          if (libwacom_has_ring2 (device_xi2->wacom_device))
            return libwacom_get_ring2_num_modes (device_xi2->wacom_device);
          else if (libwacom_get_num_strips (device_xi2->wacom_device) >= 2)
            return libwacom_get_strips_num_modes (device_xi2->wacom_device);
        }
    }
#endif

  return -1;
}
예제 #2
0
void
libwacom_print_device_description(int fd, const WacomDevice *device)
{
	const WacomMatch **match;
	WacomClass class;
	const char *class_name;

	class  = libwacom_get_class(device);
	switch(class) {
		case WCLASS_UNKNOWN:	class_name = "Unknown";	break;
		case WCLASS_INTUOS3:	class_name = "Intuos3";	break;
		case WCLASS_INTUOS4:	class_name = "Intuos4";	break;
		case WCLASS_INTUOS5:	class_name = "Intuos5";	break;
		case WCLASS_CINTIQ:	class_name = "Cintiq";	break;
		case WCLASS_BAMBOO:	class_name = "Bamboo";	break;
		case WCLASS_GRAPHIRE:	class_name = "Graphire";break;
		case WCLASS_ISDV4:	class_name = "ISDV4";	break;
		case WCLASS_INTUOS:	class_name = "Intuos";	break;
		case WCLASS_INTUOS2:	class_name = "Intuos2";	break;
		case WCLASS_PEN_DISPLAYS:	class_name = "PenDisplay";	break;
		case WCLASS_REMOTE:	class_name = "Remote";	break;
		default:		g_assert_not_reached(); break;
	}

	dprintf(fd, "[Device]\n");
	dprintf(fd, "Name=%s\n", libwacom_get_name(device));
	dprintf(fd, "DeviceMatch=");
	for (match = libwacom_get_matches(device); *match; match++)
		print_match(fd, *match);
	dprintf(fd, "\n");

	if (libwacom_get_paired_device(device)) {
		dprintf(fd, "PairedID=");
		print_match(fd, libwacom_get_paired_device(device));
		dprintf(fd, "\n");
	}

	dprintf(fd, "Class=%s\n",		class_name);
	dprintf(fd, "Width=%d\n",		libwacom_get_width(device));
	dprintf(fd, "Height=%d\n",		libwacom_get_height(device));
	print_integrated_flags_for_device(fd, device);
	print_layout_for_device(fd, device);
	print_styli_for_device(fd, device);
	dprintf(fd, "\n");

	dprintf(fd, "[Features]\n");
	dprintf(fd, "Reversible=%s\n", libwacom_is_reversible(device)	? "true" : "false");
	dprintf(fd, "Stylus=%s\n",	 libwacom_has_stylus(device)	? "true" : "false");
	dprintf(fd, "Ring=%s\n",	 libwacom_has_ring(device)	? "true" : "false");
	dprintf(fd, "Ring2=%s\n",	 libwacom_has_ring2(device)	? "true" : "false");
	dprintf(fd, "Touch=%s\n",	 libwacom_has_touch(device)	? "true" : "false");
	dprintf(fd, "TouchSwitch=%s\n",	libwacom_has_touchswitch(device)? "true" : "false");
	print_supported_leds(fd, device);

	dprintf(fd, "NumStrips=%d\n",	libwacom_get_num_strips(device));
	dprintf(fd, "Buttons=%d\n",		libwacom_get_num_buttons(device));

	print_buttons_for_device(fd, device);
}
예제 #3
0
파일: load.c 프로젝트: linuxwacom/libwacom
int main(int argc, char **argv)
{
	WacomDeviceDatabase *db;
	WacomDevice *device;
	const WacomMatch *match;
	const char *str;

	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, 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_has_touchswitch(device));
	assert(libwacom_get_num_strips(device) == 0);
	assert(libwacom_get_integration_flags (device) == WACOM_DEVICE_INTEGRATED_NONE);
	assert(libwacom_get_width(device) == 8);
	assert(libwacom_get_height(device) == 5);

	/* I4 WL has two matches */
	check_multiple_match(device);

	libwacom_destroy(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);
	/*
	 * I4 WL has only 9 buttons, asking for a 10th button will raise a warning
	 * in libwacom_get_button_flag() which is expected.
	 */
	printf("Following critical warning in libwacom_get_button_flag() is expected\n");
	assert(libwacom_get_button_flag(device, 'J') == WACOM_BUTTON_NONE);
	assert(libwacom_get_ring_num_modes(device) == 4);

	libwacom_destroy(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);

	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_get_integration_flags (device) & WACOM_DEVICE_INTEGRATED_DISPLAY);
	assert(libwacom_get_integration_flags (device) & WACOM_DEVICE_INTEGRATED_SYSTEM);
	libwacom_destroy(device);

	/* 24HDT has one paired device */
	device = libwacom_new_from_usbid(db, 0x56a, 0x00f8, NULL);
	assert(device);

	match = libwacom_get_paired_device(device);
	assert(match != NULL);
	assert(libwacom_match_get_vendor_id(match) == 0x56a);
	assert(libwacom_match_get_product_id(match) == 0xf6);
	assert(libwacom_match_get_bustype(match) == WBUSTYPE_USB);

	libwacom_database_destroy (db);
	return 0;
}