Linux Input/HID development
 help / color / mirror / Atom feed
* Re: [PATCH v3] add sur40 driver for Samsung SUR40 (aka MS Surface 2.0/Pixelsense)
From: Florian Echtler @ 2013-11-16 11:45 UTC (permalink / raw)
  To: Henrik Rydberg, Dmitry Torokhov
  Cc: linux-input, benjamin.tissoires, dh.herrmann
In-Reply-To: <52822E8B.6030906@butterbrot.org>

Looks like the sur40 driver didn't make it into the 3.13 pull request, 
anything still missing/broken? I was hoping this might still make it 
into Ubuntu 14.04...

BR, Florian

Florian Echtler <floe@butterbrot.org> wrote:
>On 11.11.2013 11:27, Henrik Rydberg wrote:
>>  >> Also, does the patch below mess up or device or it still works?
>>> I'll test this tomorrow (no access to SUR40 today). If everything
>works,
>>> should I resubmit my patch with yours included or just tell you that
>>> it's fine?
>> No need to resubmit, a confirmation will do nicely. Thanks!
>> Henrik
>
>I've tested Dmitry's additional patch, confirmed to work. Just for the
>record:
>
>Tested-by: Florian Echtler <floe@butterbrot.org>
>
>BR, Florian

^ permalink raw reply

* Logitech M560 - Pt. 2
From: Alexander Ploumistos @ 2013-11-16 11:32 UTC (permalink / raw)
  To: linux-input

And here is the evtest output, I've removed mouse movements, to keep
it short. The keys are in the following order: Left click, right
click, wheel up, wheel down, left tilt, right tilt, forward button,
back button, small button behind the wheel (that last one twice).

Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x46d product 0xc52b version 0x111
Input device name: "Logitech Unifying Device. Wireless PID:402d"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 1 (KEY_ESC)
    Event code 2 (KEY_1)
    Event code 3 (KEY_2)
    Event code 4 (KEY_3)
    Event code 5 (KEY_4)
    Event code 6 (KEY_5)
    Event code 7 (KEY_6)
    Event code 8 (KEY_7)
    Event code 9 (KEY_8)
    Event code 10 (KEY_9)
    Event code 11 (KEY_0)
    Event code 12 (KEY_MINUS)
    Event code 13 (KEY_EQUAL)
    Event code 14 (KEY_BACKSPACE)
    Event code 15 (KEY_TAB)
    Event code 16 (KEY_Q)
    Event code 17 (KEY_W)
    Event code 18 (KEY_E)
    Event code 19 (KEY_R)
    Event code 20 (KEY_T)
    Event code 21 (KEY_Y)
    Event code 22 (KEY_U)
    Event code 23 (KEY_I)
    Event code 24 (KEY_O)
    Event code 25 (KEY_P)
    Event code 26 (KEY_LEFTBRACE)
    Event code 27 (KEY_RIGHTBRACE)
    Event code 28 (KEY_ENTER)
    Event code 29 (KEY_LEFTCTRL)
    Event code 30 (KEY_A)
    Event code 31 (KEY_S)
    Event code 32 (KEY_D)
    Event code 33 (KEY_F)
    Event code 34 (KEY_G)
    Event code 35 (KEY_H)
    Event code 36 (KEY_J)
    Event code 37 (KEY_K)
    Event code 38 (KEY_L)
    Event code 39 (KEY_SEMICOLON)
    Event code 40 (KEY_APOSTROPHE)
    Event code 41 (KEY_GRAVE)
    Event code 42 (KEY_LEFTSHIFT)
    Event code 43 (KEY_BACKSLASH)
    Event code 44 (KEY_Z)
    Event code 45 (KEY_X)
    Event code 46 (KEY_C)
    Event code 47 (KEY_V)
    Event code 48 (KEY_B)
    Event code 49 (KEY_N)
    Event code 50 (KEY_M)
    Event code 51 (KEY_COMMA)
    Event code 52 (KEY_DOT)
    Event code 53 (KEY_SLASH)
    Event code 54 (KEY_RIGHTSHIFT)
    Event code 55 (KEY_KPASTERISK)
    Event code 56 (KEY_LEFTALT)
    Event code 57 (KEY_SPACE)
    Event code 58 (KEY_CAPSLOCK)
    Event code 59 (KEY_F1)
    Event code 60 (KEY_F2)
    Event code 61 (KEY_F3)
    Event code 62 (KEY_F4)
    Event code 63 (KEY_F5)
    Event code 64 (KEY_F6)
    Event code 65 (KEY_F7)
    Event code 66 (KEY_F8)
    Event code 67 (KEY_F9)
    Event code 68 (KEY_F10)
    Event code 69 (KEY_NUMLOCK)
    Event code 70 (KEY_SCROLLLOCK)
    Event code 71 (KEY_KP7)
    Event code 72 (KEY_KP8)
    Event code 73 (KEY_KP9)
    Event code 74 (KEY_KPMINUS)
    Event code 75 (KEY_KP4)
    Event code 76 (KEY_KP5)
    Event code 77 (KEY_KP6)
    Event code 78 (KEY_KPPLUS)
    Event code 79 (KEY_KP1)
    Event code 80 (KEY_KP2)
    Event code 81 (KEY_KP3)
    Event code 82 (KEY_KP0)
    Event code 83 (KEY_KPDOT)
    Event code 85 (KEY_ZENKAKUHANKAKU)
    Event code 86 (KEY_102ND)
    Event code 87 (KEY_F11)
    Event code 88 (KEY_F12)
    Event code 89 (KEY_RO)
    Event code 90 (KEY_KATAKANA)
    Event code 91 (KEY_HIRAGANA)
    Event code 92 (KEY_HENKAN)
    Event code 93 (KEY_KATAKANAHIRAGANA)
    Event code 94 (KEY_MUHENKAN)
    Event code 95 (KEY_KPJPCOMMA)
    Event code 96 (KEY_KPENTER)
    Event code 97 (KEY_RIGHTCTRL)
    Event code 98 (KEY_KPSLASH)
    Event code 99 (KEY_SYSRQ)
    Event code 100 (KEY_RIGHTALT)
    Event code 102 (KEY_HOME)
    Event code 103 (KEY_UP)
    Event code 104 (KEY_PAGEUP)
    Event code 105 (KEY_LEFT)
    Event code 106 (KEY_RIGHT)
    Event code 107 (KEY_END)
    Event code 108 (KEY_DOWN)
    Event code 109 (KEY_PAGEDOWN)
    Event code 110 (KEY_INSERT)
    Event code 111 (KEY_DELETE)
    Event code 113 (KEY_MUTE)
    Event code 114 (KEY_VOLUMEDOWN)
    Event code 115 (KEY_VOLUMEUP)
    Event code 116 (KEY_POWER)
    Event code 117 (KEY_KPEQUAL)
    Event code 119 (KEY_PAUSE)
    Event code 121 (KEY_KPCOMMA)
    Event code 122 (KEY_HANGUEL)
    Event code 123 (KEY_HANJA)
    Event code 124 (KEY_YEN)
    Event code 125 (KEY_LEFTMETA)
    Event code 126 (KEY_RIGHTMETA)
    Event code 127 (KEY_COMPOSE)
    Event code 128 (KEY_STOP)
    Event code 129 (KEY_AGAIN)
    Event code 130 (KEY_PROPS)
    Event code 131 (KEY_UNDO)
    Event code 132 (KEY_FRONT)
    Event code 133 (KEY_COPY)
    Event code 134 (KEY_OPEN)
    Event code 135 (KEY_PASTE)
    Event code 136 (KEY_FIND)
    Event code 137 (KEY_CUT)
    Event code 138 (KEY_HELP)
    Event code 140 (KEY_CALC)
    Event code 142 (KEY_SLEEP)
    Event code 150 (KEY_WWW)
    Event code 152 (KEY_SCREENLOCK)
    Event code 158 (KEY_BACK)
    Event code 159 (KEY_FORWARD)
    Event code 161 (KEY_EJECTCD)
    Event code 163 (KEY_NEXTSONG)
    Event code 164 (KEY_PLAYPAUSE)
    Event code 165 (KEY_PREVIOUSSONG)
    Event code 166 (KEY_STOPCD)
    Event code 173 (KEY_REFRESH)
    Event code 176 (KEY_EDIT)
    Event code 177 (KEY_SCROLLUP)
    Event code 178 (KEY_SCROLLDOWN)
    Event code 179 (KEY_KPLEFTPAREN)
    Event code 180 (KEY_KPRIGHTPAREN)
    Event code 183 (KEY_F13)
    Event code 184 (KEY_F14)
    Event code 185 (KEY_F15)
    Event code 186 (KEY_F16)
    Event code 187 (KEY_F17)
    Event code 188 (KEY_F18)
    Event code 189 (KEY_F19)
    Event code 190 (KEY_F20)
    Event code 191 (KEY_F21)
    Event code 192 (KEY_F22)
    Event code 193 (KEY_F23)
    Event code 194 (KEY_F24)
    Event code 240 (KEY_UNKNOWN)
    Event code 272 (BTN_LEFT)
    Event code 273 (BTN_RIGHT)
    Event code 274 (BTN_MIDDLE)
    Event code 275 (BTN_SIDE)
    Event code 276 (BTN_EXTRA)
    Event code 277 (BTN_FORWARD)
    Event code 278 (BTN_BACK)
    Event code 279 (BTN_TASK)
    Event code 280 (?)
    Event code 281 (?)
    Event code 282 (?)
    Event code 283 (?)
    Event code 284 (?)
    Event code 285 (?)
    Event code 286 (?)
    Event code 287 (?)
  Event type 2 (EV_REL)
    Event code 0 (REL_X)
    Event code 1 (REL_Y)
    Event code 6 (REL_HWHEEL)
    Event code 8 (REL_WHEEL)
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
  Event type 17 (EV_LED)
    Event code 0 (LED_NUML)
    Event code 1 (LED_CAPSL)
    Event code 2 (LED_SCROLLL)
    Event code 3 (LED_COMPOSE)
    Event code 4 (LED_KANA)
Properties:
  Property type 20 (EV_REP)
    Property code 0 (REP_DELAY)
      Value    250
    Property code 1 (REP_PERIOD)
      Value     33
Testing ... (interrupt to exit)
Event: time 1384596124.022800, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001
Event: time 1384596124.022800, type 1 (EV_KEY), code 272 (BTN_LEFT), value 1
Event: time 1384596124.022800, -------------- SYN_REPORT ------------
Event: time 1384596124.184807, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001
Event: time 1384596124.184807, type 1 (EV_KEY), code 272 (BTN_LEFT), value 0
Event: time 1384596124.184807, -------------- SYN_REPORT ------------
Event: time 1384596126.178789, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90002
Event: time 1384596126.178789, type 1 (EV_KEY), code 273 (BTN_RIGHT), value 1
Event: time 1384596126.178789, -------------- SYN_REPORT ------------
Event: time 1384596126.356737, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90002
Event: time 1384596126.356737, type 1 (EV_KEY), code 273 (BTN_RIGHT), value 0
Event: time 1384596126.356737, -------------- SYN_REPORT ------------
Event: time 1384596135.276730, type 2 (EV_REL), code 8 (REL_WHEEL), value 1
Event: time 1384596135.276730, -------------- SYN_REPORT ------------
Event: time 1384596140.958607, type 2 (EV_REL), code 8 (REL_WHEEL), value -1
Event: time 1384596140.958607, -------------- SYN_REPORT ------------
Event: time 1384596159.362527, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90004
Event: time 1384596159.362527, type 1 (EV_KEY), code 275 (BTN_SIDE), value 1
Event: time 1384596159.362527, -------------- SYN_REPORT ------------
Event: time 1384596159.542501, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90004
Event: time 1384596159.542501, type 1 (EV_KEY), code 275 (BTN_SIDE), value 0
Event: time 1384596163.550443, -------------- SYN_REPORT ------------
Event: time 1384596163.636455, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90005
Event: time 1384596163.636455, type 1 (EV_KEY), code 276 (BTN_EXTRA), value 1
Event: time 1384596163.636455, -------------- SYN_REPORT ------------
Event: time 1384596163.870448, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90005
Event: time 1384596163.870448, type 1 (EV_KEY), code 276 (BTN_EXTRA), value 0
Event: time 1384596168.990412, -------------- SYN_REPORT ------------
Event: time 1384596169.138456, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e7
Event: time 1384596169.138456, type 1 (EV_KEY), code 126
(KEY_RIGHTMETA), value 1
Event: time 1384596169.138456, -------------- SYN_REPORT ------------
Event: time 1384596169.356463, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e7
Event: time 1384596169.356463, type 1 (EV_KEY), code 126
(KEY_RIGHTMETA), value 0
Event: time 1384596169.356463, -------------- SYN_REPORT ------------
Event: time 1384596178.602405, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e3
Event: time 1384596178.602405, type 1 (EV_KEY), code 125 (KEY_LEFTMETA), value 1
Event: time 1384596178.602405, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70007
Event: time 1384596178.602405, type 1 (EV_KEY), code 32 (KEY_D), value 1
Event: time 1384596178.602405, -------------- SYN_REPORT ------------
Event: time 1384596178.610395, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70007
Event: time 1384596178.610395, type 1 (EV_KEY), code 32 (KEY_D), value 0
Event: time 1384596178.610395, -------------- SYN_REPORT ------------
Event: time 1384596178.618392, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e3
Event: time 1384596178.618392, type 1 (EV_KEY), code 125 (KEY_LEFTMETA), value 0
Event: time 1384596178.618392, -------------- SYN_REPORT ------------
Event: time 1384596181.964304, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e2
Event: time 1384596181.964304, type 1 (EV_KEY), code 56 (KEY_LEFTALT), value 1
Event: time 1384596181.964304, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e3
Event: time 1384596181.964304, type 1 (EV_KEY), code 125 (KEY_LEFTMETA), value 1
Event: time 1384596181.964304, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70072
Event: time 1384596181.964304, type 1 (EV_KEY), code 193 (KEY_F23), value 1
Event: time 1384596181.964304, -------------- SYN_REPORT ------------
Event: time 1384596181.972327, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e2
Event: time 1384596181.972327, type 1 (EV_KEY), code 56 (KEY_LEFTALT), value 0
Event: time 1384596181.972327, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e3
Event: time 1384596181.972327, type 1 (EV_KEY), code 125 (KEY_LEFTMETA), value 0
Event: time 1384596181.972327, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70072
Event: time 1384596181.972327, type 1 (EV_KEY), code 193 (KEY_F23), value 0
Event: time 1384596181.972327, -------------- SYN_REPORT ------------
Event: time 1384596184.976378, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001
Event: time 1384596184.976378, type 1 (EV_KEY), code 272 (BTN_LEFT), value 1
Event: time 1384596184.976378, -------------- SYN_REPORT ------------
Event: time 1384596184.984314, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001
Event: time 1384596184.984314, type 1 (EV_KEY), code 272 (BTN_LEFT), value 0
Event: time 1384596184.984314, -------------- SYN_REPORT ------------

