Linux Input/HID development
 help / color / mirror / Atom feed
* [PATCH] input: wacom - make sure touch_max is set for touch devices
From: Ping Cheng @ 2013-10-17  0:06 UTC (permalink / raw)
  To: linux-input; +Cc: dmitry.torokhov, killertofu, Ping Cheng

Old single touch Tablet PCs do not have touch_max set at
wacom_features. Since touch device at lease supports one
finger, assign touch_max to 1 when touch usage is defined
in its HID Descriptor and touch_max is not pre-defined.

Signed-off-by: Ping Cheng <pingc@wacom.com>

--
This patch is based on last posted (unmerged) patch:

 "add support for three new Intuos devices"
---
 drivers/input/tablet/wacom_sys.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index 81d5910..28066bc 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -304,7 +304,7 @@ static int wacom_parse_hid(struct usb_interface *intf,
 	struct usb_device *dev = interface_to_usbdev(intf);
 	char limit = 0;
 	/* result has to be defined as int for some devices */
-	int result = 0;
+	int result = 0, touch_max = 0;
 	int i = 0, usage = WCM_UNDEFINED, finger = 0, pen = 0;
 	unsigned char *report;
 
@@ -351,7 +351,8 @@ static int wacom_parse_hid(struct usb_interface *intf,
 				if (usage == WCM_DESKTOP) {
 					if (finger) {
 						features->device_type = BTN_TOOL_FINGER;
-
+						/* touch device at least supports one touch point */
+						touch_max = 1;
 						switch (features->type) {
 						case TABLETPC2FG:
 							features->pktlen = WACOM_PKGLEN_TPC2FG;
@@ -504,6 +505,8 @@ static int wacom_parse_hid(struct usb_interface *intf,
 	}
 
  out:
+	if (!features->touch_max && touch_max)
+		features->touch_max = touch_max;
 	result = 0;
 	kfree(report);
 	return result;
-- 
1.8.1.2


^ permalink raw reply related

* Re: [PATCH v2] drivers: input: mouse: Remove useless casting in cypress_ps2.c
From: Geyslan Gregório Bem @ 2013-10-16 22:53 UTC (permalink / raw)
  To: Joe Perches
  Cc: dmitry.torokhov, dudl, kamal, mario_limonciello, git, linux-input,
	LKML, kernel-br
In-Reply-To: <1381963198.22110.73.camel@joe-AO722>

2013/10/16 Joe Perches <joe@perches.com>:
> On Wed, 2013-10-16 at 19:31 -0300, Geyslan G. Bem wrote:
>> Get rid of unnecessary (void *) casting in 'cypress_init' function.
> []
>> diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c
> []
>> @@ -680,7 +680,7 @@ int cypress_init(struct psmouse *psmouse)
>>       struct cytp_data *cytp;
>>
>>       cytp = (struct cytp_data *)kzalloc(sizeof(struct cytp_data), GFP_KERNEL);
>> -     psmouse->private = (void *)cytp;
>> +     psmouse->private = cytp;
>
> If you are going to remove useless casts, please
> also remove the unnecessary kzalloc cast too.
>
>

Joe, thanks for reply. Actually I did it and receive this reply from Dmitry:

       struct cytp_data *cytp;

 -     cytp = (struct cytp_data *)kzalloc(sizeof(struct cytp_data), GFP_KERNEL);
 +     cytp = kzalloc(sizeof(struct cytp_data), GFP_KERNEL);

I already have a patch for this from Jingoo Han in my queue.

       psmouse->private = (void *)cytp;

But this cast is also not needed, so if you could send me a patch for it
I'd appreciate that.

^ permalink raw reply

* Re: [PATCH v2] drivers: input: mouse: Remove useless casting in cypress_ps2.c
From: Joe Perches @ 2013-10-16 22:39 UTC (permalink / raw)
  To: Geyslan G. Bem
  Cc: dmitry.torokhov, dudl, kamal, mario_limonciello, git, linux-input,
	linux-kernel, kernel-br
In-Reply-To: <1381962675-26876-1-git-send-email-geyslan@gmail.com>

On Wed, 2013-10-16 at 19:31 -0300, Geyslan G. Bem wrote:
> Get rid of unnecessary (void *) casting in 'cypress_init' function.
[]
> diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c
[]
> @@ -680,7 +680,7 @@ int cypress_init(struct psmouse *psmouse)
>  	struct cytp_data *cytp;
>  
>  	cytp = (struct cytp_data *)kzalloc(sizeof(struct cytp_data), GFP_KERNEL);
> -	psmouse->private = (void *)cytp;
> +	psmouse->private = cytp;

If you are going to remove useless casts, please
also remove the unnecessary kzalloc cast too.

^ permalink raw reply

* [PATCH v2] drivers: input: mouse: Remove useless casting in cypress_ps2.c
From: Geyslan G. Bem @ 2013-10-16 22:31 UTC (permalink / raw)
  To: dmitry.torokhov
  Cc: dudl, kamal, mario_limonciello, git, linux-input, linux-kernel,
	kernel-br, Geyslan G. Bem

Get rid of unnecessary (void *) casting in 'cypress_init' function.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
---
 drivers/input/mouse/cypress_ps2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c
index f51765f..b87d7ba 100644
--- a/drivers/input/mouse/cypress_ps2.c
+++ b/drivers/input/mouse/cypress_ps2.c
@@ -680,7 +680,7 @@ int cypress_init(struct psmouse *psmouse)
 	struct cytp_data *cytp;
 
 	cytp = (struct cytp_data *)kzalloc(sizeof(struct cytp_data), GFP_KERNEL);
-	psmouse->private = (void *)cytp;
+	psmouse->private = cytp;
 	if (cytp == NULL)
 		return -ENOMEM;
 
-- 
1.8.4


^ permalink raw reply related

* [PATCH v2] Input: usbtouchscreen - separate report and transmit buffer size handling
From: Christian Engelmayer @ 2013-10-16 21:15 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Forest Bond, Daniel Ritz, linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	christian.engelmayer-USXAA5bZaHGDvotElmWtJA
In-Reply-To: <20131016062902.GA4282-WlK9ik9hQGAhIp7JRqBPierSzoNAToWh@public.gmane.org>

This patch supports the separate handling of the USB transfer buffer length
and the length of the buffer used for multi packet support. For devices
supporting multiple report or diagnostic packets, the USB transfer size is now
limited to the USB endpoints wMaxPacketSize - otherwise it defaults to the
configured report packet size as before

This fixes an issue where event reporting can be delayed for an arbitrary
time for multi packet devices. For instance the report size for eGalax devices
is defined to the 16 byte maximum diagnostic packet size as opposed to the 5
byte report packet size. In case the driver requests 16 byte from the USB
interrupt endpoint, the USB host controller driver needs to split up the
request into 2 accesses according to the endpoints wMaxPacketSize of 8 byte.
When the first transfer is answered by the eGalax device with not less than
the full 8 byte requested, the host controller has got no way of knowing
whether the touch controller has got additional data queued and will issue
the second transfer. If per example a liftoff event finishes at such a
wMaxPacketSize boundary, the data will not be available to the usbtouch driver
until a further event is triggered and transfered to the host. From user
perspective the BTN_TOUCH release event in this case is stuck until the next
touch down event.

Signed-off-by: Christian Engelmayer <christian.engelmayer-USXAA5bZaHGDvotElmWtJA@public.gmane.org>
---
v2: Added changes suggested by Dmitry Torokhov:

    * Prefer a temporary variable over a multiple conversion of wMaxPaxetSize.
    * Avoid further modifiction of the shared device info structure.

The existing violation in the probe function

	if (!type->process_pkt)
		type->process_pkt = usbtouch_process_pkt;

seems to be conveniance triggered and while at least at the moment applicable
for all devices of a type, could be easily removed. For a complete cleanup and
eg. setting the shared device information 'const', we would have to adapt the
Nexio support first - nexio_read_data:

	if (!usbtouch->type->max_xc) {
		usbtouch->type->max_xc = 2 * x_len;
		input_set_abs_params(usbtouch->input, ABS_X,
				     0, usbtouch->type->max_xc, 0, 0);
		usbtouch->type->max_yc = 2 * y_len;
		input_set_abs_params(usbtouch->input, ABS_Y,
				     0, usbtouch->type->max_yc, 0, 0);
	}
---
 drivers/input/touchscreen/usbtouchscreen.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
index 721fdb3..d632848 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -106,6 +106,7 @@ struct usbtouch_device_info {
 struct usbtouch_usb {
 	unsigned char *data;
 	dma_addr_t data_dma;
+	int data_size;
 	unsigned char *buffer;
 	int buf_len;
 	struct urb *irq;
@@ -1523,7 +1524,7 @@ static int usbtouch_reset_resume(struct usb_interface *intf)
 static void usbtouch_free_buffers(struct usb_device *udev,
 				  struct usbtouch_usb *usbtouch)
 {
-	usb_free_coherent(udev, usbtouch->type->rept_size,
+	usb_free_coherent(udev, usbtouch->data_size,
 			  usbtouch->data, usbtouch->data_dma);
 	kfree(usbtouch->buffer);
 }
@@ -1548,6 +1549,7 @@ static int usbtouch_probe(struct usb_interface *intf,
 	struct usb_endpoint_descriptor *endpoint;
 	struct usb_device *udev = interface_to_usbdev(intf);
 	struct usbtouch_device_info *type;
+	int wMaxPacketSize;
 	int err = -ENOMEM;
 
 	/* some devices are ignored */
@@ -1557,6 +1559,7 @@ static int usbtouch_probe(struct usb_interface *intf,
 	endpoint = usbtouch_get_input_endpoint(intf->cur_altsetting);
 	if (!endpoint)
 		return -ENXIO;
+	wMaxPacketSize = le16_to_cpu(endpoint->wMaxPacketSize);
 
 	usbtouch = kzalloc(sizeof(struct usbtouch_usb), GFP_KERNEL);
 	input_dev = input_allocate_device();
@@ -1568,7 +1571,9 @@ static int usbtouch_probe(struct usb_interface *intf,
 	if (!type->process_pkt)
 		type->process_pkt = usbtouch_process_pkt;
 
-	usbtouch->data = usb_alloc_coherent(udev, type->rept_size,
+	usbtouch->data_size = (type->get_pkt_len) ?
+			min(type->rept_size, wMaxPacketSize) : type->rept_size;
+	usbtouch->data = usb_alloc_coherent(udev, usbtouch->data_size,
 					    GFP_KERNEL, &usbtouch->data_dma);
 	if (!usbtouch->data)
 		goto out_free;
@@ -1628,12 +1633,12 @@ static int usbtouch_probe(struct usb_interface *intf,
 	if (usb_endpoint_type(endpoint) == USB_ENDPOINT_XFER_INT)
 		usb_fill_int_urb(usbtouch->irq, udev,
 			 usb_rcvintpipe(udev, endpoint->bEndpointAddress),
-			 usbtouch->data, type->rept_size,
+			 usbtouch->data, usbtouch->data_size,
 			 usbtouch_irq, usbtouch, endpoint->bInterval);
 	else
 		usb_fill_bulk_urb(usbtouch->irq, udev,
 			 usb_rcvbulkpipe(udev, endpoint->bEndpointAddress),
-			 usbtouch->data, type->rept_size,
+			 usbtouch->data, usbtouch->data_size,
 			 usbtouch_irq, usbtouch);
 
 	usbtouch->irq->dev = udev;
-- 
1.7.2.5
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* Re: Fixing 0eef:0001 (eGalax) driver binding
From: Forest Bond @ 2013-10-16 20:03 UTC (permalink / raw)
  To: linux-input
  Cc: Sebastian Dalfuß, Jiri Kosina, Daniel Ritz, Max Weninger,
	Dmitry Torokhov, Christian Engelmayer
In-Reply-To: <20131015182701.GD14822@alittletooquiet.net>

[-- Attachment #1: Type: text/plain, Size: 2693 bytes --]

Hi,

On Tue, Oct 15, 2013 at 02:27:01PM -0400, Forest Bond wrote:
> 3. Some devices with class HID, protocol None work fine with usbtouchscreen,
>    which is where they are currently bound.  Okay!
> 
>    Some of these also work with usbhid (using quirks=0x20000048 to prevent it
>    from being ignored).  All of the ones I have here are like this.  I'm not
>    sure if there is a reason to prefer one driver over the other (dual touch?).
> 
>    Others reportedly do *not* work with usbhid (this is Max):
> 
>    https://lkml.org/lkml/2009/1/25/127
> 
> 4. Some devices with class HID, protocol None do *not* work with usbtouchscreen,
>    which is where they are currently bound.  No bueno.  Here's one (this is
>    Sebastian):
> 
>    http://comments.gmane.org/gmane.linux.kernel.input/31710
> 
>    I suspect these are all multitouch devices, but I am not sure.
> 
> So we need to figure out the device driver mapping that supports the most
> devices (or regresses the fewest, although I think we've messed this up enough
> for that to be a secondary concern).
> 
> 
> What I'm hoping is that the report in #3 that led to class HID, protocol None
> devices being bound to usbtouchscreen is no longer accurate and these devices
> work fine with current usbhid.
> 
> Max, can you test this for us?  I.e. does your touch screen work with current
> usbhid using quirks=0x20000048?  The following modprobe snippet might be
> helpful:
> 
> options usbhid quirks=0x0eef:0x0001:0x40000048
> install usbtouchscreen /bin/false
> 
> If Max's touch screen works with current usbhid, I think we can drop the special
> case that binds it to usbtouchscreen and we're done!  If not, things will be
> more complicated (e.g. we may have to consider whether a device is multitouch to
> decide if we should bind usbhid or usbtouchscreen).

Max reported to me off-list that he no longer has his touch screen, so this
testing most likely will not be taking place.

Unless someone can identify an EETI/eGalax touch screen with class HID, protocol
None that does not work with current usbhid, I propose we bind these to usbhid
instead of usbtouchscreen and see if anything breaks.  This will fix one
regression (Sebastian's) at the risk of re-introducing another one (Max's).  But
I think we'll actually end up with both problems fixed.

I think I could also argue that if we're going to break a device, it should be
the one that says it's HID but isn't, not the one that actually is what it says
it is.  Hopefully it won't come down to that. ;)

Thoughts?

Thanks,
Forest
-- 
Forest Bond
http://www.forestbond.com/
http://www.rapidrollout.com/

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply

* Re: [PATCH] drivers: input: mouse: Remove useless casting in cypress_ps2.c
From: Geyslan Gregório Bem @ 2013-10-16 18:48 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: dudl, kamal, mario_limonciello, git, linux-input, LKML, kernel-br
In-Reply-To: <20131016184133.GB21932@core.coreip.homeip.net>

2013/10/16 Dmitry Torokhov <dmitry.torokhov@gmail.com>:
> Hi Geyslan,
>
> On Wed, Oct 16, 2013 at 01:05:12PM -0300, Geyslan G. Bem wrote:
>> Casting (void *) value returned by kzalloc is useless
>> as mentioned in Documentation/CodingStyle, Chap 14.
>>
>> Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
>> ---
>>  drivers/input/mouse/cypress_ps2.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c
>> index f51765f..ef651cc 100644
>> --- a/drivers/input/mouse/cypress_ps2.c
>> +++ b/drivers/input/mouse/cypress_ps2.c
>> @@ -679,7 +679,7 @@ int cypress_init(struct psmouse *psmouse)
>>  {
>>       struct cytp_data *cytp;
>>
>> -     cytp = (struct cytp_data *)kzalloc(sizeof(struct cytp_data), GFP_KERNEL);
>> +     cytp = kzalloc(sizeof(struct cytp_data), GFP_KERNEL);
>
> I already have a patch for this from Jingoo Han in my queue.

No problem.
>
>>       psmouse->private = (void *)cytp;
>
> But this cast is also not needed, so if you could send me a patch for it
> I'd appreciate that.

Sure, I can.
>
>>       if (cytp == NULL)
>>               return -ENOMEM;
>> --
>> 1.8.4
>>
>
> Thanks.
>
> --
> Dmitry

^ permalink raw reply

* Re: [PATCH] drivers: input: mouse: Remove useless casting in cypress_ps2.c
From: Dmitry Torokhov @ 2013-10-16 18:41 UTC (permalink / raw)
  To: Geyslan G. Bem
  Cc: dudl, kamal, mario_limonciello, git, linux-input, linux-kernel,
	kernel-br
In-Reply-To: <1381939512-28534-1-git-send-email-geyslan@gmail.com>

Hi Geyslan,

On Wed, Oct 16, 2013 at 01:05:12PM -0300, Geyslan G. Bem wrote:
> Casting (void *) value returned by kzalloc is useless
> as mentioned in Documentation/CodingStyle, Chap 14.
> 
> Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
> ---
>  drivers/input/mouse/cypress_ps2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c
> index f51765f..ef651cc 100644
> --- a/drivers/input/mouse/cypress_ps2.c
> +++ b/drivers/input/mouse/cypress_ps2.c
> @@ -679,7 +679,7 @@ int cypress_init(struct psmouse *psmouse)
>  {
>  	struct cytp_data *cytp;
>  
> -	cytp = (struct cytp_data *)kzalloc(sizeof(struct cytp_data), GFP_KERNEL);
> +	cytp = kzalloc(sizeof(struct cytp_data), GFP_KERNEL);

I already have a patch for this from Jingoo Han in my queue.

>  	psmouse->private = (void *)cytp;

But this cast is also not needed, so if you could send me a patch for it
I'd appreciate that.

>  	if (cytp == NULL)
>  		return -ENOMEM;
> -- 
> 1.8.4
> 

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH 1/1][Resend] Input: cypress_ps2 - Return zero finger count if palm is detected.
From: Dmitry Torokhov @ 2013-10-16 18:35 UTC (permalink / raw)
  To: Joseph Salisbury
  Cc: rydberg, Kamal Mostafa, linux-kernel, dudl, git, tim.gardner,
	linux-input
In-Reply-To: <525827B3.9080003@canonical.com>

Hi Joe,

On Fri, Oct 11, 2013 at 12:30:43PM -0400, Joseph Salisbury wrote:
> On 09/30/2013 04:12 PM, Kamal Mostafa wrote:
> > On Tue, 2013-09-24 at 11:44 -0400, Joseph Salisbury wrote:
> >> BugLink: http://bugs.launchpad.net/bugs/1229361
> >>
> >> This patch sets the finger count to 0 in the case of palm contact.
> >>
> >> Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
> >> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> (maintainer:INPUT (KEYBOARD,...,commit_signer:2/2=100%)
> >> Cc: Henrik Rydberg <rydberg@euromail.se> (maintainer:INPUT MULTITOUCH...)
> >> Cc: Kamal Mostafa <kamal@canonical.com> (commit_signer:2/2=100%)
> >> Cc: Dudley Du <dudl@cypress.com> (commit_signer:2/2=100%)
> >> Cc: Kyle Fazzari <git@status.e4ward.com> (commit_signer:1/2=50%)
> >> Cc: Tim Gardner <tim.gardner@canonical.com> (commit_signer:1/2=50%)
> >> Cc: linux-input@vger.kernel.org (open list:INPUT (KEYBOARD,...)
> >> Cc: linux-kernel@vger.kernel.org (open list)
> >> Cc: stable@vger.kernel.org
> > This patch works fine: eliminates stream of junk driver messages with no
> > ill effects.
> >
> > Tested-by: Kamal Mostafa <kamal@canonical.com>
> >
> >  -Kamal
> >
> >
> >> ---
> >>  drivers/input/mouse/cypress_ps2.c |    4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c
> >> index 45b3eda..95b2c40 100644
> >> --- a/drivers/input/mouse/cypress_ps2.c
> >> +++ b/drivers/input/mouse/cypress_ps2.c
> >> @@ -441,7 +441,7 @@ static int cypress_get_finger_count(unsigned char header_byte)
> >>  			case 2: return 5;
> >>  			default:
> >>  				/* Invalid contact (e.g. palm). Ignore it. */
> >> -				return -1;
> >> +				return 0;
> >>  		}
> >>  	}
> >>  
> >> @@ -460,7 +460,7 @@ static int cypress_parse_packet(struct psmouse *psmouse,
> >>  
> >>  	contact_cnt = cypress_get_finger_count(header_byte);
> >>  
> >> -	if (contact_cnt < 0) /* e.g. palm detect */
> >> +	if (contact_cnt < 0)
> >>  		return -EINVAL;
> >>  
> >>  	report_data->contact_cnt = contact_cnt;
> Hi Dmitry and Henrik,
> 
> Have you had a chance to review this patch to consider it for inclusion
> in mainline?

I think the main problem is that we were reporting PSMOUSE_BAD_DATA for
palm packets.

Could you try a slightly extended patch below to make sure it all still
works?

Thanks!

-- 
Dmitry

Input: cypress_ps2 - do not consider data bad if palm is detected

From: Joseph Salisbury <joseph.salisbury@canonical.com>

If hardware (or firmware) detects palm on the surface of the device it does
not mean that the data packet is bad from the protocol standpoint. Instead
of reporting PSMOUSE_BAD_DATA in this case simply threat it as if nothing
touches the surface.

BugLink: http://bugs.launchpad.net/bugs/1229361

Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
Tested-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/mouse/cypress_ps2.c |   20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c
index ef651cc..e499e55 100644
--- a/drivers/input/mouse/cypress_ps2.c
+++ b/drivers/input/mouse/cypress_ps2.c
@@ -439,7 +439,7 @@ static int cypress_get_finger_count(unsigned char header_byte)
 			case 2: return 5;
 			default:
 				/* Invalid contact (e.g. palm). Ignore it. */
-				return -1;
+				return 0;
 		}
 	}
 
@@ -452,17 +452,10 @@ static int cypress_parse_packet(struct psmouse *psmouse,
 {
 	unsigned char *packet = psmouse->packet;
 	unsigned char header_byte = packet[0];
-	int contact_cnt;
 
 	memset(report_data, 0, sizeof(struct cytp_report_data));
 
-	contact_cnt = cypress_get_finger_count(header_byte);
-
-	if (contact_cnt < 0) /* e.g. palm detect */
-		return -EINVAL;
-
-	report_data->contact_cnt = contact_cnt;
-
+	report_data->contact_cnt = cypress_get_finger_count(header_byte);
 	report_data->tap = (header_byte & ABS_MULTIFINGER_TAP) ? 1 : 0;
 
 	if (report_data->contact_cnt == 1) {
@@ -535,11 +528,9 @@ static void cypress_process_packet(struct psmouse *psmouse, bool zero_pkt)
 	int slots[CYTP_MAX_MT_SLOTS];
 	int n;
 
-	if (cypress_parse_packet(psmouse, cytp, &report_data))
-		return;
+	cypress_parse_packet(psmouse, cytp, &report_data);
 
 	n = report_data.contact_cnt;
-
 	if (n > CYTP_MAX_MT_SLOTS)
 		n = CYTP_MAX_MT_SLOTS;
 
@@ -604,11 +595,6 @@ static psmouse_ret_t cypress_validate_byte(struct psmouse *psmouse)
 	if ((packet[0] & 0x08) == 0x08)
 		return PSMOUSE_BAD_DATA;
 
-	contact_cnt = cypress_get_finger_count(packet[0]);
-
-	if (contact_cnt < 0)
-		return PSMOUSE_BAD_DATA;
-
 	if (cytp->mode & CYTP_BIT_ABS_NO_PRESSURE)
 		cypress_set_packet_size(psmouse, contact_cnt == 2 ? 7 : 4);
 	else

^ permalink raw reply related

* [PATCH] drivers: input: mouse: Remove useless casting in cypress_ps2.c
From: Geyslan G. Bem @ 2013-10-16 16:05 UTC (permalink / raw)
  To: dmitry.torokhov
  Cc: dudl, kamal, mario_limonciello, git, linux-input, linux-kernel,
	kernel-br, Geyslan G. Bem

Casting (void *) value returned by kzalloc is useless
as mentioned in Documentation/CodingStyle, Chap 14.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
---
 drivers/input/mouse/cypress_ps2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c
index f51765f..ef651cc 100644
--- a/drivers/input/mouse/cypress_ps2.c
+++ b/drivers/input/mouse/cypress_ps2.c
@@ -679,7 +679,7 @@ int cypress_init(struct psmouse *psmouse)
 {
 	struct cytp_data *cytp;
 
-	cytp = (struct cytp_data *)kzalloc(sizeof(struct cytp_data), GFP_KERNEL);
+	cytp = kzalloc(sizeof(struct cytp_data), GFP_KERNEL);
 	psmouse->private = (void *)cytp;
 	if (cytp == NULL)
 		return -ENOMEM;
-- 
1.8.4


^ permalink raw reply related

* Logitech G710+ unusable without quirk/driver
From: Kai Wasserbäch @ 2013-10-16 14:50 UTC (permalink / raw)
  To: linux-input

[-- Attachment #1: Type: text/plain, Size: 1392 bytes --]

[Please CC me on all replys, I'm not subscribed to this list.]

Dear Kernel Devs,
I recently tried to use a Logitech G710+ (because of the nice mechanical keys)
with Linux, which is, outside of X (evdev seems to filter this), not possible.
The keyboard spams „6“ to the console. Some searching yielded, that this is a
known problem and based on that information it seems like the problem is, that
the device sends some key down events during initilisation but no key up event.

This means I can't use the device during boot, as I'm unable to enter the
passphrase for my encrypted filesystem. Or later, the non-graphical interface.

There is an out-of-tree driver
(<https://github.com/Wattos/logitech-g710-linux-driver>) which works for the
non-graphical interface; I haven't managed to convince my initrd to properly
load the driver, even though it is included. The author tried to get feedback
from this list, but didn't receive an answer
<http://article.gmane.org/gmane.linux.kernel.input/30258>, but maybe that's a
starting point for getting something working into the kernel.

Is there some kind of quirk flag that can be set during boot, that would make
the keyboard at least usable (obviously without the macro keys, but those aren't
that important to me, so that'd be fine)?

Thank you in advance for fixing this issue!

Kind regards,
Kai Wasserbäch


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 665 bytes --]

^ permalink raw reply

* Re: WPC8769L (WEC1020) support in winbond-cir?
From: Juan Jesús García de Soria Lucena @ 2013-10-16 14:47 UTC (permalink / raw)
  To: David Härdeman
  Cc: Tom Gundersen, Sean Young, linux-input@vger.kernel.org,
	linux-media
In-Reply-To: <CAB+yVgCtvRHRLxP2SRgCAqkCKdyThgr48fOvBFe9YHfz3xArmQ@mail.gmail.com>

Resending, now making sure I use plain text for the email...

Hi there,

2013/10/15 David Härdeman <david@hardeman.nu>
>
> IIRC, Juan had a hacked-up version of the winbond-cir driver working on
> his hardware back in March (the hardware seems similar enough, basically
> the WEC1022 adds some additional Wake-On-IR functionality...I seem to
> recall).

I did indeed look at this at the time. I still have the hardware,
should have the hardware docs somewhere, and can look at where I left
that hacked code at the time...

I really would have liked to merge in the support for it into
winbond-cir, but real life took over.

> But I think Juan is the one to talk to. I don't have the WEC1020
> hardware and I don't have his experience of adding support for it...

As I said, I still have the hardware around. I might get some time
around this weekend to look at it and come back with at least an idea
of what is left to be done.

Best regards,

   Juan.

:wq
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH v2 0/2] Improve the performance of alps v5-protocol's touchpad
From: Justin Clift @ 2013-10-16  9:37 UTC (permalink / raw)
  To: Yunkang Tang
  Cc: dmitry.torokhov, yunkang.tang, linux-input, Kevin Cernekee,
	Niels de Vos
In-Reply-To: <1379045010-3347-1-git-send-email-yunkang.tang@cn.alps.com>

On 13/09/2013, at 5:03 AM, Yunkang Tang wrote:
> Hi all,
> 
> Here is the v2 of improving ALPS v5 protocol device.
> 
> Change since v1:
> - fix the issue that previous patches were broken by mail system.
> - split the modification to 2 patches.
> - Change dev2's name to "ALPS PS/2 Device"

Thanks Tommy.  We've been trying to get recent ALPS touchpads
working through Red Hat Bugzilla issue 953211.

  https://bugzilla.redhat.com/show_bug.cgi?id=953211

Niels de Vos, CC'd, was kind enough to build a Fedora 19 kernel
with your patch added.  We've been testing it since yesterday.

Your patch works well for several models of laptop (confirmed
success):

 * Dell Inspiron 17R SE / Inspiron 7720
 * Dell Vostro 3360
 * Fujitsu Lifebook AH532

With your patches, the touchpad:

* is recognised as a touchpad
* both KDE and Gnome can control it
* 2 finger scrolling works

That being said, we have conflicting reports about 1 finger
vertical scrolling on the Inspiron 17R SE / Inspiron 7720.

* 1 finger scrolling works on my laptop (Inspiron 17R SE),
  if 2 finger scrolling is NOT enabled in Gnome3 mouse &
  touchpad settings. (seems mutually exclusive)
* 1 finger scrolling does NOT work in KDE (Inspiron 7720)
  * I'm following this up with the reporter, as it may
    turn out to be a KDE settings issue

From my point of view, I'm be happy to see these patches
be applied, and you're welcome to use:

  Tested-by: Justin Clift <jclift@redhat.com>

Side note - Thanks to the people who've tested this and
reported back. :)

* Stanislav Datskevich
* Özgür Gündoğan
* Pentarh Udi
* Arnaud Lacombe
* Gaspard Jankowiak
* myself ;>

Regards and best wishes,

Justin Clift


> Best Regards,
> Tommy

--
Open Source and Standards @ Red Hat

twitter.com/realjustinclift

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 4/5] input: tc3589x-keypad: support probing from device tree
From: Linus Walleij @ 2013-10-16  7:50 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Linux Input, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, Samuel Ortiz, Lee Jones
In-Reply-To: <20131016063947.GD4282@core.coreip.homeip.net>

On Wed, Oct 16, 2013 at 8:39 AM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Tue, Oct 15, 2013 at 11:21:11PM +0200, Linus Walleij wrote:
>> Implement device tree probing for the tc3589x keypad driver.
>> This is modeled on the STMPE keypad driver and tested on the
>> Ux500 TVK1281618 UIB.
>>
>> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
>
> Looks good, should I merge it or you want to take it through another
> tree??

As this one is only using old device tree bindings
(Documentation/devicetree/bindings/input/matrix-keymap.txt
and friends) I think you can just merge it.

Yours,
Linus Walleij

^ permalink raw reply

* Re: [PATCH] Input: nspire-keypad - add missing clk_disable_unprepare() on error path
From: Dmitry Torokhov @ 2013-10-16  6:55 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: grant.likely, rob.herring, dt.tangr, yongjun_wei, Julia.Lawall,
	viresh.kumar, linux-input
In-Reply-To: <CAPgLHd9f_4-mtxXKLcL+fiNJw8gdTjU8ZSJtJoSLTW2tSa-N_Q@mail.gmail.com>

On Sat, Oct 12, 2013 at 02:32:09PM +0800, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> Add the missing clk_disable_unprepare() before return
> from nspire_keypad_open() in the error handling case.
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Applied, thank you.

> ---
>  drivers/input/keyboard/nspire-keypad.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/input/keyboard/nspire-keypad.c b/drivers/input/keyboard/nspire-keypad.c
> index b3e3eda..85e8d80 100644
> --- a/drivers/input/keyboard/nspire-keypad.c
> +++ b/drivers/input/keyboard/nspire-keypad.c
> @@ -143,8 +143,10 @@ static int nspire_keypad_open(struct input_dev *input)
>  		return error;
>  
>  	error = nspire_keypad_chip_init(keypad);
> -	if (error)
> +	if (error) {
> +		clk_disable_unprepare(keypad->clk);
>  		return error;
> +	}
>  
>  	return 0;
>  }
> 

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH v2 1/2] Add an additional argument for decode routine, change secondary device name
From: Dmitry Torokhov @ 2013-10-16  6:54 UTC (permalink / raw)
  To: Yunkang Tang; +Cc: yunkang.tang, linux-input
In-Reply-To: <1379045010-3347-2-git-send-email-yunkang.tang@cn.alps.com>

Hi Yunkang,

On Fri, Sep 13, 2013 at 12:03:29PM +0800, Yunkang Tang wrote:
> From: Yunkang Tang <yunkang.tang@cn.alps.com>
> 
> - Add an addition argument for decode routine, new devices need this info.
> - Change the dev2's name from "PS/2 Mouse" to "ALPS PS/2 Device".
> 

I carved the name change device out of this patch and applied to my
3.13 queue.

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH v2 1/2] Input - wacom: Not all multi-interface devices support touch
From: Dmitry Torokhov @ 2013-10-16  6:48 UTC (permalink / raw)
  To: Ping Cheng; +Cc: linux-input, peter.hutterer, chris, Ping Cheng
In-Reply-To: <1381439833-1116-1-git-send-email-pingc@wacom.com>

On Thu, Oct 10, 2013 at 02:17:13PM -0700, Ping Cheng wrote:
> Some multi-interface devices support expresskeys on a separate interface,
> such as Bamboo; some multi-interface devices do not support touch at all,
> such as Pen only Intuos5. Make sure we report the right device names.
> 
> Tested-by: Jason Gerecke <killertofu@gmail.com>
> Signed-off-by: Ping Cheng <pingc@wacom.com>

Applied, thank you.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH 4/5] input: tc3589x-keypad: support probing from device tree
From: Dmitry Torokhov @ 2013-10-16  6:39 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-input, devicetree, linux-kernel, Samuel Ortiz, Lee Jones
In-Reply-To: <1381872071-23455-1-git-send-email-linus.walleij@linaro.org>

On Tue, Oct 15, 2013 at 11:21:11PM +0200, Linus Walleij wrote:
> Implement device tree probing for the tc3589x keypad driver.
> This is modeled on the STMPE keypad driver and tested on the
> Ux500 TVK1281618 UIB.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Looks good, should I merge it or you want to take it through another
tree??

> ---
>  drivers/input/keyboard/tc3589x-keypad.c | 63 +++++++++++++++++++++++++++++++--
>  1 file changed, 61 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c
> index 208de7c..f6ec0d7 100644
> --- a/drivers/input/keyboard/tc3589x-keypad.c
> +++ b/drivers/input/keyboard/tc3589x-keypad.c
> @@ -297,6 +297,62 @@ static void tc3589x_keypad_close(struct input_dev *input)
>  	tc3589x_keypad_disable(keypad);
>  }
>  
> +#ifdef CONFIG_OF
> +static const struct tc3589x_keypad_platform_data *
> +tc3589x_keypad_of_probe(struct device *dev)
> +{
> +	struct device_node *np = dev->of_node;
> +	struct tc3589x_keypad_platform_data *plat;
> +	u32 debounce_ms;
> +	int proplen;
> +
> +	if (!np)
> +		return ERR_PTR(-ENODEV);
> +
> +	plat = devm_kzalloc(dev, sizeof(*plat), GFP_KERNEL);
> +	if (!plat)
> +		return ERR_PTR(-ENOMEM);
> +
> +	of_property_read_u8(np, "keypad,num-columns", &plat->kcol);
> +	of_property_read_u8(np, "keypad,num-rows", &plat->krow);
> +	if (!plat->krow || !plat->kcol ||
> +	     plat->krow > TC_KPD_ROWS || plat->kcol > TC_KPD_COLUMNS) {
> +		dev_err(dev,
> +			"keypad columns/rows not properly specified (%ux%u)\n",
> +			plat->kcol, plat->krow);
> +		return ERR_PTR(-EINVAL);
> +	}
> +
> +	if (!of_get_property(np, "linux,keymap", &proplen)) {
> +		dev_err(dev, "property linux,keymap not found\n");
> +		return ERR_PTR(-ENOENT);
> +	}
> +
> +	plat->no_autorepeat = of_property_read_bool(np, "linux,no-autorepeat");
> +	plat->enable_wakeup = of_property_read_bool(np, "linux,wakeup");
> +
> +	/* The custom delay format is ms/16 */
> +	of_property_read_u32(np, "debounce-delay-ms", &debounce_ms);
> +	if (debounce_ms)
> +		plat->debounce_period = debounce_ms * 16;
> +	else
> +		plat->debounce_period = TC_KPD_DEBOUNCE_PERIOD;
> +
> +	plat->settle_time = TC_KPD_SETTLE_TIME;
> +	/* FIXME: should be property of the IRQ resource? */
> +	plat->irqtype = IRQF_TRIGGER_FALLING;
> +
> +	return plat;
> +}
> +#else
> +static inline const struct tc3589x_keypad_platform_data *
> +tc3589x_keypad_of_probe(struct device *dev)
> +{
> +	return ERR_PTR(-ENODEV);
> +}
> +#endif
> +
> +
>  static int tc3589x_keypad_probe(struct platform_device *pdev)
>  {
>  	struct tc3589x *tc3589x = dev_get_drvdata(pdev->dev.parent);
> @@ -307,8 +363,11 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
>  
>  	plat = tc3589x->pdata->keypad;
>  	if (!plat) {
> -		dev_err(&pdev->dev, "invalid keypad platform data\n");
> -		return -EINVAL;
> +		plat = tc3589x_keypad_of_probe(&pdev->dev);
> +		if (IS_ERR(plat)) {
> +			dev_err(&pdev->dev, "invalid keypad platform data\n");
> +			return PTR_ERR(plat);
> +		}
>  	}
>  
>  	irq = platform_get_irq(pdev, 0);
> -- 
> 1.8.3.1
> 

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH] Input: wacom - Export battery scope
From: Dmitry Torokhov @ 2013-10-16  6:36 UTC (permalink / raw)
  To: Bastien Nocera; +Cc: linux-input, peter.hutterer, chris, killertofu
In-Reply-To: <1381693762.21482.2.camel@nuvo>

On Sun, Oct 13, 2013 at 09:49:22PM +0200, Bastien Nocera wrote:
> 
> This will stop UPower from detecting the tablet as a power supply,
> and using its battery status to hibernate or switch off the machine.
> 
> https://bugs.freedesktop.org/show_bug.cgi?id=70321
> 
> Signed-off-by: Bastien Nocera <hadess@hadess.net>


Applied, thank you.

> ---
>  drivers/input/tablet/wacom_sys.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
> index 79b69ea..e53416a 100644
> --- a/drivers/input/tablet/wacom_sys.c
> +++ b/drivers/input/tablet/wacom_sys.c
> @@ -1031,6 +1031,7 @@ static void wacom_destroy_leds(struct wacom *wacom)
>  }
>  
>  static enum power_supply_property wacom_battery_props[] = {
> +	POWER_SUPPLY_PROP_SCOPE,
>  	POWER_SUPPLY_PROP_CAPACITY
>  };
>  
> @@ -1042,6 +1043,9 @@ static int wacom_battery_get_property(struct power_supply *psy,
>  	int ret = 0;
>  
>  	switch (psp) {
> +		case POWER_SUPPLY_PROP_SCOPE:
> +			val->intval = POWER_SUPPLY_SCOPE_DEVICE;
> +			break;
>  		case POWER_SUPPLY_PROP_CAPACITY:
>  			val->intval =
>  				wacom->wacom_wac.battery_capacity * 100 / 31;
> -- 
> 1.8.3.1
> 
> 

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH] input: qt1070: add power management ops
From: Dmitry Torokhov @ 2013-10-16  6:31 UTC (permalink / raw)
  To: Bo Shen; +Cc: Nicolas Ferre, Wenyou.Yang, linux-arm-kernel, linux-input
In-Reply-To: <525B84F4.4000405@atmel.com>

Hi Bo,

On Mon, Oct 14, 2013 at 01:45:24PM +0800, Bo Shen wrote:
> Hi Dmitry,
> 
> On 8/14/2013 14:52, Nicolas Ferre wrote:
> >On 13/08/2013 09:43, Bo Shen :
> >>Add power management ops for qt1070, it maybe a wakeup source
> >>
> >>Signed-off-by: Bo Shen <voice.shen@atmel.com>
> >
> >Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> 
> Would this patch be applied with Nicolas' ACK?

This patch is already in mainline:

commit 3719b54bc62318db7dd8ac7c39a09dfb991a208f
Author: Bo Shen <voice.shen@atmel.com>
Date:   Tue Aug 13 09:46:40 2013 -0700

    Input: qt1070 - add power management ops

    Add power management ops for qt1070, it may be a wakeup source.

    Signed-off-by: Bo Shen <voice.shen@atmel.com>
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH] Input: usbtouchscreen - separate report and transmit buffer size handling
From: Dmitry Torokhov @ 2013-10-16  6:29 UTC (permalink / raw)
  To: Christian Engelmayer; +Cc: Forest Bond, Daniel Ritz, linux-input, linux-usb
In-Reply-To: <20131015165000.5987a916@frequentis.com>

Hi Christian,

On Tue, Oct 15, 2013 at 04:50:00PM +0200, Christian Engelmayer wrote:
> This patch supports the separate handling of the USB transfer buffer length
> and the length of the buffer used for multi packet support. The USB transfer
> size can now be explicitly configured via the device_info record. Otherwise
> it defaults to the configured report packet size as before. For devices
> supporting multiple report or diagnostic packets, the USB transfer size is
> now reduced to the USB endpoints wMaxPacketSize if not explicitly set.
> 
> This fixes an issue where event reporting can be delayed for an arbitrary
> time for multi packet devices. For instance the report size for eGalax devices
> is defined to the 16 byte maximum diagnostic packet size as opposed to the 5
> byte report packet size. In case the driver requests 16 byte from the USB
> interrupt endpoint, the USB host controller driver needs to split up the
> request into 2 accesses according to the endpoints wMaxPacketSize of 8 byte.
> When the first transfer is answered by the eGalax device with not less than
> the full 8 byte requested, the host controller has got no way of knowing
> whether the touch controller has got additional data queued and will issue
> the second transfer. If per example a liftoff event finishes at such a
> wMaxPacketSize boundary, the data will not be available to the usbtouch driver
> until a further event is triggered and transfered to the host. From user
> perspective the BTN_TOUCH release event in this case is stuck until the next
> touch down event.
> 
> Signed-off-by: Christian Engelmayer <christian.engelmayer@frequentis.com>
> ---
>  drivers/input/touchscreen/usbtouchscreen.c |   16 ++++++++++++----
>  1 files changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
> index 721fdb3..aa1f6a7 100644
> --- a/drivers/input/touchscreen/usbtouchscreen.c
> +++ b/drivers/input/touchscreen/usbtouchscreen.c
> @@ -76,6 +76,7 @@ struct usbtouch_device_info {
>  	int min_yc, max_yc;
>  	int min_press, max_press;
>  	int rept_size;
> +	int xmit_size;
>  
>  	/*
>  	 * Always service the USB devices irq not just when the input device is
> @@ -1523,7 +1524,7 @@ static int usbtouch_reset_resume(struct usb_interface *intf)
>  static void usbtouch_free_buffers(struct usb_device *udev,
>  				  struct usbtouch_usb *usbtouch)
>  {
> -	usb_free_coherent(udev, usbtouch->type->rept_size,
> +	usb_free_coherent(udev, usbtouch->type->xmit_size,
>  			  usbtouch->data, usbtouch->data_dma);
>  	kfree(usbtouch->buffer);
>  }
> @@ -1567,8 +1568,15 @@ static int usbtouch_probe(struct usb_interface *intf,
>  	usbtouch->type = type;
>  	if (!type->process_pkt)
>  		type->process_pkt = usbtouch_process_pkt;
> +	if (!type->xmit_size) {
> +		if ((type->get_pkt_len) &&
> +		    (type->rept_size > le16_to_cpu(endpoint->wMaxPacketSize)))
> +			type->xmit_size = le16_to_cpu(endpoint->wMaxPacketSize);
> +		else
> +			type->xmit_size = type->rept_size;

'type' points to a shared data structure and should not be modified. It
looks like we already violating this so a cleanup patch would be
appreciated as well.

BTW, maybe we should do:

	u16 wMaxPaxetSize = le16_to_cpu(endpoint->wMaxPacketSize);
	xmit_size = min(type->rept_size, wMaxPaxetSize);

?

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: WPC8769L (WEC1020) support in winbond-cir?
From: David Härdeman @ 2013-10-15 21:59 UTC (permalink / raw)
  To: Tom Gundersen
  Cc: Juan J. Garcia de Soria, Sean Young, linux-input@vger.kernel.org,
	linux-media
In-Reply-To: <CAG-2HqX-TO7h8zJ6F01r2LfRVjQtb0pK_1wKGsYVKzB0zC7TQA@mail.gmail.com>

On Mon, Oct 14, 2013 at 03:16:20PM +0200, Tom Gundersen wrote:
>Hi David and Juan,
>
>I'm going through the various out-of-tree LIRC drivers to see if we
>can stop shipping them in Arch Linux [0]. So far it appears we can
>drop all except for lirc_wpc8769l [1] (PnP id WEC1020).
>
>I noticed the comment in windownd-cir [2]:
>
> *  Currently supports the Winbond WPCD376i chip (PNP id WEC1022), but
> *  could probably support others (Winbond WEC102X, NatSemi, etc)
> *  with minor modifications.
>
>What are your thoughts on adding support for WEC1020 upstream? Is
>anyone interested in doing this work (I sadly don't have the correct
>device, so can't really do it myself)?

IIRC, Juan had a hacked-up version of the winbond-cir driver working on
his hardware back in March (the hardware seems similar enough, basically
the WEC1022 adds some additional Wake-On-IR functionality...I seem to
recall).

But I think Juan is the one to talk to. I don't have the WEC1020
hardware and I don't have his experience of adding support for it...

-- 
David Härdeman

^ permalink raw reply

* [PATCH 4/5] input: tc3589x-keypad: support probing from device tree
From: Linus Walleij @ 2013-10-15 21:21 UTC (permalink / raw)
  To: Dmitry Torokhov, linux-input, devicetree
  Cc: linux-kernel, Samuel Ortiz, Lee Jones, Linus Walleij

Implement device tree probing for the tc3589x keypad driver.
This is modeled on the STMPE keypad driver and tested on the
Ux500 TVK1281618 UIB.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/input/keyboard/tc3589x-keypad.c | 63 +++++++++++++++++++++++++++++++--
 1 file changed, 61 insertions(+), 2 deletions(-)

diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c
index 208de7c..f6ec0d7 100644
--- a/drivers/input/keyboard/tc3589x-keypad.c
+++ b/drivers/input/keyboard/tc3589x-keypad.c
@@ -297,6 +297,62 @@ static void tc3589x_keypad_close(struct input_dev *input)
 	tc3589x_keypad_disable(keypad);
 }
 
+#ifdef CONFIG_OF
+static const struct tc3589x_keypad_platform_data *
+tc3589x_keypad_of_probe(struct device *dev)
+{
+	struct device_node *np = dev->of_node;
+	struct tc3589x_keypad_platform_data *plat;
+	u32 debounce_ms;
+	int proplen;
+
+	if (!np)
+		return ERR_PTR(-ENODEV);
+
+	plat = devm_kzalloc(dev, sizeof(*plat), GFP_KERNEL);
+	if (!plat)
+		return ERR_PTR(-ENOMEM);
+
+	of_property_read_u8(np, "keypad,num-columns", &plat->kcol);
+	of_property_read_u8(np, "keypad,num-rows", &plat->krow);
+	if (!plat->krow || !plat->kcol ||
+	     plat->krow > TC_KPD_ROWS || plat->kcol > TC_KPD_COLUMNS) {
+		dev_err(dev,
+			"keypad columns/rows not properly specified (%ux%u)\n",
+			plat->kcol, plat->krow);
+		return ERR_PTR(-EINVAL);
+	}
+
+	if (!of_get_property(np, "linux,keymap", &proplen)) {
+		dev_err(dev, "property linux,keymap not found\n");
+		return ERR_PTR(-ENOENT);
+	}
+
+	plat->no_autorepeat = of_property_read_bool(np, "linux,no-autorepeat");
+	plat->enable_wakeup = of_property_read_bool(np, "linux,wakeup");
+
+	/* The custom delay format is ms/16 */
+	of_property_read_u32(np, "debounce-delay-ms", &debounce_ms);
+	if (debounce_ms)
+		plat->debounce_period = debounce_ms * 16;
+	else
+		plat->debounce_period = TC_KPD_DEBOUNCE_PERIOD;
+
+	plat->settle_time = TC_KPD_SETTLE_TIME;
+	/* FIXME: should be property of the IRQ resource? */
+	plat->irqtype = IRQF_TRIGGER_FALLING;
+
+	return plat;
+}
+#else
+static inline const struct tc3589x_keypad_platform_data *
+tc3589x_keypad_of_probe(struct device *dev)
+{
+	return ERR_PTR(-ENODEV);
+}
+#endif
+
+
 static int tc3589x_keypad_probe(struct platform_device *pdev)
 {
 	struct tc3589x *tc3589x = dev_get_drvdata(pdev->dev.parent);
@@ -307,8 +363,11 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
 
 	plat = tc3589x->pdata->keypad;
 	if (!plat) {
-		dev_err(&pdev->dev, "invalid keypad platform data\n");
-		return -EINVAL;
+		plat = tc3589x_keypad_of_probe(&pdev->dev);
+		if (IS_ERR(plat)) {
+			dev_err(&pdev->dev, "invalid keypad platform data\n");
+			return PTR_ERR(plat);
+		}
 	}
 
 	irq = platform_get_irq(pdev, 0);
-- 
1.8.3.1


^ permalink raw reply related

* Fixing 0eef:0001 (eGalax) driver binding
From: Forest Bond @ 2013-10-15 18:27 UTC (permalink / raw)
  To: linux-input
  Cc: Sebastian Dalfuß, Jiri Kosina, Daniel Ritz, Max Weninger,
	Dmitry Torokhov, Christian Engelmayer

[-- Attachment #1: Type: text/plain, Size: 2977 bytes --]

Hi,

[If you're Cc'd it's because I thought you would be interested—except for Max!
Max, I was hoping for some quick help if you still have that eGalax touch screen
you reported about back in 2009.]


To review, these are devices with vendor ID 0eef and product ID 0001 (or 0002,
which I've never actually seen myself) with varying interfaces class, subclass,
and protocol.  Different devices have worked with different mainline drivers to
varying degrees over the years.  It has never been entirely clear how to
(automatically) select a driver to bind to a particular device.

There is some history to this situation that I will not describe in detail here
as I think it is most beneficial to focus on the present situation.  To that
end, here are the relevant points of interest (to the best of my knowledge):

1. Devices with vendor specific class and protocol apparently work fine with
   usbtouchscreen, which is where they are bound.  Nice!

2. Devices with class HID, protocol Mouse apparently work fine with usbhid,
   which is where they are bound.  Woo hoo!

3. Some devices with class HID, protocol None work fine with usbtouchscreen,
   which is where they are currently bound.  Okay!

   Some of these also work with usbhid (using quirks=0x20000048 to prevent it
   from being ignored).  All of the ones I have here are like this.  I'm not
   sure if there is a reason to prefer one driver over the other (dual touch?).

   Others reportedly do *not* work with usbhid (this is Max):

   https://lkml.org/lkml/2009/1/25/127

4. Some devices with class HID, protocol None do *not* work with usbtouchscreen,
   which is where they are currently bound.  No bueno.  Here's one (this is
   Sebastian):

   http://comments.gmane.org/gmane.linux.kernel.input/31710

   I suspect these are all multitouch devices, but I am not sure.

So we need to figure out the device driver mapping that supports the most
devices (or regresses the fewest, although I think we've messed this up enough
for that to be a secondary concern).


What I'm hoping is that the report in #3 that led to class HID, protocol None
devices being bound to usbtouchscreen is no longer accurate and these devices
work fine with current usbhid.

Max, can you test this for us?  I.e. does your touch screen work with current
usbhid using quirks=0x20000048?  The following modprobe snippet might be
helpful:

options usbhid quirks=0x0eef:0x0001:0x40000048
install usbtouchscreen /bin/false

If Max's touch screen works with current usbhid, I think we can drop the special
case that binds it to usbtouchscreen and we're done!  If not, things will be
more complicated (e.g. we may have to consider whether a device is multitouch to
decide if we should bind usbhid or usbtouchscreen).


Hope we can get it sorted.  Thanks for your help and input.

Regards,
Forest
-- 
Forest Bond
http://www.forestbond.com/
http://www.rapidrollout.com/

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply

* [PATCH] Input: usbtouchscreen - separate report and transmit buffer size handling
From: Christian Engelmayer @ 2013-10-15 14:50 UTC (permalink / raw)
  To: Dmitry Torokhov, Forest Bond, Daniel Ritz
  Cc: linux-input, linux-usb, christian.engelmayer

This patch supports the separate handling of the USB transfer buffer length
and the length of the buffer used for multi packet support. The USB transfer
size can now be explicitly configured via the device_info record. Otherwise
it defaults to the configured report packet size as before. For devices
supporting multiple report or diagnostic packets, the USB transfer size is
now reduced to the USB endpoints wMaxPacketSize if not explicitly set.

This fixes an issue where event reporting can be delayed for an arbitrary
time for multi packet devices. For instance the report size for eGalax devices
is defined to the 16 byte maximum diagnostic packet size as opposed to the 5
byte report packet size. In case the driver requests 16 byte from the USB
interrupt endpoint, the USB host controller driver needs to split up the
request into 2 accesses according to the endpoints wMaxPacketSize of 8 byte.
When the first transfer is answered by the eGalax device with not less than
the full 8 byte requested, the host controller has got no way of knowing
whether the touch controller has got additional data queued and will issue
the second transfer. If per example a liftoff event finishes at such a
wMaxPacketSize boundary, the data will not be available to the usbtouch driver
until a further event is triggered and transfered to the host. From user
perspective the BTN_TOUCH release event in this case is stuck until the next
touch down event.

Signed-off-by: Christian Engelmayer <christian.engelmayer@frequentis.com>
---
 drivers/input/touchscreen/usbtouchscreen.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
index 721fdb3..aa1f6a7 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -76,6 +76,7 @@ struct usbtouch_device_info {
 	int min_yc, max_yc;
 	int min_press, max_press;
 	int rept_size;
+	int xmit_size;
 
 	/*
 	 * Always service the USB devices irq not just when the input device is
@@ -1523,7 +1524,7 @@ static int usbtouch_reset_resume(struct usb_interface *intf)
 static void usbtouch_free_buffers(struct usb_device *udev,
 				  struct usbtouch_usb *usbtouch)
 {
-	usb_free_coherent(udev, usbtouch->type->rept_size,
+	usb_free_coherent(udev, usbtouch->type->xmit_size,
 			  usbtouch->data, usbtouch->data_dma);
 	kfree(usbtouch->buffer);
 }
@@ -1567,8 +1568,15 @@ static int usbtouch_probe(struct usb_interface *intf,
 	usbtouch->type = type;
 	if (!type->process_pkt)
 		type->process_pkt = usbtouch_process_pkt;
+	if (!type->xmit_size) {
+		if ((type->get_pkt_len) &&
+		    (type->rept_size > le16_to_cpu(endpoint->wMaxPacketSize)))
+			type->xmit_size = le16_to_cpu(endpoint->wMaxPacketSize);
+		else
+			type->xmit_size = type->rept_size;
+	}
 
-	usbtouch->data = usb_alloc_coherent(udev, type->rept_size,
+	usbtouch->data = usb_alloc_coherent(udev, type->xmit_size,
 					    GFP_KERNEL, &usbtouch->data_dma);
 	if (!usbtouch->data)
 		goto out_free;
@@ -1628,12 +1636,12 @@ static int usbtouch_probe(struct usb_interface *intf,
 	if (usb_endpoint_type(endpoint) == USB_ENDPOINT_XFER_INT)
 		usb_fill_int_urb(usbtouch->irq, udev,
 			 usb_rcvintpipe(udev, endpoint->bEndpointAddress),
-			 usbtouch->data, type->rept_size,
+			 usbtouch->data, type->xmit_size,
 			 usbtouch_irq, usbtouch, endpoint->bInterval);
 	else
 		usb_fill_bulk_urb(usbtouch->irq, udev,
 			 usb_rcvbulkpipe(udev, endpoint->bEndpointAddress),
-			 usbtouch->data, type->rept_size,
+			 usbtouch->data, type->xmit_size,
 			 usbtouch_irq, usbtouch);
 
 	usbtouch->irq->dev = udev;
-- 
1.7.2.5


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox