コード例 #1
0
static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_features *features)
{
	unsigned char *rep_data;
	int limit = 0, report_id = 2;
	int error = -ENOMEM;

	rep_data = kmalloc(4, GFP_KERNEL);
	if (!rep_data)
		return error;

	/* ask to report Wacom data */
	if (features->device_type == BTN_TOOL_FINGER) {
		/* if it is an MT Tablet PC touch */
		if (features->type > TABLETPC) {
			do {
				rep_data[0] = 3;
				rep_data[1] = 4;
				rep_data[2] = 0;
				rep_data[3] = 0;
				report_id = 3;
				error = wacom_set_report(intf,
							 WAC_HID_FEATURE_REPORT,
							 report_id,
							 rep_data, 4, 1);
				if (error >= 0)
					error = wacom_get_report(intf,
							WAC_HID_FEATURE_REPORT,
							report_id,
							rep_data, 4, 1);
			} while ((error < 0 || rep_data[1] != 4) &&
				 limit++ < WAC_MSG_RETRIES);
		}
	} else if (features->type <= BAMBOO_PT &&
		   features->type != WIRELESS &&
		   features->device_type == BTN_TOOL_PEN) {
		do {
			rep_data[0] = 2;
			rep_data[1] = 2;
			error = wacom_set_report(intf, WAC_HID_FEATURE_REPORT,
						 report_id, rep_data, 2, 1);
			if (error >= 0)
				error = wacom_get_report(intf,
						WAC_HID_FEATURE_REPORT,
						report_id, rep_data, 2, 1);
		} while ((error < 0 || rep_data[1] != 2) && limit++ < WAC_MSG_RETRIES);
	}

	kfree(rep_data);

	return error < 0 ? error : 0;
}
コード例 #2
0
ファイル: wacom_sys.c プロジェクト: daveti/prov-kernel
static int wacom_query_tablet_data(struct usb_interface *intf)
{
	unsigned char *rep_data;
	int limit = 0;
	int error;

	rep_data = kmalloc(2, GFP_KERNEL);
	if (!rep_data)
		return -ENOMEM;

	do {
		rep_data[0] = 2;
		rep_data[1] = 2;
		error = wacom_set_report(intf, WAC_HID_FEATURE_REPORT,
					2, rep_data, 2, 1);
		if (error >= 0)
			error = wacom_get_report(intf,
						WAC_HID_FEATURE_REPORT, 2,
						rep_data, 2, 1);
	} while ((error < 0 || rep_data[1] != 2) && limit++ < 5);

	kfree(rep_data);

	return error < 0 ? error : 0;
}
コード例 #3
0
ファイル: wacom_sys.c プロジェクト: 71eh/open80211s
static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_features *features)
{
	unsigned char *rep_data;
	int limit = 0, report_id = 2;
	int error = -ENOMEM;

	rep_data = kmalloc(4, GFP_KERNEL);
	if (!rep_data)
		return error;

	/* ask to report tablet data if it is MT Tablet PC or
	 * not a Tablet PC */
	if (features->type == TABLETPC2FG) {
		do {
			rep_data[0] = 3;
			rep_data[1] = 4;
			rep_data[2] = 0;
			rep_data[3] = 0;
			report_id = 3;
			error = wacom_set_report(intf, WAC_HID_FEATURE_REPORT,
						 report_id, rep_data, 4, 1);
			if (error >= 0)
				error = wacom_get_report(intf,
						WAC_HID_FEATURE_REPORT,
						report_id, rep_data, 4, 1);
		} while ((error < 0 || rep_data[1] != 4) && limit++ < WAC_MSG_RETRIES);
	} else if (features->type != TABLETPC) {
		do {
			rep_data[0] = 2;
			rep_data[1] = 2;
			error = wacom_set_report(intf, WAC_HID_FEATURE_REPORT,
						 report_id, rep_data, 2, 1);
			if (error >= 0)
				error = wacom_get_report(intf,
						WAC_HID_FEATURE_REPORT,
						report_id, rep_data, 2, 1);
		} while ((error < 0 || rep_data[1] != 2) && limit++ < WAC_MSG_RETRIES);
	}

	kfree(rep_data);

	return error < 0 ? error : 0;
}
コード例 #4
0
ファイル: wacom_sys.c プロジェクト: Astralix/mainline-dss11
static void wacom_retrieve_report_data(struct usb_interface *intf,
				       struct wacom_features *features)
{
	int result = 0;
	unsigned char *rep_data;

	rep_data = kmalloc(2, GFP_KERNEL);
	if (rep_data) {

		rep_data[0] = 12;
		result = wacom_get_report(intf, WAC_HID_FEATURE_REPORT,
					  rep_data[0], rep_data, 2,
					  WAC_MSG_RETRIES);

		if (result >= 0 && rep_data[1] > 2)
			features->touch_max = rep_data[1];

		kfree(rep_data);
	}
}
コード例 #5
0
ファイル: wacom_sys.c プロジェクト: ManCheol/kernel
static int wacom_set_device_mode(struct usb_interface *intf, int report_id, int length, int mode)
{
	unsigned char *rep_data;
	int error = -ENOMEM, limit = 0;

	rep_data = kzalloc(length, GFP_KERNEL);
	if (!rep_data)
		return error;

	do {
		rep_data[0] = report_id;
		rep_data[1] = mode;

		error = wacom_set_report(intf, WAC_HID_FEATURE_REPORT,
		                         report_id, rep_data, length, 1);
		if (error >= 0)
			error = wacom_get_report(intf, WAC_HID_FEATURE_REPORT,
			                         report_id, rep_data, length, 1);
	} while ((error < 0 || rep_data[1] != mode) && limit++ < WAC_MSG_RETRIES);

	kfree(rep_data);

	return error < 0 ? error : 0;
}