^ permalink raw reply

* Logitech M560 (Unifying receiver mouse) - strange keycodes, wrong mapping
From: Alexander Ploumistos @ 2013-11-16 11:09 UTC (permalink / raw)
  To: linux-input

Hello everyone,

I recently got my hands on a Logitech M560 mouse and I tried to use it
with 3.11.x kernels (Fedora & Ubuntu). The button mapping was not what
I expected, so I ran it through evtest, xev and xinput, to see what
was off.

First, a few words about the device itself: It appears to be a
somewhat new model, so there is almost no info about it on the net. It
has nine buttons (left & right click, scroll wheel, tilt, forward &
back buttons and a small button behind the wheel) and it connects to
the computer via a "Unifying receiver". It lacks a middle button;
pressing on the wheel engages and disengages the freewheel mechanism,
although I guess the small button behind the wheel is not too
inconvenient to be used for middle clicks. However, this button is
supposed to do something special in windows 8 and surprisingly, it has
two different states.

The original mapping: Left and right clicks are mapped to buttons 1
and 3, wheel up/down to buttons 4/5, left/right tilts to buttons 8/9
(BTN_SIDE & BTN_EXTRA respectively instead of horizontal wheel
left/right), the back button sends simultaneously keypresses for
Super_L and "d", the forward button acts like a keypress for Super_R.
When you press the aforementioned "special" button for the first time,
it sends keycodes 64, 133 and 201 simultaneously (Alt_L, Super_L and
XF86TouchpadOff); press it again, and it acts like button 1. From
there on, it cycles between those two events.

Would anyone be interested in adding support for the mouse? Is it
possible to override the keycodes sent by the buttons, so that they
are recognized as buttons and not keyboard keys?

I will send the evtest output in a follow-up message.

Thank you for your time

^ permalink raw reply

* Re: [appleir] BUG: unable to handle kernel NULL pointer dereference
From: Jiri Kosina @ 2013-11-16  0:21 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: James Henstridge, Jiri Kosina, Luis Henriques, linux-kernel,
	linux-input, Fabien André, Bastien Nocera
In-Reply-To: <527BB695.9040209@redhat.com>

On Thu, 7 Nov 2013, Benjamin Tissoires wrote:

> Ok, thanks for the report. Could you please test the following patch
> which should solve your problem (hopefully)?

James, do you happen to have testing results please?

> 
> Cheers,
> Benjamin
> 
> --
> 
> >From 54b332b992da1666abe7180b6cecd313c864e0b7 Mon Sep 17 00:00:00 2001
> From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> Date: Thu, 7 Nov 2013 10:46:48 -0500
> Subject: [PATCH] HID: appleir: force input to be set
> 
> Some weird remotes are not correctly creating the input device. Their
> report descriptor starts with:
> 0x06, 0x00, 0xff,              // Usage Page (Vendor Defined Page 1)  0
> 0xa1, 0x01,                    // Collection (Application)            3
> 
> whereas others (which are correctly handled) start with:
> 0x05, 0x0c,                    // Usage Page (Consumer Devices)       0
> 0x09, 0x01,                    // Usage (Consumer Control)            2
> 0xa1, 0x01,                    // Collection (Application)            4
> 
> The rest of the report descriptor is the same.
> 
> Adding the quirk HID_QUIRK_HIDINPUT_FORCE forces hid-input to allocate
> the inputs, and everything should be ok.
> 
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> ---
>  drivers/hid/hid-appleir.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/hid/hid-appleir.c b/drivers/hid/hid-appleir.c
> index a42e6a3..0e6a42d 100644
> --- a/drivers/hid/hid-appleir.c
> +++ b/drivers/hid/hid-appleir.c
> @@ -297,6 +297,9 @@ static int appleir_probe(struct hid_device *hid, const struct hid_device_id *id)
>  
>  	appleir->hid = hid;
>  
> +	/* force input as some remotes bypass the input registration */
> +	hid->quirks |= HID_QUIRK_HIDINPUT_FORCE;
> +
>  	spin_lock_init(&appleir->lock);
>  	setup_timer(&appleir->key_up_timer,
>  		    key_up_tick, (unsigned long) appleir);
> 

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply

* [RFC 10/23] Input: omap-keypad - raw read and write endian fix
From: Taras Kondratiuk @ 2013-11-16  0:01 UTC (permalink / raw)
  To: linux-omap
  Cc: linaro-networking, Victor Kamensky, Dmitry Torokhov, linux-input,
	linux-kernel
In-Reply-To: <1384560086-11994-1-git-send-email-taras.kondratiuk@linaro.org>

From: Victor Kamensky <victor.kamensky@linaro.org>

All OMAP IP blocks expect LE data, but CPU may operate in BE mode.
Need to use endian neutral functions to read/write h/w registers.
I.e instead of __raw_read[lw] and __raw_write[lw] functions code
need to use read[lw]_relaxed and write[lw]_relaxed functions.
If the first simply reads/writes register, the second will byteswap
it if host operates in BE mode.

Changes are trivial sed like replacement of __raw_xxx functions
with xxx_relaxed variant.

Signed-off-by: Victor Kamensky <victor.kamensky@linaro.org>
Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
---
 drivers/input/keyboard/omap4-keypad.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
