lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 10 Mar 2011 16:52:25 +0100
From:	"Henrik Rydberg" <rydberg@...omail.se>
To:	Benjamin Tissoires <benjamin.tissoires@...c.fr>
Cc:	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	Jiri Kosina <jkosina@...e.cz>,
	Stephane Chatty <chatty@...-enac.fr>,
	linux-input@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 4/4] hid-multitouch: migrate 3M PCT touch screens to
 hid-multitouch

Hi Benjamin,

> diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
> index 02a77f9..0b92dfc 100644
> --- a/drivers/hid/hid-multitouch.c
> +++ b/drivers/hid/hid-multitouch.c
> @@ -5,6 +5,11 @@
>   *  Copyright (c) 2010-2011 Benjamin Tissoires <benjamin.tissoires@...il.com>
>   *  Copyright (c) 2010-2011 Ecole Nationale de l'Aviation Civile, France
>   *
> + *  based on hid-3m-pct.c copyrighted as follows:
> + *    Copyright (c) 2009-2010 Stephane Chatty <chatty@...c.fr>
> + *    Copyright (c) 2010      Henrik Rydberg <rydberg@...omail.se>
> + *    Copyright (c) 2010      Canonical, Ltd.
> + *
>   */
>  
>  /*
> @@ -62,6 +67,8 @@ struct mt_class {
>  	__s32 name;	/* MT_CLS */
>  	__s32 quirks;
>  	__s32 sn_move;	/* Signal/noise ratio for move events */
> +	__s32 sn_width;	/* Signal/noise ratio for width events */
> +	__s32 sn_height;	/* Signal/noise ratio for height events */
>  	__s32 sn_pressure;	/* Signal/noise ratio for pressure events */
>  	__u8 maxcontacts;
>  };
> @@ -72,6 +79,7 @@ struct mt_class {
>  #define MT_CLS_DUAL_INRANGE_CONTACTNUMBER	3
>  #define MT_CLS_CYPRESS				4
>  #define MT_CLS_STANTUM				5
> +#define MT_CLS_3M				6
>  
>  /*
>   * these device-dependent functions determine what slot corresponds
> @@ -123,6 +131,12 @@ struct mt_class mt_classes[] = {
>  		.maxcontacts = 10 },
>  	{ .name = MT_CLS_STANTUM,
>  		.quirks = MT_QUIRK_VALID_IS_CONFIDENCE },

I realize several of the entries are missing maxcontacts now, so all
patches needs to be checked...

> +	{ .name = MT_CLS_3M,
> +		.quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
> +			MT_QUIRK_SLOT_IS_CONTACTID,
> +		.sn_move = 2048,
> +		.sn_width = 128,
> +		.sn_height = 128 },

And this one does too
>  
>  	{ }
>  };
> @@ -206,11 +220,15 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
>  		case HID_DG_WIDTH:
>  			hid_map_usage(hi, usage, bit, max,
>  					EV_ABS, ABS_MT_TOUCH_MAJOR);
> +			set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field,
> +				cls->sn_width);
>  			td->last_slot_field = usage->hid;
>  			return 1;
>  		case HID_DG_HEIGHT:
>  			hid_map_usage(hi, usage, bit, max,
>  					EV_ABS, ABS_MT_TOUCH_MINOR);
> +			set_abs(hi->input, ABS_MT_TOUCH_MINOR, field,
> +				cls->sn_height);
>  			field->logical_maximum = 1;
>  			field->logical_minimum = 0;

These limits are not right - I doubt they are for any device.

>  			set_abs(hi->input, ABS_MT_ORIENTATION, field, 0);
> @@ -307,11 +325,18 @@ static void mt_emit_event(struct mt_device *td, struct input_dev *input)
>  		input_mt_report_slot_state(input, MT_TOOL_FINGER,
>  			s->touch_state);
>  		if (s->touch_state) {
> +			/* this finger is on the screen */
> +			int wide = (s->w > s->h);
> +			/* divided by two to match visual scale of touch */
> +			int major = max(s->w, s->h) >> 1;
> +			int minor = min(s->w, s->h) >> 1;
> +
>  			input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x);
>  			input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y);
> +			input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide);
>  			input_event(input, EV_ABS, ABS_MT_PRESSURE, s->p);
> -			input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, s->w);
> -			input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, s->h);
> +			input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major);
> +			input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor);
>  		}
>  		s->seen_in_this_frame = false;
>  
> @@ -481,6 +506,14 @@ static void mt_remove(struct hid_device *hdev)
>  
>  static const struct hid_device_id mt_devices[] = {
>  
> +	/* 3M panels */
> +	{ .driver_data = MT_CLS_3M,
> +		HID_USB_DEVICE(USB_VENDOR_ID_3M,
> +			USB_DEVICE_ID_3M1968) },
> +	{ .driver_data = MT_CLS_3M,
> +		HID_USB_DEVICE(USB_VENDOR_ID_3M,
> +			USB_DEVICE_ID_3M2256) },
> +
>  	/* Cando panels */
>  	{ .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
>  		HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
> -- 
> 1.7.4
> 

Also, this line needs to be added in case no feature reports are sent:

@@ -481,6 +481,7 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
 		return -ENOMEM;
 	}
 	td->mtclass = mtclass;
+	td->maxcontacts = mtclass->maxcontacts;
 	td->inputmode = -1;
 	hid_set_drvdata(hdev, td);
 
Thanks,
Henrik
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