index 30acfd4..952a2eb 100644
--- a/drivers/input/keyboard/omap4-keypad.c
+++ b/drivers/input/keyboard/omap4-keypad.c
@@ -89,26 +89,26 @@ struct omap4_keypad {
 
 static int kbd_readl(struct omap4_keypad *keypad_data, u32 offset)
 {
-	return __raw_readl(keypad_data->base +
+	return readl_relaxed(keypad_data->base +
 				keypad_data->reg_offset + offset);
 }
 
 static void kbd_writel(struct omap4_keypad *keypad_data, u32 offset, u32 value)
 {
-	__raw_writel(value,
+	writel_relaxed(value,
 		     keypad_data->base + keypad_data->reg_offset + offset);
 }
 
 static int kbd_read_irqreg(struct omap4_keypad *keypad_data, u32 offset)
 {
-	return __raw_readl(keypad_data->base +
+	return readl_relaxed(keypad_data->base +
 				keypad_data->irqreg_offset + offset);
 }
 
 static void kbd_write_irqreg(struct omap4_keypad *keypad_data,
 			     u32 offset, u32 value)
 {
-	__raw_writel(value,
+	writel_relaxed(value,
 		     keypad_data->base + keypad_data->irqreg_offset + offset);
 }
 
@@ -312,7 +312,7 @@ static int omap4_keypad_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "pm_runtime_get_sync() failed\n");
 		goto err_unmap;
 	}
-	rev = __raw_readl(keypad_data->base + OMAP4_KBD_REVISION);
+	rev = readl_relaxed(keypad_data->base + OMAP4_KBD_REVISION);
 	rev &= 0x03 << 30;
 	rev >>= 30;
 	switch (rev) {
-- 
1.7.9.5


^ permalink raw reply related

* Re: [PATCH 4/4 v3] Input: wacom - add SW_TOUCH to include/uapi/linux/input.h
From: Ping Cheng @ 2013-11-15 21:59 UTC (permalink / raw)
  To: Chris Bagwell
  Cc: linux-input@vger.kernel.org, Dmitry Torokhov, Jason Gerecke,
	Peter Hutterer, Ping Cheng
In-Reply-To: <CAGzDe_Z8HjejCN8Hh3ABaTEwGWhauGHbprVKYuJAoOXuMumBxg@mail.gmail.com>

On Fri, Nov 15, 2013 at 1:28 PM, Chris Bagwell <chris@cnpbagwell.com> wrote:
> Thanks for breaking out... Its easier to review now as well.
>
> Small question below.
>
> On Fri, Nov 15, 2013 at 2:00 PM, Ping Cheng <pinglinux@gmail.com> wrote:
>> New Intuos series models added a hardware switch to turn touch
>> data on/off. To report the state of the switch, SW_TOUCH
>> is added in include/uapi/linux/input.h.
>>
>> Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
>> Tested-by: Jason Gerecke <killertofu@gmail.com>
>> Signed-off-by: Ping Cheng <pingc@wacom.com>
>> ---
>>  drivers/input/tablet/wacom_sys.c | 12 ++++++++++++
>>  drivers/input/tablet/wacom_wac.c | 30 +++++++++++++++++++++++++++---
>>  drivers/input/tablet/wacom_wac.h |  5 +++++
>>  include/uapi/linux/input.h       |  1 +
>>  4 files changed, 45 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
>> index 3a7d99c..bb72fa3 100644
>> --- a/drivers/input/tablet/wacom_sys.c
>> +++ b/drivers/input/tablet/wacom_sys.c
>> @@ -1193,6 +1193,8 @@ static void wacom_wireless_work(struct work_struct *work)
>>                 wacom_wac1->features.device_type = BTN_TOOL_PEN;
>>                 snprintf(wacom_wac1->name, WACOM_NAME_MAX, "%s (WL) Pen",
>>                          wacom_wac1->features.name);
>> +               wacom_wac1->shared->touch_max = wacom_wac1->features.touch_max;
>> +               wacom_wac1->shared->type = wacom_wac1->features.type;
>>                 error = wacom_register_input(wacom1);
>>                 if (error)
>>                         goto fail;
>> @@ -1214,6 +1216,10 @@ static void wacom_wireless_work(struct work_struct *work)
>>                         error = wacom_register_input(wacom2);
>>                         if (error)
>>                                 goto fail;
>> +
>> +                       if (wacom_wac1->features.type == INTUOSHT &&
>> +                           wacom_wac1->features.touch_max)
>> +                               wacom_wac->shared->touch_input = wacom_wac2->input;
>>                 }
>>
>>                 error = wacom_initialize_battery(wacom);
>> @@ -1392,6 +1398,12 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
>>                         goto fail5;
>>                 }
>>         }
>> +
>> +       if (wacom_wac->features.type == INTUOSHT && wacom_wac->features.touch_max) {
>> +               if (wacom_wac->features.device_type == BTN_TOOL_FINGER)
>> +                       wacom_wac->shared->touch_input = wacom_wac->input;
>> +       }
>> +
>>         return 0;
>>
>>   fail5: wacom_destroy_leds(wacom);
>> diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
>> index c0cd85d..70beca8 100644
>> --- a/drivers/input/tablet/wacom_wac.c
>> +++ b/drivers/input/tablet/wacom_wac.c
>> @@ -1220,13 +1220,23 @@ static int wacom_bpt3_touch(struct wacom_wac *wacom)
>>
>>  static int wacom_bpt_pen(struct wacom_wac *wacom)
>>  {
>> +       struct wacom_features *features = &wacom->features;
>>         struct input_dev *input = wacom->input;
>>         unsigned char *data = wacom->data;
>>         int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0;
>>
>> -       if (data[0] != WACOM_REPORT_PENABLED)
>> +       if (data[0] != WACOM_REPORT_PENABLED && data[0] != WACOM_REPORT_USB)
>>             return 0;
>>
>> +       if (data[0] == WACOM_REPORT_USB) {
>> +               if ((features->type == INTUOSHT) && features->touch_max) {
>> +                       input_report_switch(wacom->shared->touch_input,
>> +                                           SW_TOUCH, data[8] & 0x40);
>> +                       input_sync(wacom->shared->touch_input);
>> +               }
>> +               return 0;
>> +       }
>> +
>>         prox = (data[1] & 0x20) == 0x20;
>>
>>         /*
>> @@ -1259,8 +1269,8 @@ static int wacom_bpt_pen(struct wacom_wac *wacom)
>>                  * touching and applying pressure; do not report negative
>>                  * distance.
>>                  */
>> -               if (data[8] <= wacom->features.distance_max)
>> -                       d = wacom->features.distance_max - data[8];
>> +               if (data[8] <= features->distance_max)
>> +                       d = features->distance_max - data[8];
>>
>>                 pen = data[1] & 0x01;
>>                 btn1 = data[1] & 0x02;
>> @@ -1311,6 +1321,13 @@ static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len)
>>         if (connected) {
>>                 int pid, battery;
>>
>> +               if ((wacom->shared->type == INTUOSHT) &&
>> +                               wacom->shared->touch_max) {
>> +                       input_report_switch(wacom->shared->touch_input,
>> +                                       SW_TOUCH, data[5] & 0x40);
>> +                       input_sync(wacom->shared->touch_input);
>> +               }
>
> Earlier in patch, SW_TOUCH is read from pen interface and this time
> its read from wireless interface.  Is this to handle a HW model
> difference or wired/wireless difference?

Thank you, Chris, for your review and comments.

Nothing has changed for this chunk of code between this patch and any
of those earlier versions.

I think you mixed 3/4 and 4/4.

There are two kinds of connection we support with Intuos: USB and Wireless.

For USB connection. SW_TOUCH is reported on pen interface. For
wireless, it is reported through wireless interface. It is by design
in the hardware/firmware. I can not change that;-).

> I assume for wired case, it has to come from pen interface... no
> telling what wireless mode does different.
>
> Anyways, maybe a small comment is worthwhile to let people know why
> its needed twice?

It's not twice. They deal with different connections. Anyone has a
device to work on or read the code in whole, not in patches, should
understand that logic easily.

> I see now that its next to impossible to get rid of
> shared->touch_input... which means my old comments were invalid. So:
>
> Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>

Thank you for the Reviewed-by. Hope these months' old patches will
find their home soon.

Ping

>
>> +
>>                 pid = get_unaligned_be16(&data[6]);
>>                 battery = data[5] & 0x3f;
>>                 if (wacom->pid != pid) {
>> @@ -1780,6 +1797,13 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
>>                 break;
>>
>>         case INTUOSHT:
>> +               if (features->touch_max &&
>> +                   (features->device_type == BTN_TOOL_FINGER)) {
>> +                       input_dev->evbit[0] |= BIT_MASK(EV_SW);
>> +                       __set_bit(SW_TOUCH, input_dev->swbit);
>> +               }
>> +               /* fall through */
>> +
>>         case BAMBOO_PT:
>>                 __clear_bit(ABS_MISC, input_dev->absbit);
>>
>> diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
>> index 854cceb..3600cf7 100644
>> --- a/drivers/input/tablet/wacom_wac.h
>> +++ b/drivers/input/tablet/wacom_wac.h
>> @@ -55,6 +55,7 @@
>>  #define WACOM_REPORT_TPC1FGE           18
>>  #define WACOM_REPORT_24HDT             1
>>  #define WACOM_REPORT_WL                        128
>> +#define WACOM_REPORT_USB               192
>>
>>  /* device quirks */
>>  #define WACOM_QUIRK_MULTI_INPUT                0x0001
>> @@ -131,6 +132,10 @@ struct wacom_features {
>>  struct wacom_shared {
>>         bool stylus_in_proximity;
>>         bool touch_down;
>> +       /* for wireless device to access USB interfaces */
>> +       unsigned touch_max;
>> +       int type;
>> +       struct input_dev *touch_input;
>>  };
>>
>>  struct wacom_wac {
>> diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
>> index a372627..fcddcb1 100644
>> --- a/include/uapi/linux/input.h
>> +++ b/include/uapi/linux/input.h
>> @@ -856,6 +856,7 @@ struct input_keymap_entry {
>>  #define SW_FRONT_PROXIMITY     0x0b  /* set = front proximity sensor active */
>>  #define SW_ROTATE_LOCK         0x0c  /* set = rotate locked/disabled */
>>  #define SW_LINEIN_INSERT       0x0d  /* set = inserted */
>> +#define SW_TOUCH               0x0e  /* set = touch switch turned on (touch events off) */
>>  #define SW_MAX                 0x0f
>>  #define SW_CNT                 (SW_MAX+1)
>>
>> --
>> 1.8.3.2
>>

^ permalink raw reply

* Re: [PATCH 4/4 v3] Input: wacom - add SW_TOUCH to include/uapi/linux/input.h
From: Chris Bagwell @ 2013-11-15 21:45 UTC (permalink / raw)
  To: Ping Cheng
  Cc: linux-input@vger.kernel.org, Dmitry Torokhov, Jason Gerecke,
	Peter Hutterer, Ping Cheng
In-Reply-To: <CAF8JNhLk-ZH+w-EZi4yMpWqmG+ZeuSXhe9tQ_FOF5a0wE0A+-w@mail.gmail.com>

On Fri, Nov 15, 2013 at 3:38 PM, Ping Cheng <pinglinux@gmail.com> wrote:
> On Fri, Nov 15, 2013 at 1:33 PM, Chris Bagwell <chris@cnpbagwell.com> wrote:
>> On Fri, Nov 15, 2013 at 2:00 PM, Ping Cheng <pinglinux@gmail.com> wrote:
>>> New Intuos series models added a hardware switch to turn touch
>>> data on/off. To report the state of the switch, SW_TOUCH
>>> is added in include/uapi/linux/input.h.
>>>
>>
>> Any status on your patch to add SW_TOUCH event?  Maybe you should
>> resend since its been a while and this patch depends on it.
>
> Which patch do we still need? Isn't this the one? Without the below
> change, the driver would not compile.

Opps, overlooked that part of patch... Also, I was thinking originally
you sent this as its own patch and I didn't expect it here.

Never mind then.

Chris

>
>> diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
>> index a372627..fcddcb1 100644
>> --- a/include/uapi/linux/input.h
>> +++ b/include/uapi/linux/input.h
>> @@ -856,6 +856,7 @@ struct input_keymap_entry {
>>  #define SW_FRONT_PROXIMITY     0x0b  /* set = front proximity sensor active */
>>  #define SW_ROTATE_LOCK         0x0c  /* set = rotate locked/disabled */
>>  #define SW_LINEIN_INSERT       0x0d  /* set = inserted */
>> +#define SW_TOUCH               0x0e  /* set = touch switch turned on (touch events off) */
>>  #define SW_MAX                 0x0f
>>  #define SW_CNT                 (SW_MAX+1)
>
> Ping

^ permalink raw reply

* Re: [PATCH 4/4 v3] Input: wacom - add SW_TOUCH to include/uapi/linux/input.h
From: Ping Cheng @ 2013-11-15 21:38 UTC (permalink / raw)
  To: Chris Bagwell
  Cc: linux-input@vger.kernel.org, Dmitry Torokhov, Jason Gerecke,
	Peter Hutterer, Ping Cheng
In-Reply-To: <CAGzDe_ZsthR-QVHmut9eZue5ybOCKLRqh8-0V0y=rCRR=_pgeQ@mail.gmail.com>

On Fri, Nov 15, 2013 at 1:33 PM, Chris Bagwell <chris@cnpbagwell.com> wrote:
> On Fri, Nov 15, 2013 at 2:00 PM, Ping Cheng <pinglinux@gmail.com> wrote:
>> New Intuos series models added a hardware switch to turn touch
>> data on/off. To report the state of the switch, SW_TOUCH
>> is added in include/uapi/linux/input.h.
>>
>
> Any status on your patch to add SW_TOUCH event?  Maybe you should
> resend since its been a while and this patch depends on it.

Which patch do we still need? Isn't this the one? Without the below
change, the driver would not compile.

> diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
> index a372627..fcddcb1 100644
> --- a/include/uapi/linux/input.h
> +++ b/include/uapi/linux/input.h
> @@ -856,6 +856,7 @@ struct input_keymap_entry {
>  #define SW_FRONT_PROXIMITY     0x0b  /* set = front proximity sensor active */
>  #define SW_ROTATE_LOCK         0x0c  /* set = rotate locked/disabled */
>  #define SW_LINEIN_INSERT       0x0d  /* set = inserted */
> +#define SW_TOUCH               0x0e  /* set = touch switch turned on (touch events off) */
>  #define SW_MAX                 0x0f
>  #define SW_CNT                 (SW_MAX+1)

Ping

^ permalink raw reply

* Re: [PATCH 4/4 v3] Input: wacom - add SW_TOUCH to include/uapi/linux/input.h
From: Chris Bagwell @ 2013-11-15 21:33 UTC (permalink / raw)
  To: Ping Cheng
  Cc: linux-input@vger.kernel.org, Dmitry Torokhov, Jason Gerecke,
	Peter Hutterer, Ping Cheng
In-Reply-To: <1384545602-15549-1-git-send-email-pingc@wacom.com>

On Fri, Nov 15, 2013 at 2:00 PM, Ping Cheng <pinglinux@gmail.com> wrote:
> New Intuos series models added a hardware switch to turn touch
> data on/off. To report the state of the switch, SW_TOUCH
> is added in include/uapi/linux/input.h.
>

Any status on your patch to add SW_TOUCH event?  Maybe you should
resend since its been a while and this patch depends on it.

Chris

^ permalink raw reply

* Re: [PATCH 2/4 v3] input: wacom - make sure touch_max is set for touch devices
From: Chris Bagwell @ 2013-11-15 21:31 UTC (permalink / raw)
  To: Ping Cheng
  Cc: linux-input@vger.kernel.org, Dmitry Torokhov, Jason Gerecke,
	Peter Hutterer, Ping Cheng
In-Reply-To: <1384545554-15472-1-git-send-email-pingc@wacom.com>

On Fri, Nov 15, 2013 at 1:59 PM, Ping Cheng <pinglinux@gmail.com> wrote:
> 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.

Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>

>
> Tested-by: Jason Gerecke <killertofu@gmail.com>
> Signed-off-by: Ping Cheng <pingc@wacom.com>
> ---
>  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 8a90da1..3d71b60 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.3.2
>

^ permalink raw reply

* Re: [PATCH 4/4 v3] Input: wacom - add SW_TOUCH to include/uapi/linux/input.h
From: Chris Bagwell @ 2013-11-15 21:28 UTC (permalink / raw)
  To: Ping Cheng
  Cc: linux-input@vger.kernel.org, Dmitry Torokhov, Jason Gerecke,
	Peter Hutterer, Ping Cheng
In-Reply-To: <1384545602-15549-1-git-send-email-pingc@wacom.com>

Thanks for breaking out... Its easier to review now as well.

Small question below.

On Fri, Nov 15, 2013 at 2:00 PM, Ping Cheng <pinglinux@gmail.com> wrote:
> New Intuos series models added a hardware switch to turn touch
> data on/off. To report the state of the switch, SW_TOUCH
> is added in include/uapi/linux/input.h.
>
> Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
> Tested-by: Jason Gerecke <killertofu@gmail.com>
> Signed-off-by: Ping Cheng <pingc@wacom.com>
> ---
>  drivers/input/tablet/wacom_sys.c | 12 ++++++++++++
>  drivers/input/tablet/wacom_wac.c | 30 +++++++++++++++++++++++++++---
>  drivers/input/tablet/wacom_wac.h |  5 +++++
>  include/uapi/linux/input.h       |  1 +
>  4 files changed, 45 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
> index 3a7d99c..bb72fa3 100644
> --- a/drivers/input/tablet/wacom_sys.c
> +++ b/drivers/input/tablet/wacom_sys.c
> @@ -1193,6 +1193,8 @@ static void wacom_wireless_work(struct work_struct *work)
>                 wacom_wac1->features.device_type = BTN_TOOL_PEN;
>                 snprintf(wacom_wac1->name, WACOM_NAME_MAX, "%s (WL) Pen",
>                          wacom_wac1->features.name);
> +               wacom_wac1->shared->touch_max = wacom_wac1->features.touch_max;
> +               wacom_wac1->shared->type = wacom_wac1->features.type;
>                 error = wacom_register_input(wacom1);
>                 if (error)
>                         goto fail;
> @@ -1214,6 +1216,10 @@ static void wacom_wireless_work(struct work_struct *work)
>                         error = wacom_register_input(wacom2);
>                         if (error)
>                                 goto fail;
> +
> +                       if (wacom_wac1->features.type == INTUOSHT &&
> +                           wacom_wac1->features.touch_max)
> +                               wacom_wac->shared->touch_input = wacom_wac2->input;
>                 }
>
>                 error = wacom_initialize_battery(wacom);
> @@ -1392,6 +1398,12 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
>                         goto fail5;
>                 }
>         }
> +
> +       if (wacom_wac->features.type == INTUOSHT && wacom_wac->features.touch_max) {
> +               if (wacom_wac->features.device_type == BTN_TOOL_FINGER)
> +                       wacom_wac->shared->touch_input = wacom_wac->input;
> +       }
> +
>         return 0;
>
>   fail5: wacom_destroy_leds(wacom);
> diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
> index c0cd85d..70beca8 100644
> --- a/drivers/input/tablet/wacom_wac.c
> +++ b/drivers/input/tablet/wacom_wac.c
> @@ -1220,13 +1220,23 @@ static int wacom_bpt3_touch(struct wacom_wac *wacom)
>
>  static int wacom_bpt_pen(struct wacom_wac *wacom)
>  {
> +       struct wacom_features *features = &wacom->features;
>         struct input_dev *input = wacom->input;
>         unsigned char *data = wacom->data;
>         int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0;
>
> -       if (data[0] != WACOM_REPORT_PENABLED)
> +       if (data[0] != WACOM_REPORT_PENABLED && data[0] != WACOM_REPORT_USB)
>             return 0;
>
> +       if (data[0] == WACOM_REPORT_USB) {
> +               if ((features->type == INTUOSHT) && features->touch_max) {
> +                       input_report_switch(wacom->shared->touch_input,
> +                                           SW_TOUCH, data[8] & 0x40);
> +                       input_sync(wacom->shared->touch_input);
> +               }
> +               return 0;
> +       }
> +
>         prox = (data[1] & 0x20) == 0x20;
>
>         /*
> @@ -1259,8 +1269,8 @@ static int wacom_bpt_pen(struct wacom_wac *wacom)
>                  * touching and applying pressure; do not report negative
>                  * distance.
>                  */
> -               if (data[8] <= wacom->features.distance_max)
> -                       d = wacom->features.distance_max - data[8];
> +               if (data[8] <= features->distance_max)
> +                       d = features->distance_max - data[8];
>
>                 pen = data[1] & 0x01;
>                 btn1 = data[1] & 0x02;
> @@ -1311,6 +1321,13 @@ static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len)
>         if (connected) {
>                 int pid, battery;
>
> +               if ((wacom->shared->type == INTUOSHT) &&
> +                               wacom->shared->touch_max) {
> +                       input_report_switch(wacom->shared->touch_input,
> +                                       SW_TOUCH, data[5] & 0x40);
> +                       input_sync(wacom->shared->touch_input);
> +               }

Earlier in patch, SW_TOUCH is read from pen interface and this time
its read from wireless interface.  Is this to handle a HW model
difference or wired/wireless difference?

I assume for wired case, it has to come from pen interface... no
telling what wireless mode does different.

Anyways, maybe a small comment is worthwhile to let people know why
its needed twice?

I see now that its next to impossible to get rid of
shared->touch_input... which means my old comments were invalid. So:

Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>

> +
>                 pid = get_unaligned_be16(&data[6]);
>                 battery = data[5] & 0x3f;
>                 if (wacom->pid != pid) {
> @@ -1780,6 +1797,13 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
>                 break;
>
>         case INTUOSHT:
> +               if (features->touch_max &&
> +                   (features->device_type == BTN_TOOL_FINGER)) {
> +                       input_dev->evbit[0] |= BIT_MASK(EV_SW);
> +                       __set_bit(SW_TOUCH, input_dev->swbit);
> +               }
> +               /* fall through */
> +
>         case BAMBOO_PT:
>                 __clear_bit(ABS_MISC, input_dev->absbit);
>
> diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
> index 854cceb..3600cf7 100644
> --- a/drivers/input/tablet/wacom_wac.h
> +++ b/drivers/input/tablet/wacom_wac.h
> @@ -55,6 +55,7 @@
>  #define WACOM_REPORT_TPC1FGE           18
>  #define WACOM_REPORT_24HDT             1
>  #define WACOM_REPORT_WL                        128
> +#define WACOM_REPORT_USB               192
>
>  /* device quirks */
>  #define WACOM_QUIRK_MULTI_INPUT                0x0001
> @@ -131,6 +132,10 @@ struct wacom_features {
>  struct wacom_shared {
>         bool stylus_in_proximity;
>         bool touch_down;
> +       /* for wireless device to access USB interfaces */
> +       unsigned touch_max;
> +       int type;
> +       struct input_dev *touch_input;
>  };
>
>  struct wacom_wac {
> diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
> index a372627..fcddcb1 100644
> --- a/include/uapi/linux/input.h
> +++ b/include/uapi/linux/input.h
> @@ -856,6 +856,7 @@ struct input_keymap_entry {
>  #define SW_FRONT_PROXIMITY     0x0b  /* set = front proximity sensor active */
>  #define SW_ROTATE_LOCK         0x0c  /* set = rotate locked/disabled */
>  #define SW_LINEIN_INSERT       0x0d  /* set = inserted */
> +#define SW_TOUCH               0x0e  /* set = touch switch turned on (touch events off) */
>  #define SW_MAX                 0x0f
>  #define SW_CNT                 (SW_MAX+1)
>
> --
> 1.8.3.2
>

^ permalink raw reply

* [PATCH 26/31] Input: tegra-kbc - use reset framework
From: Stephen Warren @ 2013-11-15 20:54 UTC (permalink / raw)
  To: swarren
  Cc: Stephen Warren, treding, pdeschrijver, linux-tegra,
	linux-arm-kernel, Dmitry Torokhov, Dmitry Torokhov, linux-input
In-Reply-To: <1384548866-13141-1-git-send-email-swarren@wwwdotorg.org>

From: Stephen Warren <swarren@nvidia.com>

Tegra's clock driver now provides an implementation of the common
reset API (include/linux/reset.h). Use this instead of the old Tegra-
specific API; that will soon be removed.

Cc: treding@nvidia.com
Cc: pdeschrijver@nvidia.com
Cc: linux-tegra@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Dmitry Torokhov <dtor@mail.ru>
Cc: linux-input@vger.kernel.org
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
This patch is part of a series with strong internal depdendencies. I'm
looking for an ack so that I can take the entire series through the Tegra
and arm-soc trees. The series will be part of a stable branch that can be
merged into other subsystems if needed to avoid/resolve dependencies.
---
 drivers/input/keyboard/tegra-kbc.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c
index 8508879f6faf..9757a58bc897 100644
--- a/drivers/input/keyboard/tegra-kbc.c
+++ b/drivers/input/keyboard/tegra-kbc.c
@@ -31,7 +31,7 @@
 #include <linux/clk.h>
 #include <linux/slab.h>
 #include <linux/input/matrix_keypad.h>
-#include <linux/clk/tegra.h>
+#include <linux/reset.h>
 #include <linux/err.h>
 
 #define KBC_MAX_KPENT	8
@@ -116,6 +116,7 @@ struct tegra_kbc {
 	u32 wakeup_key;
 	struct timer_list timer;
 	struct clk *clk;
+	struct reset_control *rst;
 	const struct tegra_kbc_hw_support *hw_support;
 	int max_keys;
 	int num_rows_and_columns;
@@ -373,9 +374,9 @@ static int tegra_kbc_start(struct tegra_kbc *kbc)
 	clk_prepare_enable(kbc->clk);
 
 	/* Reset the KBC controller to clear all previous status.*/
-	tegra_periph_reset_assert(kbc->clk);
+	reset_control_assert(kbc->rst);
 	udelay(100);
-	tegra_periph_reset_deassert(kbc->clk);
+	reset_control_assert(kbc->rst);
 	udelay(100);
 
 	tegra_kbc_config_pins(kbc);
@@ -663,6 +664,12 @@ static int tegra_kbc_probe(struct platform_device *pdev)
 		return PTR_ERR(kbc->clk);
 	}
 
+	kbc->rst = devm_reset_control_get(&pdev->dev, "kbc");
+	if (IS_ERR(kbc->rst)) {
+		dev_err(&pdev->dev, "failed to get keyboard reset\n");
+		return PTR_ERR(kbc->rst);
+	}
+
 	/*
 	 * The time delay between two consecutive reads of the FIFO is
 	 * the sum of the repeat time and the time taken for scanning
-- 
1.8.1.5


^ permalink raw reply related

* [PATCH 00/31] ARM: tegra: use common reset and DMA bindings
From: Stephen Warren @ 2013-11-15 20:53 UTC (permalink / raw)
  To: swarren
  Cc: Mark Rutland, alsa-devel, linux-usb, Wolfram Sang, David Airlie,
	linux-pci, dri-devel, Marc Dietrich, linux-tegra, linux-i2c,
	ac100, devel, Stephen Warren, Alan Stern, linux-serial,
	linux-input, Terje Bergström, devicetree, Pawel Moll,
	Ian Campbell, Julian Andres Klode, Rob Herring, Mark Brown,
	Bjorn Helgaas, Mike Turquette

From: Stephen Warren <swarren@nvidia.com>

This series implements a common reset framework driver for Tegra, and
updates all relevant Tegra drivers to use it. It also removes the custom
DMA bindings and replaced them with the standard DMA DT bindings.

Historically, the Tegra clock driver has exported a custom API for module
reset. This series removes that API, and transitions DT and drivers to
the new reset framework.

The custom API used a "struct clk" to identify which module to reset, and
consequently some DT bindings and drivers required clocks to be provided
where they really needed just a reset identifier instead. Due to this
known deficiency, I have always considered most Tegra bindings to be
unstable. This series removes this excuse for instability, although I
still consider some Tegra bindings unstable due to the need to convert to
the common DMA bindings.

Historically, Tegra DMA channels have been represented in DT using a
custom nvidia,dma-request-selector property. Now that standard DMA DT
bindings exist, convert all Tegra bindings, DTs, and drivers to use the
standard instead.

This series makes a DT-ABI-incompatible change to:
- Require reset specifiers in DT where relevant.
- Require standard DMA specifiers.
- Remove clock specifiers from DT where they were only needed for reset.
- Remove legacy DMA specifier properties.

I anticipate merging this whole series into the Tegra and arm-soc trees
as its own branch, due to internal dependencies. This branch will be
stable and can then be merged into any other subsystem trees should any
conflicts arise.

This series depends on Peter's Tegra clock driver rework, available at
git://nv-tegra.nvidia.com/user/pdeschrijver/linux tegra-clk-tegra124-0
(or whatever version of that gets included in 3.14)

Cc: ac100@lists.launchpad.net
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: alsa-devel@alsa-project.org
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: David Airlie <airlied@linux.ie>
Cc: devel@driverdev.osuosl.org
Cc: devicetree@vger.kernel.org
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Dmitry Torokhov <dtor@mail.ru>
Cc: dri-devel@lists.freedesktop.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Ian Campbell <ijc+devicetree@hellion.org.uk>
Cc: Julian Andres Klode <jak@jak-linux.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-i2c@vger.kernel.org
Cc: linux-input@vger.kernel.org
Cc: linux-pci@vger.kernel.org
Cc: linux-serial@vger.kernel.org
Cc: linux-spi@vger.kernel.org
Cc: linux-tegra@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Cc: Marc Dietrich <marvin24@gmx.de>
Cc: Mark Brown <broonie@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mike Turquette <mturquette@linaro.org>
Cc: Pawel Moll <pawel.moll@arm.com>
Cc: pdeschrijver@nvidia.com
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Terje Bergström <tbergstrom@nvidia.com>
Cc: treding@nvidia.com
Cc: Wolfram Sang <wsa@the-dreams.de>

Stephen Warren (31):
  ARM: tegra: add missing clock documentation to DT bindings
  ARM: tegra: document reset properties in DT bindings
  ARM: tegra: document use of standard DMA DT bindings
  ARM: tegra: update DT files to add reset properties
  ARM: tegra: update DT files to add DMA properties
  ARM: tegra: select the reset framework
  clk: tegra: implement a reset driver
  pci: tegra: use reset framework
  drm/tegra: use reset framework
  ARM: tegra: pass reset to tegra_powergate_sequence_power_up()
  dma: add channel request API that supports deferred probe
  dma: tegra: use reset framework
  dma: tegra: register as an OF DMA controller
  ASoC: dmaengine: support deferred probe for DMA channels
  ASoC: dmaengine: add custom DMA config to snd_dmaengine_pcm_config
  ASoC: tegra: use reset framework
  ASoC: tegra: call pm_runtime APIs around register accesses
  ASoC: tegra: allocate AHUB FIFO during probe() not startup()
  ASoC: tegra: convert to standard DMA DT bindings
  i2c: tegra: use reset framework
  staging: nvec: use reset framework
  spi: tegra: use reset framework
  spi: tegra: convert to standard DMA DT bindings
  serial: tegra: use reset framework
  serial: tegra: convert to standard DMA DT bindings
  Input: tegra-kbc - use reset framework
  USB: EHCI: tegra: use reset framework
  ARM: tegra: remove legacy clock entries from DT
  ARM: tegra: remove legacy DMA entries from DT
  clk: tegra: remove legacy reset APIs
  clk: tegra: remove bogus PCIE_XCLK

 .../bindings/arm/tegra/nvidia,tegra20-pmc.txt      |   1 +
 .../bindings/clock/nvidia,tegra114-car.txt         |   4 +
 .../bindings/clock/nvidia,tegra124-car.txt         |   4 +
 .../bindings/clock/nvidia,tegra20-car.txt          |   4 +
 .../bindings/clock/nvidia,tegra30-car.txt          |   4 +
 .../devicetree/bindings/dma/tegra20-apbdma.txt     |   9 ++
 .../bindings/gpu/nvidia,tegra20-host1x.txt         | 124 +++++++++++++++
 .../devicetree/bindings/i2c/nvidia,tegra20-i2c.txt |  27 +++-
 .../bindings/input/nvidia,tegra20-kbc.txt          |   9 ++
 .../bindings/mmc/nvidia,tegra20-sdhci.txt          |   9 ++
 .../devicetree/bindings/nvec/nvidia,nvec.txt       |  12 ++
 .../bindings/pci/nvidia,tegra20-pcie.txt           |  28 ++--
 .../devicetree/bindings/pwm/nvidia,tegra20-pwm.txt |   9 ++
 .../devicetree/bindings/rtc/nvidia,tegra20-rtc.txt |   3 +
 .../bindings/serial/nvidia,tegra20-hsuart.txt      |  19 ++-
 .../bindings/sound/nvidia,tegra-audio-alc5632.txt  |   7 +-
 .../bindings/sound/nvidia,tegra-audio-rt5640.txt   |   7 +-
 .../bindings/sound/nvidia,tegra-audio-wm8753.txt   |   7 +-
 .../bindings/sound/nvidia,tegra-audio-wm8903.txt   |   7 +-
 .../bindings/sound/nvidia,tegra-audio-wm9712.txt   |   7 +-
 .../bindings/sound/nvidia,tegra20-ac97.txt         |  20 ++-
 .../bindings/sound/nvidia,tegra20-i2s.txt          |  19 ++-
 .../bindings/sound/nvidia,tegra30-ahub.txt         |  54 +++++--
 .../bindings/sound/nvidia,tegra30-i2s.txt          |  11 +-
 .../bindings/spi/nvidia,tegra114-spi.txt           |  24 ++-
 .../bindings/spi/nvidia,tegra20-sflash.txt         |  20 ++-
 .../bindings/spi/nvidia,tegra20-slink.txt          |  20 ++-
 .../bindings/timer/nvidia,tegra20-timer.txt        |   3 +
 .../bindings/timer/nvidia,tegra30-timer.txt        |   3 +
 .../bindings/usb/nvidia,tegra20-ehci.txt           |   7 +-
 arch/arm/boot/dts/tegra114.dtsi                    | 142 ++++++++++++++---
 arch/arm/boot/dts/tegra20-paz00.dts                |   2 +
 arch/arm/boot/dts/tegra20.dtsi                     | 132 ++++++++++++++--
 arch/arm/boot/dts/tegra30.dtsi                     | 171 +++++++++++++++++----
 arch/arm/mach-tegra/Kconfig                        |   2 +
 arch/arm/mach-tegra/powergate.c                    |   8 +-
 drivers/clk/tegra/clk-periph-gate.c                |  22 ---
 drivers/clk/tegra/clk-periph.c                     |  40 -----
 drivers/clk/tegra/clk-tegra114.c                   |   3 +-
 drivers/clk/tegra/clk-tegra124.c                   |   2 +-
 drivers/clk/tegra/clk-tegra20.c                    |   9 +-
 drivers/clk/tegra/clk-tegra30.c                    |  10 +-
 drivers/clk/tegra/clk.c                            |  55 ++++++-
 drivers/clk/tegra/clk.h                            |   3 +-
 drivers/dma/acpi-dma.c                             |  12 +-
 drivers/dma/dmaengine.c                            |  44 +++++-
 drivers/dma/of-dma.c                               |  12 +-
 drivers/dma/tegra20-apb-dma.c                      |  49 +++++-
 drivers/gpu/drm/tegra/Kconfig                      |   1 +
 drivers/gpu/drm/tegra/dc.c                         |   9 +-
 drivers/gpu/drm/tegra/drm.h                        |   3 +
 drivers/gpu/drm/tegra/gr3d.c                       |  22 ++-
 drivers/gpu/drm/tegra/hdmi.c                       |  14 +-
 drivers/i2c/busses/i2c-tegra.c                     |  13 +-
 drivers/input/keyboard/tegra-kbc.c                 |  13 +-
 drivers/pci/host/pci-tegra.c                       |  52 +++++--
 drivers/spi/Kconfig                                |   3 +
 drivers/spi/spi-tegra114.c                         |  66 ++++----
 drivers/spi/spi-tegra20-sflash.c                   |  18 ++-
 drivers/spi/spi-tegra20-slink.c                    |  66 ++++----
 drivers/staging/nvec/nvec.c                        |  11 +-
 drivers/staging/nvec/nvec.h                        |   5 +-
 drivers/tty/serial/serial-tegra.c                  |  86 +++++------
 drivers/usb/host/ehci-tegra.c                      |  14 +-
 include/dt-bindings/clock/tegra20-car.h            |   2 +-
 include/dt-bindings/clock/tegra30-car.h            |   2 +-
 include/linux/clk/tegra.h                          |   7 -
 include/linux/dmaengine.h                          |   7 +
 include/linux/of_dma.h                             |   9 +-
 include/linux/tegra-powergate.h                    |   4 +-
 include/sound/dmaengine_pcm.h                      |   6 +
 sound/soc/soc-generic-dmaengine-pcm.c              |  82 +++++++---
 sound/soc/tegra/Kconfig                            |   2 +
 sound/soc/tegra/tegra20_ac97.c                     |  11 --
 sound/soc/tegra/tegra20_i2s.c                      |  20 +--
 sound/soc/tegra/tegra30_ahub.c                     | 125 +++++++++------
 sound/soc/tegra/tegra30_ahub.h                     |  11 +-
 sound/soc/tegra/tegra30_i2s.c                      |  97 ++++++------
 sound/soc/tegra/tegra30_i2s.h                      |   3 +
 sound/soc/tegra/tegra_pcm.c                        |  17 +-
 sound/soc/tegra/tegra_pcm.h                        |   5 +
 81 files changed, 1448 insertions(+), 558 deletions(-)

-- 
1.8.1.5


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* [PATCH 4/4 v3] Input: wacom - add SW_TOUCH to include/uapi/linux/input.h
From: Ping Cheng @ 2013-11-15 20:00 UTC (permalink / raw)
  To: linux-input
  Cc: dmitry.torokhov, killertofu, chris, peter.hutterer, Ping Cheng

New Intuos series models added a hardware switch to turn touch
data on/off. To report the state of the switch, SW_TOUCH
is added in include/uapi/linux/input.h.

Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Ping Cheng <pingc@wacom.com>
---
 drivers/input/tablet/wacom_sys.c | 12 ++++++++++++
 drivers/input/tablet/wacom_wac.c | 30 +++++++++++++++++++++++++++---
 drivers/input/tablet/wacom_wac.h |  5 +++++
 include/uapi/linux/input.h       |  1 +
 4 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index 3a7d99c..bb72fa3 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -1193,6 +1193,8 @@ static void wacom_wireless_work(struct work_struct *work)
 		wacom_wac1->features.device_type = BTN_TOOL_PEN;
 		snprintf(wacom_wac1->name, WACOM_NAME_MAX, "%s (WL) Pen",
 			 wacom_wac1->features.name);
+		wacom_wac1->shared->touch_max = wacom_wac1->features.touch_max;
+		wacom_wac1->shared->type = wacom_wac1->features.type;
 		error = wacom_register_input(wacom1);
 		if (error)
 			goto fail;
@@ -1214,6 +1216,10 @@ static void wacom_wireless_work(struct work_struct *work)
 			error = wacom_register_input(wacom2);
 			if (error)
 				goto fail;
+
+			if (wacom_wac1->features.type == INTUOSHT &&
+			    wacom_wac1->features.touch_max)
+				wacom_wac->shared->touch_input = wacom_wac2->input;
 		}
 
 		error = wacom_initialize_battery(wacom);
@@ -1392,6 +1398,12 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
 			goto fail5;
 		}
 	}
+
+	if (wacom_wac->features.type == INTUOSHT && wacom_wac->features.touch_max) {
+		if (wacom_wac->features.device_type == BTN_TOOL_FINGER)
+			wacom_wac->shared->touch_input = wacom_wac->input;
+	}
+
 	return 0;
 
  fail5: wacom_destroy_leds(wacom);
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index c0cd85d..70beca8 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -1220,13 +1220,23 @@ static int wacom_bpt3_touch(struct wacom_wac *wacom)
 
 static int wacom_bpt_pen(struct wacom_wac *wacom)
 {
+	struct wacom_features *features = &wacom->features;
 	struct input_dev *input = wacom->input;
 	unsigned char *data = wacom->data;
 	int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0;
 
-	if (data[0] != WACOM_REPORT_PENABLED)
+	if (data[0] != WACOM_REPORT_PENABLED && data[0] != WACOM_REPORT_USB)
 	    return 0;
 
+	if (data[0] == WACOM_REPORT_USB) {
+		if ((features->type == INTUOSHT) && features->touch_max) {
+			input_report_switch(wacom->shared->touch_input,
+					    SW_TOUCH, data[8] & 0x40);
+			input_sync(wacom->shared->touch_input);
+		}
+		return 0;
+	}
+
 	prox = (data[1] & 0x20) == 0x20;
 
 	/*
@@ -1259,8 +1269,8 @@ static int wacom_bpt_pen(struct wacom_wac *wacom)
 		 * touching and applying pressure; do not report negative
 		 * distance.
 		 */
-		if (data[8] <= wacom->features.distance_max)
-			d = wacom->features.distance_max - data[8];
+		if (data[8] <= features->distance_max)
+			d = features->distance_max - data[8];
 
 		pen = data[1] & 0x01;
 		btn1 = data[1] & 0x02;
@@ -1311,6 +1321,13 @@ static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len)
 	if (connected) {
 		int pid, battery;
 
+		if ((wacom->shared->type == INTUOSHT) &&
+				wacom->shared->touch_max) {
+			input_report_switch(wacom->shared->touch_input,
+					SW_TOUCH, data[5] & 0x40);
+			input_sync(wacom->shared->touch_input);
+		}
+
 		pid = get_unaligned_be16(&data[6]);
 		battery = data[5] & 0x3f;
 		if (wacom->pid != pid) {
@@ -1780,6 +1797,13 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
 		break;
 
 	case INTUOSHT:
+		if (features->touch_max &&
+		    (features->device_type == BTN_TOOL_FINGER)) {
+			input_dev->evbit[0] |= BIT_MASK(EV_SW);
+			__set_bit(SW_TOUCH, input_dev->swbit);
+		}
+		/* fall through */
+
 	case BAMBOO_PT:
 		__clear_bit(ABS_MISC, input_dev->absbit);
 
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index 854cceb..3600cf7 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -55,6 +55,7 @@
 #define WACOM_REPORT_TPC1FGE		18
 #define WACOM_REPORT_24HDT		1
 #define WACOM_REPORT_WL			128
+#define WACOM_REPORT_USB		192
 
 /* device quirks */
 #define WACOM_QUIRK_MULTI_INPUT		0x0001
@@ -131,6 +132,10 @@ struct wacom_features {
 struct wacom_shared {
 	bool stylus_in_proximity;
 	bool touch_down;
+	/* for wireless device to access USB interfaces */
+	unsigned touch_max;
+	int type;
+	struct input_dev *touch_input;
 };
 
 struct wacom_wac {
diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
index a372627..fcddcb1 100644
--- a/include/uapi/linux/input.h
+++ b/include/uapi/linux/input.h
@@ -856,6 +856,7 @@ struct input_keymap_entry {
 #define SW_FRONT_PROXIMITY	0x0b  /* set = front proximity sensor active */
 #define SW_ROTATE_LOCK		0x0c  /* set = rotate locked/disabled */
 #define SW_LINEIN_INSERT	0x0d  /* set = inserted */
+#define SW_TOUCH		0x0e  /* set = touch switch turned on (touch events off) */
 #define SW_MAX			0x0f
 #define SW_CNT			(SW_MAX+1)
 
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 3/4 v3] Input: wacom - add support for three new Intuos devices
From: Ping Cheng @ 2013-11-15 19:59 UTC (permalink / raw)
  To: linux-input
  Cc: dmitry.torokhov, killertofu, chris, peter.hutterer, Ping Cheng

Two tablets in this series support both pen and touch. One (Intuos S)
only supports pen. This patch also updates the driver to process wireless
devices that do not support touch interface.

Tested-by: Jason Gerecke <killertofu@gmail.com>
Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>
Signed-off-by: Ping Cheng <pingc@wacom.com>
---
 drivers/input/tablet/wacom_sys.c |  6 ++--
 drivers/input/tablet/wacom_wac.c | 62 ++++++++++++++++++++++++++++++----------
 drivers/input/tablet/wacom_wac.h |  2 ++
 3 files changed, 52 insertions(+), 18 deletions(-)

diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index 3d71b60..3a7d99c 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -1198,7 +1198,8 @@ static void wacom_wireless_work(struct work_struct *work)
 			goto fail;
 
 		/* Touch interface */
-		if (wacom_wac1->features.touch_max) {
+		if (wacom_wac1->features.touch_max ||
+		    wacom_wac1->features.type == INTUOSHT) {
 			wacom_wac2->features =
 				*((struct wacom_features *)id->driver_info);
 			wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3;
@@ -1321,7 +1322,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
 	 * HID descriptor. If this is the touch interface (wMaxPacketSize
 	 * of WACOM_PKGLEN_BBTOUCH3), override the table values.
 	 */
-	if (features->type >= INTUOS5S && features->type <= INTUOSPL) {
+	if (features->type >= INTUOS5S && features->type <= INTUOSHT) {
 		if (endpoint->wMaxPacketSize == WACOM_PKGLEN_BBTOUCH3) {
 			features->device_type = BTN_TOOL_FINGER;
 			features->pktlen = WACOM_PKGLEN_BBTOUCH3;
@@ -1391,7 +1392,6 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
 			goto fail5;
 		}
 	}
-
 	return 0;
 
  fail5: wacom_destroy_leds(wacom);
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 3f75f1d..c0cd85d 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -1176,10 +1176,17 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
 static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data)
 {
 	struct input_dev *input = wacom->input;
+	struct wacom_features *features = &wacom->features;
 
-	input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
+	if (features->type == INTUOSHT) {
+		input_report_key(input, BTN_LEFT, (data[1] & 0x02) != 0);
+		input_report_key(input, BTN_BACK, (data[1] & 0x08) != 0);
+	} else {
+
+		input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0);
+		input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
+	}
 	input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0);
-	input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0);
 	input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0);
 }
 
@@ -1217,7 +1224,7 @@ static int wacom_bpt_pen(struct wacom_wac *wacom)
 	unsigned char *data = wacom->data;
 	int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0;
 
-	if (data[0] != 0x02)
+	if (data[0] != WACOM_REPORT_PENABLED)
 	    return 0;
 
 	prox = (data[1] & 0x20) == 0x20;
@@ -1297,7 +1304,7 @@ static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len)
 	unsigned char *data = wacom->data;
 	int connected;
 
-	if (len != WACOM_PKGLEN_WIRELESS || data[0] != 0x80)
+	if (len != WACOM_PKGLEN_WIRELESS || data[0] != WACOM_REPORT_WL)
 		return 0;
 
 	connected = data[1] & 0x01;
@@ -1391,6 +1398,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
 		break;
 
 	case BAMBOO_PT:
+	case INTUOSHT:
 		sync = wacom_bpt_irq(wacom_wac, len);
 		break;
 
@@ -1459,7 +1467,7 @@ void wacom_setup_device_quirks(struct wacom_features *features)
 
 	/* these device have multiple inputs */
 	if (features->type >= WIRELESS ||
-	    (features->type >= INTUOS5S && features->type <= INTUOSPL) ||
+	    (features->type >= INTUOS5S && features->type <= INTUOSHT) ||
 	    (features->oVid && features->oPid))
 		features->quirks |= WACOM_QUIRK_MULTI_INPUT;
 
@@ -1771,33 +1779,43 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
 		__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
 		break;
 
+	case INTUOSHT:
 	case BAMBOO_PT:
 		__clear_bit(ABS_MISC, input_dev->absbit);
 
-		__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
-
 		if (features->device_type == BTN_TOOL_FINGER) {
-			unsigned int flags = INPUT_MT_POINTER;
 
 			__set_bit(BTN_LEFT, input_dev->keybit);
 			__set_bit(BTN_FORWARD, input_dev->keybit);
 			__set_bit(BTN_BACK, input_dev->keybit);
 			__set_bit(BTN_RIGHT, input_dev->keybit);
 
-			if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
-				input_set_abs_params(input_dev,
+			if (features->touch_max) {
+				/* touch interface */
+				unsigned int flags = INPUT_MT_POINTER;
+
+				__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
+				if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
+					input_set_abs_params(input_dev,
 						     ABS_MT_TOUCH_MAJOR,
 						     0, features->x_max, 0, 0);
-				input_set_abs_params(input_dev,
+					input_set_abs_params(input_dev,
 						     ABS_MT_TOUCH_MINOR,
 						     0, features->y_max, 0, 0);
+				} else {
+					__set_bit(BTN_TOOL_FINGER, input_dev->keybit);
+					__set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
+					flags = 0;
+				}
+				input_mt_init_slots(input_dev, features->touch_max, flags);
 			} else {
-				__set_bit(BTN_TOOL_FINGER, input_dev->keybit);
-				__set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
-				flags = 0;
+				/* buttons/keys only interface */
+				__clear_bit(ABS_X, input_dev->absbit);
+				__clear_bit(ABS_Y, input_dev->absbit);
+				__clear_bit(BTN_TOUCH, input_dev->keybit);
 			}
-			input_mt_init_slots(input_dev, features->touch_max, flags);
 		} else if (features->device_type == BTN_TOOL_PEN) {
+			__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
 			__set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
 			__set_bit(BTN_TOOL_PEN, input_dev->keybit);
 			__set_bit(BTN_STYLUS, input_dev->keybit);
@@ -2194,6 +2212,17 @@ static const struct wacom_features wacom_features_0x300 =
 static const struct wacom_features wacom_features_0x301 =
 	{ "Wacom Bamboo One M",    WACOM_PKGLEN_BBPEN,    21648, 13530, 1023,
 	  31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
+static const struct wacom_features wacom_features_0x302 =
+	{ "Wacom Intuos PT S",     WACOM_PKGLEN_BBPEN,    15200,  9500, 1023,
+	  31, INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
+	  .touch_max = 16 };
+static const struct wacom_features wacom_features_0x303 =
+	{ "Wacom Intuos PT M",     WACOM_PKGLEN_BBPEN,    21600, 13500, 1023,
+	  31, INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
+	  .touch_max = 16 };
+static const struct wacom_features wacom_features_0x30E =
+	{ "Wacom Intuos S",        WACOM_PKGLEN_BBPEN,    15200,  9500, 1023,
+	  31, INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
 static const struct wacom_features wacom_features_0x6004 =
 	{ "ISD-V4",               WACOM_PKGLEN_GRAPHIRE,  12800,  8000,  255,
 	  0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
@@ -2329,6 +2358,9 @@ const struct usb_device_id wacom_ids[] = {
 	{ USB_DEVICE_WACOM(0x10D) },
 	{ USB_DEVICE_WACOM(0x300) },
 	{ USB_DEVICE_WACOM(0x301) },
+	{ USB_DEVICE_DETAILED(0x302, USB_CLASS_HID, 0, 0) },
+	{ USB_DEVICE_DETAILED(0x303, USB_CLASS_HID, 0, 0) },
+	{ USB_DEVICE_DETAILED(0x30E, USB_CLASS_HID, 0, 0) },
 	{ USB_DEVICE_WACOM(0x304) },
 	{ USB_DEVICE_DETAILED(0x314, USB_CLASS_HID, 0, 0) },
 	{ USB_DEVICE_DETAILED(0x315, USB_CLASS_HID, 0, 0) },
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index fd23a37..854cceb 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -54,6 +54,7 @@
 #define WACOM_REPORT_TPCST		16
 #define WACOM_REPORT_TPC1FGE		18
 #define WACOM_REPORT_24HDT		1
+#define WACOM_REPORT_WL			128
 
 /* device quirks */
 #define WACOM_QUIRK_MULTI_INPUT		0x0001
@@ -81,6 +82,7 @@ enum {
 	INTUOSPS,
 	INTUOSPM,
 	INTUOSPL,
+	INTUOSHT,
 	WACOM_21UX2,
 	WACOM_22HD,
 	DTK,
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 2/4 v3] input: wacom - make sure touch_max is set for touch devices
From: Ping Cheng @ 2013-11-15 19:59 UTC (permalink / raw)
  To: linux-input
  Cc: dmitry.torokhov, killertofu, chris, peter.hutterer, 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.

Tested-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Ping Cheng <pingc@wacom.com>
---
 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 8a90da1..3d71b60 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.3.2


^ permalink raw reply related

* [PATCH 1/4 v3] input: wacom - Scale up touch width and height values for Intuos Pro
From: Ping Cheng @ 2013-11-15 19:58 UTC (permalink / raw)
  To: linux-input; +Cc: dmitry.torokhov, killertofu, chris, peter.hutterer

From: Signed-off-by: Jason Gerecke <killertofu@gmail.com>

The width and height values reported by the Intuos Pro are not in
surface units as required by the MT protocol. A simple multiplier
of 100x corrects it.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Acked-by: Ping Cheng <pingc@wacom.com>
---
 drivers/input/tablet/wacom_wac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 9c8eded..3f75f1d 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -1151,8 +1151,8 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
 		int width, height;
 
 		if (features->type >= INTUOSPS && features->type <= INTUOSPL) {
-			width  = data[5];
-			height = data[6];
+			width  = data[5] * 100;
+			height = data[6] * 100;
 		} else {
 			/*
 			 * "a" is a scaled-down area which we assume is
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 0/4 v3] input: wacom - Add support for new Intuos devices
From: Ping Cheng @ 2013-11-15 19:57 UTC (permalink / raw)
  To: linux-input
  Cc: dmitry.torokhov, killertofu, chris, peter.hutterer, Ping Cheng

This patchset includes 4 outstanding Wacom patches posted in
the last two months. They are based on Dmitry's next branch.

Intuos series support is is its 3rd version. The patchset
has been tested by users at linuxwacom.sf.net. Change history
is listed below.

v2: Change SW_TOUCH_ENABLED to SW_TOUCH and clear BTN_TOUCH bit
for button only interfaces as suggested by Peter Hutterer.

v3: Make "touch hardware switch" into a new patch as suggested
by Chris Bagwell. Change INTUOS_HT to INTUOSHT as Peter suggested.

Added: Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>
and    Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
for relevant patches.

Jason's patch is included to avoid missing patch in mailling list.

Jason Gerecke (1):
  input: wacom - Scale up touch width and height values for Intuos Pro

Ping Cheng (3):
  input: wacom - make sure touch_max is set for touch devices
  Input: wacom - add support for three new Intuos devices
  Input: wacom - add SW_TOUCH to include/uapi/linux/input.h

 drivers/input/tablet/wacom_sys.c | 23 ++++++++--
 drivers/input/tablet/wacom_wac.c | 94 ++++++++++++++++++++++++++++++++--------
 drivers/input/tablet/wacom_wac.h |  7 +++
 include/uapi/linux/input.h       |  1 +
 4 files changed, 102 insertions(+), 23 deletions(-)

-- 
1.8.3.2


^ permalink raw reply

* Re: [PATCH 1/2] input: touchscreen: fix spelling mistake in TSC/ADC DT binding
From: Felipe Balbi @ 2013-11-15 17:53 UTC (permalink / raw)
  To: Mark Rutland
  Cc: Felipe Balbi, Sebastian Andrzej Siewior,
	dmitry.torokhov@gmail.com, rob.herring@calxeda.com, Pawel Moll,
	swarren@wwwdotorg.org, ijc+devicetree@hellion.org.uk,
	rob@landley.net, bcousson@baylibre.com, Tony Lindgren,
	devicetree@vger.kernel.org, Linux OMAP Mailing List,
	linux-input@vger.kernel.org
In-Reply-To: <20131115155540.GF24831@e106331-lin.cambridge.arm.com>

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

Hi,

On Fri, Nov 15, 2013 at 03:55:40PM +0000, Mark Rutland wrote:
> > > > > > diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
> > > > > > index e1c5300..b61df9d 100644
> > > > > > --- a/drivers/input/touchscreen/ti_am335x_tsc.c
> > > > > > +++ b/drivers/input/touchscreen/ti_am335x_tsc.c
> > > > > > @@ -348,9 +348,16 @@ static int titsc_parse_dt(struct platform_device *pdev,
> > > > > >  	if (err < 0)
> > > > > >  		return err;
> > > > > >  
> > > > > > -	err = of_property_read_u32(node, "ti,coordiante-readouts",
> > > > > > +	/*
> > > > > > +	 * try with new binding first. If it fails, still try with
> > > > > > +	 * bogus, miss-spelled version.
> > > > > > +	 */
> > > > > > +	err = of_property_read_u32(node, "ti,coordinate-readouts",
> > > > > >  			&ts_dev->coordinate_readouts);
> > > > > >  	if (err < 0)
> > > > > > +		err = of_property_read_u32(node, "ti,coordiante-readouts",
> > > > > > +				&ts_dev->coordinate_readouts);
> > > > > > +	if (err < 0)
> > > > > >  		return err;
> > > > > 
> > > > > Thanks, very good. Do we keep this fallback for ever or just for a year
> > > > > or two?
> > > > 
> > > > That's for DT maintainers to decide but considering DT is an ABI, I
> > > > guess we need to keep for 30 years or so :-p
> > > 
> > > We keep it as long as we have to. If no-one's relying on the typo by the
> > > next merge window, I see no reason we'd have to keep support for the
> > 
> > and how could you know that ? considering it's an ABI, how could you
> > ever know that ?
> 
> If you know that the only user of a binding is a dts for a particular
> product that you're in charge of, then you'd know the set of kernel +
> dtb combinations out there, and can judge.

once the binding has made into mainline, it's next to impossible to
figure out who has downloaded a tarball containing that driver and made
a product out of it.

Besides keeping that check in the driver won't hurt at all in the long
run. I would give it at least until 4.0 before thinking about removing,
and that might still not be enough time.

-- 
balbi

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

^ permalink raw reply

* Re: [PATCH 1/2] input: touchscreen: fix spelling mistake in TSC/ADC DT binding
From: Mark Rutland @ 2013-11-15 15:55 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Sebastian Andrzej Siewior, dmitry.torokhov@gmail.com,
	rob.herring@calxeda.com, Pawel Moll, swarren@wwwdotorg.org,
	ijc+devicetree@hellion.org.uk, rob@landley.net,
	bcousson@baylibre.com, Tony Lindgren, devicetree@vger.kernel.org,
	Linux OMAP Mailing List, linux-input@vger.kernel.org
In-Reply-To: <20131114155404.GE15835@saruman.home>

On Thu, Nov 14, 2013 at 03:54:04PM +0000, Felipe Balbi wrote:
> HI,
> 
> On Thu, Nov 14, 2013 at 11:19:59AM +0000, Mark Rutland wrote:
> > > On Tue, Oct 22, 2013 at 10:42:00AM +0200, Sebastian Andrzej Siewior wrote:
> > > > On 10/21/2013 10:13 PM, Felipe Balbi wrote:
> > > > > diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
> > > > > index e1c5300..b61df9d 100644
> > > > > --- a/drivers/input/touchscreen/ti_am335x_tsc.c
> > > > > +++ b/drivers/input/touchscreen/ti_am335x_tsc.c
> > > > > @@ -348,9 +348,16 @@ static int titsc_parse_dt(struct platform_device *pdev,
> > > > >  	if (err < 0)
> > > > >  		return err;
> > > > >  
> > > > > -	err = of_property_read_u32(node, "ti,coordiante-readouts",
> > > > > +	/*
> > > > > +	 * try with new binding first. If it fails, still try with
> > > > > +	 * bogus, miss-spelled version.
> > > > > +	 */
> > > > > +	err = of_property_read_u32(node, "ti,coordinate-readouts",
> > > > >  			&ts_dev->coordinate_readouts);
> > > > >  	if (err < 0)
> > > > > +		err = of_property_read_u32(node, "ti,coordiante-readouts",
> > > > > +				&ts_dev->coordinate_readouts);
> > > > > +	if (err < 0)
> > > > >  		return err;
> > > > 
> > > > Thanks, very good. Do we keep this fallback for ever or just for a year
> > > > or two?
> > > 
> > > That's for DT maintainers to decide but considering DT is an ABI, I
> > > guess we need to keep for 30 years or so :-p
> > 
> > We keep it as long as we have to. If no-one's relying on the typo by the
> > next merge window, I see no reason we'd have to keep support for the
> 
> and how could you know that ? considering it's an ABI, how could you
> ever know that ?

If you know that the only user of a binding is a dts for a particular
product that you're in charge of, then you'd know the set of kernel +
dtb combinations out there, and can judge.

If a bug is found in a driver such that it hasn't worked for a number of
releases, and no-one's complained, the binding is clearly not in use and
thus support for it can be removed.

If maintaining compatibility becomes too hard, and all users are happy
to migrate to a newer dtb, then it's not necessary to maintain
compatiblity for the old binding.

While we can't always remove existing bindings, there are cases where
it's possible and appropriate. However, we should strive for
compatibility for as long a term as possible.

Thanks,
Mark.

^ permalink raw reply

* [PATCH v2] Input:Add support for DualPoint device on Dell XT2 model
From: Yunkang Tang @ 2013-11-15 14:11 UTC (permalink / raw)
  To: dmitry.torokhov, cernekee, dturvene
  Cc: linux-input, ndevos, jclift, yunkang.tang

Hi all,

   Here is the 2nd version for supporting DualPoint device on Dell XT2 model

Changelist:
 - Bugfix for trackpoint's behavior was abnormal in v1.
  [Root Cause]
   Because of the special MPU controller being used in this DualPoint device,
  when sending ALPS magic know command, not only touchpad but also trackpoint
  received the commands. This would cause trackpoint also enter an unexpected
  raw mode. Unfortunately, trackpoint's raw raw packet has the same check bit
  as touchpad's but with different packet format. And this would cause 
  trackpoint's abnormal behavior.

  [Solution]
   1. Define a new ALPS_PROTO_V6 macro for this device.
   2. Add new initialization logic.
   3. Add new packet process logic.
   # Touchpad's dimension is 2047*1535.

SelfTest:
 1. Move on touchpad -- OK
 2. Vertical/Horizontal wheel on touchpad -- OK
 3. Tap / Tap and drag on touchpad -- OK
 4. Click with touchpad's L/R button -- OK
 5. Move on touchpad with pressing touchpad's button -- OK
 6. Move on trackpoint -- OK
 7. Click with trackpoint's L/R button -- OK
 8. Move on trackpoint with pressing trackpoint's button -- OK
 9. Move cursor with both touchpad and trackpoint -- OK
 10. Move on touchpad with pressing trackpoint's button -- OK
 11. Move on trackpoint with pressing touchpad's button -- OK

 Thanks

Signed-off-by: Yunkang Tang <yunkang.tang@cn.alps.com>
---
 drivers/input/mouse/alps.c | 206 ++++++++++++++++++++++++++++++++++++++++++++-
 drivers/input/mouse/alps.h |   1 +
 2 files changed, 204 insertions(+), 3 deletions(-)

diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index ca7a26f..5cf62e3 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -70,6 +70,25 @@ static const struct alps_nibble_commands alps_v4_nibble_commands[] = {
 	{ PSMOUSE_CMD_SETSCALE11,	0x00 }, /* f */
 };
 
+static const struct alps_nibble_commands alps_v6_nibble_commands[] = {
+	{ PSMOUSE_CMD_ENABLE,		0x00 }, /* 0 */
+	{ PSMOUSE_CMD_SETRATE,		0x0a }, /* 1 */
+	{ PSMOUSE_CMD_SETRATE,		0x14 }, /* 2 */
+	{ PSMOUSE_CMD_SETRATE,		0x28 }, /* 3 */
+	{ PSMOUSE_CMD_SETRATE,		0x3c }, /* 4 */
+	{ PSMOUSE_CMD_SETRATE,		0x50 }, /* 5 */
+	{ PSMOUSE_CMD_SETRATE,		0x64 }, /* 6 */
+	{ PSMOUSE_CMD_SETRATE,		0xc8 }, /* 7 */
+	{ PSMOUSE_CMD_GETID,		0x00 }, /* 8 */
+	{ PSMOUSE_CMD_GETINFO,		0x00 }, /* 9 */
+	{ PSMOUSE_CMD_SETRES,		0x00 }, /* a */
+	{ PSMOUSE_CMD_SETRES,		0x01 }, /* b */
+	{ PSMOUSE_CMD_SETRES,		0x02 }, /* c */
+	{ PSMOUSE_CMD_SETRES,		0x03 }, /* d */
+	{ PSMOUSE_CMD_SETSCALE21,	0x00 }, /* e */
+	{ PSMOUSE_CMD_SETSCALE11,	0x00 }, /* f */
+};
+
 
 #define ALPS_DUALPOINT		0x02	/* touchpad has trackstick */
 #define ALPS_PASS		0x04	/* device has a pass-through port */
@@ -103,6 +122,7 @@ static const struct alps_model_info alps_model_data[] = {
 	/* Dell Latitude E5500, E6400, E6500, Precision M4400 */
 	{ { 0x62, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf,
 		ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED },
+	{ { 0x73, 0x00, 0x14 }, 0x00, ALPS_PROTO_V6, 0xff, 0xff, ALPS_DUALPOINT },		/* Dell XT2 */
 	{ { 0x73, 0x02, 0x50 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, ALPS_FOUR_BUTTONS },		/* Dell Vostro 1400 */
 	{ { 0x52, 0x01, 0x14 }, 0x00, ALPS_PROTO_V2, 0xff, 0xff,
 		ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED },				/* Toshiba Tecra A11-11L */
@@ -645,6 +665,76 @@ static void alps_process_packet_v3(struct psmouse *psmouse)
 	alps_process_touchpad_packet_v3(psmouse);
 }
 
+static void alps_process_packet_v6(struct psmouse *psmouse)
+{
+	struct alps_data *priv = psmouse->private;
+	unsigned char *packet = psmouse->packet;
+	struct input_dev *dev = psmouse->dev;
+	struct input_dev *dev2 = priv->dev2;
+	int x, y, z, left, right, middle;
+
+	/*
+	 * We can use Byte5 to distinguish if the packet is from Touchpad
+	 * or Trackpoint.
+	 * Touchpad:	0 - 0x7E
+	 * Trackpoint:	0x7F
+	 */
+	if (packet[5] == 0x7F) {
+		/* It should be a DualPoint when received Trackpoint packet */
+		if (!(priv->flags & ALPS_DUALPOINT))
+			return;
+
+		/* Trackpoint packet */
+		x = packet[1] | ((packet[3] & 0x20) << 2);
+		y = packet[2] | ((packet[3] & 0x40) << 1);
+		z = packet[4];
+		left = packet[3] & 0x01;
+		right = packet[3] & 0x02;
+		middle = packet[3] & 0x04;
+
+		/* To prevent the cursor jump when finger lifted */
+		if (x == 0x7F && y == 0x7F && z == 0x7F)
+			x = y = z = 0;
+
+		/* Divide 4 since trackpoint's speed is too fast */
+		input_report_rel(dev2, REL_X, (char)x / 4);
+		input_report_rel(dev2, REL_Y, -((char)y / 4));
+
+		input_report_key(dev2, BTN_LEFT, left);
+		input_report_key(dev2, BTN_RIGHT, right);
+		input_report_key(dev2, BTN_MIDDLE, middle);
+
+		input_sync(dev2);
+		return;
+	}
+
+	/* Touchpad packet */
+	x = packet[1] | ((packet[3] & 0x78) << 4);
+	y = packet[2] | ((packet[4] & 0x78) << 4);
+	z = packet[5];
+	left = packet[3] & 0x01;
+	right = packet[3] & 0x02;
+
+	if (z > 30)
+		input_report_key(dev, BTN_TOUCH, 1);
+	if (z < 25)
+		input_report_key(dev, BTN_TOUCH, 0);
+
+	if (z > 0) {
+		input_report_abs(dev, ABS_X, x);
+		input_report_abs(dev, ABS_Y, y);
+	}
+
+	input_report_abs(dev, ABS_PRESSURE, z);
+	input_report_key(dev, BTN_TOOL_FINGER, z > 0);
+
+	/* v6 touchpad does not have middle button */
+	input_report_key(dev, BTN_LEFT, left);
+	input_report_key(dev, BTN_RIGHT, right);
+
+	input_sync(dev);
+}
+
 static void alps_process_packet_v4(struct psmouse *psmouse)
 {
 	struct alps_data *priv = psmouse->private;
@@ -897,7 +987,7 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse)
 	}
 
 	/* Bytes 2 - pktsize should have 0 in the highest bit */
-	if (priv->proto_version != ALPS_PROTO_V5 &&
+	if ((priv->proto_version < ALPS_PROTO_V5) &&
 	    psmouse->pktcnt >= 2 && psmouse->pktcnt <= psmouse->pktsize &&
 	    (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) {
 		psmouse_dbg(psmouse, "refusing packet[%i] = %x\n",
@@ -1085,6 +1175,80 @@ static int alps_absolute_mode_v1_v2(struct psmouse *psmouse)
 	return ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETPOLL);
 }
 
+static int alps_monitor_mode_send_word(struct psmouse *psmouse, u16 word)
+{
+	int i, nibble;
+
+	/*
+	 * b0-b11 are valid bits, send sequence is inverse.
+	 * e.g. when word = 0x0123, nibble send sequence is 3, 2, 1
+	 */
+	for (i = 0; i <= 8; i += 4) {
+		nibble = (word >> i) & 0xf;
+		if (alps_command_mode_send_nibble(psmouse, nibble))
+			return -1;
+	}
+
+	return 0;
+}
+
+static int alps_monitor_mode_write_reg(struct psmouse *psmouse,
+				       u16 addr, u16 value)
+{
+	struct ps2dev *ps2dev = &psmouse->ps2dev;
+
+	/* 0x0A0 is the command to write the word */
+	if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_ENABLE) ||
+	    alps_monitor_mode_send_word(psmouse, 0x0A0) ||
+	    alps_monitor_mode_send_word(psmouse, addr) ||
+	    alps_monitor_mode_send_word(psmouse, value) ||
+	    ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE))
+		return -1;
+
+	return 0;
+}
+
+static int alps_monitor_mode(struct psmouse *psmouse, bool enable)
+{
+	struct ps2dev *ps2dev = &psmouse->ps2dev;
+
+	if (enable) {
+		/* EC E9 F5 F5 E7 E6 E7 E9 to enter monitor mode */
+		if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_RESET_WRAP) ||
+		    ps2_command(ps2dev, NULL, PSMOUSE_CMD_GETINFO) ||
+		    ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE) ||
+		    ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE) ||
+		    ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE21) ||
+		    ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) ||
+		    ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE21) ||
+		    ps2_command(ps2dev, NULL, PSMOUSE_CMD_GETINFO))
+			return -1;
+	} else {
+		/* EC to exit monitor mode */
+		if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_RESET_WRAP))
+			return -1;
+	}
+
+	return 0;
+}
+
+static int alps_absolute_mode_v6(struct psmouse *psmouse)
+{
+	u16 reg_val = 0x181;
+	int ret = -1;
+
+	/* enter monitor mode, to write the register */
+	if (alps_monitor_mode(psmouse, true))
+		return -1;
+
+	ret = alps_monitor_mode_write_reg(psmouse, 0x000, reg_val);
+
+	if (alps_monitor_mode(psmouse, false))
+		ret = -1;
+
+	return ret;
+}
+
 static int alps_get_status(struct psmouse *psmouse, char *param)
 {
 	/* Get status: 0xF5 0xF5 0xF5 0xE9 */
@@ -1189,6 +1353,32 @@ static int alps_hw_init_v1_v2(struct psmouse *psmouse)
 	return 0;
 }
 
+static int alps_hw_init_v6(struct psmouse *psmouse)
+{
+	unsigned char param[2] = {0xC8, 0x14};
+
+	/* Enter passthrough mode to let trackpoint enter 6byte raw mode */
+	if (alps_passthrough_mode_v2(psmouse, true))
+		return -1;
+
+	if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) ||
+	    ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) ||
+	    ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) ||
+	    ps2_command(&psmouse->ps2dev, &param[0], PSMOUSE_CMD_SETRATE) ||
+	    ps2_command(&psmouse->ps2dev, &param[1], PSMOUSE_CMD_SETRATE))
+		return -1;
+
+	if (alps_passthrough_mode_v2(psmouse, false))
+		return -1;
+
+	if (alps_absolute_mode_v6(psmouse)) {
+		psmouse_err(psmouse, "Failed to enable absolute mode\n");
+		return -1;
+	}
+
+	return 0;
+}
+
 /*
  * Enable or disable passthrough mode to the trackstick.
  */
@@ -1553,6 +1743,8 @@ static void alps_set_defaults(struct alps_data *priv)
 		priv->hw_init = alps_hw_init_v1_v2;
 		priv->process_packet = alps_process_packet_v1_v2;
 		priv->set_abs_params = alps_set_abs_params_st;
+		priv->x_max = 1023;
+		priv->y_max = 767;
 		break;
 	case ALPS_PROTO_V3:
 		priv->hw_init = alps_hw_init_v3;
@@ -1584,6 +1776,14 @@ static void alps_set_defaults(struct alps_data *priv)
 		priv->x_bits = 23;
 		priv->y_bits = 12;
 		break;
+	case ALPS_PROTO_V6:
+		priv->hw_init = alps_hw_init_v6;
+		priv->process_packet = alps_process_packet_v6;
+		priv->set_abs_params = alps_set_abs_params_st;
+		priv->nibble_commands = alps_v6_nibble_commands;
+		priv->x_max = 2047;
+		priv->y_max = 1535;
+		break;
 	}
 }
 
@@ -1705,8 +1905,8 @@ static void alps_disconnect(struct psmouse *psmouse)
 static void alps_set_abs_params_st(struct alps_data *priv,
 				   struct input_dev *dev1)
 {
-	input_set_abs_params(dev1, ABS_X, 0, 1023, 0, 0);
-	input_set_abs_params(dev1, ABS_Y, 0, 767, 0, 0);
+	input_set_abs_params(dev1, ABS_X, 0, priv->x_max, 0, 0);
+	input_set_abs_params(dev1, ABS_Y, 0, priv->y_max, 0, 0);
 }
 
 static void alps_set_abs_params_mt(struct alps_data *priv,
diff --git a/drivers/input/mouse/alps.h b/drivers/input/mouse/alps.h
index eee5985..704f0f9 100644
--- a/drivers/input/mouse/alps.h
+++ b/drivers/input/mouse/alps.h
@@ -17,6 +17,7 @@
 #define ALPS_PROTO_V3	3
 #define ALPS_PROTO_V4	4
 #define ALPS_PROTO_V5	5
+#define ALPS_PROTO_V6	6
 
 /**
  * struct alps_model_info - touchpad ID table
-- 
1.8.1.2


^ permalink raw reply related

* Re: [PATCH 04/13] Input: add motion-tracking ABS_* bits and docs
From: David Herrmann @ 2013-11-15 10:17 UTC (permalink / raw)
  To: Antonio Ospite
  Cc: open list:HID CORE LAYER, Dmitry Torokhov, Jiri Kosina,
	Peter Hutterer, Benjamin Tissoires
In-Reply-To: <20131115111135.1548dc0a4effdad8f672ff24@studenti.unina.it>

Hi Antonio

On Fri, Nov 15, 2013 at 11:11 AM, Antonio Ospite
<ospite@studenti.unina.it> wrote:
> On Fri,  1 Nov 2013 21:16:15 +0100
> David Herrmann <dh.herrmann@gmail.com> wrote:
>
>> Motion sensors are getting quite common in mobile devices. To avoid
>> returning accelerometer data via ABS_X/Y/Z and irritating the Xorg
>> mouse-driver, this adds separate ABS_* bits for that.
>>
>> This is needed if gaming devices want to report their normal data plus
>> accelerometer/gyro data. Usually, ABS_X/Y are already used by analog
>> sticks, so need separate definitions, anyway.
>>
>> Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
>
> Hi, what's the status of this patch?
> I cannot see it in Dmitry's repository, David maybe you have another
> repository I can pull from?

Please see patch 1/13 and 2/13. They fix the kernel ABI to support new
ABS_* bits (the current ABI is broken in that regard). As this is
quite critical and caused breaks during the last merge-window, we
haven't merged it yet. I hope to get it into 3.14, though. The current
patches seem fine and work for me. I will try to get the user-space
part working in the next weeks.

Any help is welcome!

Thanks
David

^ permalink raw reply

* Re: [PATCH 04/13] Input: add motion-tracking ABS_* bits and docs
From: Antonio Ospite @ 2013-11-15 10:11 UTC (permalink / raw)
  To: David Herrmann
  Cc: linux-input, Dmitry Torokhov, Jiri Kosina, Peter Hutterer,
	Benjamin Tissoires
In-Reply-To: <1383336984-26601-5-git-send-email-dh.herrmann@gmail.com>

On Fri,  1 Nov 2013 21:16:15 +0100
David Herrmann <dh.herrmann@gmail.com> wrote:

> Motion sensors are getting quite common in mobile devices. To avoid
> returning accelerometer data via ABS_X/Y/Z and irritating the Xorg
> mouse-driver, this adds separate ABS_* bits for that.
> 
> This is needed if gaming devices want to report their normal data plus
> accelerometer/gyro data. Usually, ABS_X/Y are already used by analog
> sticks, so need separate definitions, anyway.
> 
> Signed-off-by: David Herrmann <dh.herrmann@gmail.com>

Hi, what's the status of this patch?
I cannot see it in Dmitry's repository, David maybe you have another
repository I can pull from? 

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?

^ permalink raw reply

* [git pull] Input updates for 3.13-rc0
From: Dmitry Torokhov @ 2013-11-15  2:01 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, linux-input

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

Hi Linus,

Please pull from:

	git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git for-linus
or
	master.kernel.org:/pub/scm/linux/kernel/git/dtor/input.git for-linus

to receive updates for the input subsystem. You will get an new drivers
for Hyper-V synthetic keyboard and for Neonode zForce touchscreens, plus
a bunch of driver fixes and cleanups.

Please note that you will get a small conflict in
arch/arm/boot/dts/am335x-evmsk.dts but that shoudl be easily resolvable.

Changelog:
---------

Dan Carpenter (1):
      Input: tnetv107x-keypad - make irqs signed for error handling

Daniel Stone (1):
      Input: evdev - fall back to vmalloc for client event buffer

David Herrmann (1):
      Input: clarify gamepad API ABS values

Dmitry Torokhov (1):
      Revert "Input: ALPS - add support for model found on Dell XT2"

Duan Jiong (1):
      Input: cyttsp4 - replace IS_ERR and PTR_ERR with PTR_ERR_OR_ZERO

Felipe Balbi (2):
      Input: ti_am335x_tsc - fix spelling mistake in TSC/ADC DT binding
      arm: dts: am335x sk: add touchscreen support

Geyslan G. Bem (1):
      Input: cypress_ps2 - remove useless cast

Heiko Stübner (1):
      Input: add driver for Neonode zForce based touchscreens

Jason Gerecke (2):
      Input: wacom - support EMR and MFT sensors of Cintiq Companion Hybrid
      Input: wacom - send proper tablet state info when pen leaves proximity

Jingoo Han (1):
      Input: cypress_ps2 - remove casting the return value which is a void pointer

Joseph Salisbury (1):
      Input: cypress_ps2 - do not consider data bad if palm is detected

K. Y. Srinivasan (1):
      Input: add a driver to support Hyper-V synthetic keyboard

Kang Hu (1):
      Input: remove a redundant max() call

Laurent Pinchart (1):
      Input: sh_keysc - enable the driver on all ARM platforms

Majunath Goudar (1):
      Input: fix PWM-related undefined reference errors

Ping Cheng (4):
      Input: wacom - testing result shows get_report is unnecessary.
      Input: wacom - LED is only supported through digitizer interface
      Input: wacom - add support for three new Intuos Pro devices
      Input: wacom - not all multi-interface devices support touch

Ryan Mallon (1):
      Input: uinput - support injecting multiple events in one write() call

Sachin Kamat (20):
      Input: cobalt_btns - remove redundant dev_set_drvdata
      Input: htcpen - remove redundant dev_set_drvdata
      Input: rb532_button - remove redundant dev_set_drvdata
      Input: cyttsp4_core - remove redundant dev_set_drvdata
      Input: ad714x-spi - remove redundant spi_set_drvdata
      Input: ad7877 - remove redundant spi_set_drvdata
      Input: ad7879-spi - remove redundant spi_set_drvdata
      Input: tsc2005 - remove redundant spi_set_drvdata
      Input: lpc32xx-keys - remove redundant of_match_ptr
      Input: nspire-keypad - remove redundant of_match_ptr
      Input: tegra-kbc - remove redundant of_match_ptr
      Input: sirfsoc-onkey - remove redundant of_match_ptr
      Input: egalax_ts - remove redundant of_match_ptr
      Input: ti_am335x_tsc - remove redundant of_match_ptr
      Input: gpio_keys - include linux/of.h header
      Input: gpio_keys_polled - include linux/of.h header
      Input: pxa27x_keypad - include linux/of.h header
      Input: pwm-beeper - include linux/of.h header
      Input: rotary_encoder - include linux/of.h header
      Input: st1232 - include linux/of.h header

Tom Gundersen (3):
      Input: i8042 - add PNP modaliases
      Input: allow deselecting serio drivers even without CONFIG_EXPERT
      Input: mousedev - allow disabling even without CONFIG_EXPERT

Wei Yongjun (3):
      Input: nspire-keypad - add missing clk_disable_unprepare() on error path
      Input: mpu3050 - add missing i2c_set_clientdata() in mpu3050_probe()
      Input: mma8450 - add missing i2c_set_clientdata() in mma8450_probe()

Yunkang Tang (1):
      Input: ALPS - change secondary device's name


Diffstat:
--------

 .../bindings/input/touchscreen/ti-tsc-adc.txt      |   2 +-
 Documentation/input/gamepad.txt                    |   3 +
 arch/arm/boot/dts/am335x-evm.dts                   |   2 +-
 arch/arm/boot/dts/am335x-evmsk.dts                 |  10 +
 drivers/input/Kconfig                              |   2 +-
 drivers/input/evdev.c                              |  16 +-
 drivers/input/input.c                              |   2 +-
 drivers/input/keyboard/Kconfig                     |   6 +-
 drivers/input/keyboard/gpio_keys.c                 |   1 +
 drivers/input/keyboard/gpio_keys_polled.c          |   1 +
 drivers/input/keyboard/lpc32xx-keys.c              |   2 +-
 drivers/input/keyboard/nspire-keypad.c             |   6 +-
 drivers/input/keyboard/pxa27x_keypad.c             |   1 +
 drivers/input/keyboard/tegra-kbc.c                 |   2 +-
 drivers/input/keyboard/tnetv107x-keypad.c          |   4 +-
 drivers/input/misc/Kconfig                         |   4 +-
 drivers/input/misc/ad714x-spi.c                    |   1 -
 drivers/input/misc/cobalt_btns.c                   |   2 -
 drivers/input/misc/mma8450.c                       |   4 +-
 drivers/input/misc/mpu3050.c                       |   1 +
 drivers/input/misc/pwm-beeper.c                    |   1 +
 drivers/input/misc/rb532_button.c                  |   1 -
 drivers/input/misc/rotary_encoder.c                |   1 +
 drivers/input/misc/sirfsoc-onkey.c                 |   2 +-
 drivers/input/misc/uinput.c                        |  26 +-
 drivers/input/mouse/alps.c                         |   3 +-
 drivers/input/mouse/cypress_ps2.c                  |  29 +-
 drivers/input/serio/Kconfig                        |  16 +-
 drivers/input/serio/Makefile                       |   1 +
 drivers/input/serio/hyperv-keyboard.c              | 437 +++++++++++
 drivers/input/serio/i8042-x86ia64io.h              |   2 +
 drivers/input/tablet/wacom_sys.c                   |  96 ++-
 drivers/input/tablet/wacom_wac.c                   | 114 ++-
 drivers/input/tablet/wacom_wac.h                   |   8 +-
 drivers/input/touchscreen/Kconfig                  |  13 +
 drivers/input/touchscreen/Makefile                 |   1 +
 drivers/input/touchscreen/ad7877.c                 |   2 -
 drivers/input/touchscreen/ad7879-spi.c             |   1 -
 drivers/input/touchscreen/cyttsp4_core.c           |   2 -
 drivers/input/touchscreen/cyttsp4_spi.c            |   5 +-
 drivers/input/touchscreen/egalax_ts.c              |   2 +-
 drivers/input/touchscreen/htcpen.c                 |   2 -
 drivers/input/touchscreen/st1232.c                 |   1 +
 drivers/input/touchscreen/ti_am335x_tsc.c          |  11 +-
 drivers/input/touchscreen/tsc2005.c                |   2 -
 drivers/input/touchscreen/zforce_ts.c              | 836 +++++++++++++++++++++
 include/linux/platform_data/zforce_ts.h            |  26 +
 47 files changed, 1585 insertions(+), 128 deletions(-)
 create mode 100644 drivers/input/serio/hyperv-keyboard.c
 create mode 100644 drivers/input/touchscreen/zforce_ts.c
 create mode 100644 include/linux/platform_data/zforce_ts.h

-- 
Dmitry


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

^ permalink raw reply

* Re: [PATCH] Input: clarify gamepad API ABS values
From: Antonio Ospite @ 2013-11-14 22:53 UTC (permalink / raw)
  To: David Herrmann; +Cc: open list:HID CORE LAYER, Dmitry Torokhov
In-Reply-To: <CANq1E4Q-yPVh7ah-SMGb--VCJA97c2yCLSGQakFzGWWQydo7jw@mail.gmail.com>

On Thu, 14 Nov 2013 18:22:28 +0100
David Herrmann <dh.herrmann@gmail.com> wrote:

> On Thu, Nov 14, 2013 at 6:07 PM, Antonio Ospite
> <ospite@studenti.unina.it> wrote:

[...]
> > I know it is not really relevant and you won't fix the kernel interface
> > anyway, but I was just curios: is there any known userspace using the
> > gamepad API?
> 
> The xwiimote userspace-drivers use it, other than that it is hard to
> tell.. I looked at a lot of games and applications and they all just
> contain a bunch of hacks and per-driver-mappings. I cannot really tell
> whether anyone uses it, yet (there's isn't really a reason to use it
> as only the wiimote kernel drivers comply to it).
> 
> However, I hope we can make all new drivers adhere these rules so
> user-space no longer has to guess the mappings.
>

I am going to adopt the gamepad API for the PS3 controller as well,
motivating the change with the current utterly broken status of
the mapping from the evdev point of view.

I have reasons to believe that any existing linux software targeting the
PS3 controller is just parsing the hidraw data itself, the joystick
interface is not completely usable either in the current status.

> > Another question is below.
> >
> >> Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
> >> ---
> >>  Documentation/input/gamepad.txt | 3 +++
> >>  1 file changed, 3 insertions(+)
> >>
> >> diff --git a/Documentation/input/gamepad.txt b/Documentation/input/gamepad.txt
> >> index 8002c89..31bb6a4 100644
> >> --- a/Documentation/input/gamepad.txt
> >> +++ b/Documentation/input/gamepad.txt
> >> @@ -122,12 +122,14 @@ D-Pad:
> >>        BTN_DPAD_*
> >>      Analog buttons are reported as:
> >>        ABS_HAT0X and ABS_HAT0Y
> >> +      (for ABS values negative is left/up, positive is right/down)
> >>
> >
> > Does that mean that analog D-Pad Left and D-Pad Right are supposed to be
> > described as a single axis (ABS_HAT0X), even if in the input report
> > they come as two different fields (non adjacent even)? And same for
> > analog Up/Down?
> >
> > JFYI on the PS3 controller it is possible to have values from analog
> > D-Pad Left and analog D-Pad Right at the same time, even if it is
> > mechanically unlikely.
> 
> Yes, it's a single axis. It's called a D-Pad (Direction-Pad) so it is
> supposed to give information about a direction. This somehow excludes
> reporting information for left/right separately, right?
>

Mathematically, yes, but I am still not completely sure that being so
strict is convenient in this case: when describing the _digital_ D-Pad
we mention "4 buttons" and then "four directions", and indeed hardware
generally exposes all four directional buttons independently (even if
opposed ones are not supposed to be pressed at the same time, they still
might); so it could make sense to use the same scheme for _analog_
D-Pad axes too: four independent analog D-Pad axes.

Again, JFYI the PS3 controller allows to press even _digital_ D-Pad
Left and Right at the same time even if this is mechanically trickier
to achieve than the correspondent analog events.

> I didn't know there are actually devices reporting this separately, so
> I never considered that during the development of the API.
> Fortunately, the drivers which follow this spec all use digital DPADs,
> so we can easily change it now.
>

I'd say we change it. But maybe it's better to hear from someone more
into games.

> What exactly does the PS3 controller return? Is it
> pressure-information for the dpad?

Yes it is, 4 pressure values form 0 to 255, one for each "direction".

>I'm open to change this to report 4
> ABS values, but I'm not sure that we want that. From a user-space
> perspective I want to get 2 values, not 4. I wouldn't even know what
> to do with 4 dpad-values. So why not convert that in the kernel to:
>   x = x1 - x0;
>   y = y1 - y0;
> This gives you proper x/y DPAD values from 4 pressure inputs.
> 
> But I'm open for suggestions..

If I have to, I'll do that conversion; I just don't know yet how to
prepare for this scenario at the HID descriptor level.

In my driver I'd like to just fixup the whole HID descriptor and then
simply remap the keycodes, I'd like to avoid parsing the raw data
explicitly in C.

[...]
> >
> > What about analog Action-Pad buttons?
> > Do you suggest any mapping for them?
> 
> Do we have devices which report analog action-pad values? If there
> are, we can introduce new ABS_* bits for them (the current ones really
> don't fit). This requires the ABS2 patches which are currently pending
> on the list, though.
>
> And again, what information do these action-pads provide? Pressure?

The PS3 controller reports a pressure value from 0 to 255 for each of
the Action-Pad buttons.

I am writing some documentation of the input report of the PS3
controller, I'll post it here soon.

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?

^ permalink raw reply


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