Skip to contentSkip to conversation

ucb1400: add key interface

PATCH Superseded Sebastian Siewior 2 participants 10 messages Apr 24, 2008 – Apr 26, 2008

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ucb1400: add key interface

now the driver sends key events and feeds /dev/input/mice

---
 drivers/input/touchscreen/ucb1400_ts.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/input/touchscreen/ucb1400_ts.c +4 -1
index 9337352..ad14413 100644
@@ -326,12 +326,14 @@ static int ucb1400_ts_thread(void *_ucb)
 			 */
 			if (valid) {
 				ucb1400_ts_event_release(ucb->ts_idev);
+				input_report_key(ucb->ts_idev, BTN_TOUCH, 0);
 				valid = 0;
 			}
 
 			timeout = MAX_SCHEDULE_TIMEOUT;
 		} else {
 			valid = 1;
+			input_report_key(ucb->ts_idev, BTN_TOUCH, 1);
 			ucb1400_ts_evt_add(ucb->ts_idev, p, x, y);
 			timeout = msecs_to_jiffies(10);
 		}
@@ -527,7 +529,8 @@ static int ucb1400_ts_probe(struct device *dev)
 	idev->id.product	= id;
 	idev->open		= ucb1400_ts_open;
 	idev->close		= ucb1400_ts_close;
-	idev->evbit[0]		= BIT_MASK(EV_ABS);
+	idev->evbit[0]		= BIT_MASK(EV_ABS) | BIT_MASK(EV_KEY);
+	idev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
 
 	ucb1400_adc_enable(ucb);
 	x_res = ucb1400_ts_read_xres(ucb);
Signature · 1 line
1.5.4.3
maintainer
#1 lore raw

Hi Sebastian,

Quoted 12 lines · Sebastian Siewior

now the driver sends key events and feeds /dev/input/mice

---
 drivers/input/touchscreen/ucb1400_ts.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/input/touchscreen/ucb1400_ts.c +0 -0
index 9337352..ad14413 100644

drivers/input/touchscreen/ucb1400_ts.c static int ucb1400_ts_thread(void *_ucb) · line 329

Quoted 4 lines
drivers/input/touchscreen/ucb1400_ts.c +1 -0
@@ -326,12 +326,14 @@ static int ucb1400_ts_thread(void *_ucb)
 			 */
 			if (valid) {
 				ucb1400_ts_event_release(ucb->ts_idev);
+				input_report_key(ucb->ts_idev, BTN_TOUCH, 0);

Why don't you put input_repoer_key() inside ts_event_release()?

drivers/input/touchscreen/ucb1400_ts.c static int ucb1400_ts_thread(void *_ucb) · line 336

Quoted 7 lines
drivers/input/touchscreen/ucb1400_ts.c +1 -0
 				valid = 0;
 			}
 
 			timeout = MAX_SCHEDULE_TIMEOUT;
 		} else {
 			valid = 1;
+			input_report_key(ucb->ts_idev, BTN_TOUCH, 1);

And here it should go into ucb1400_ts_evt_add(). Plus, you might want to select some kind of pressure thresholds before reporting touch press and release.

drivers/input/touchscreen/ucb1400_ts.c static int ucb1400_ts_thread(void *_ucb) · line 339

Quoted 3 lines
drivers/input/touchscreen/ucb1400_ts.c +0 -0
 			ucb1400_ts_evt_add(ucb->ts_idev, p, x, y);
 			timeout = msecs_to_jiffies(10);
 		}

Thanks.

Signature · 1 line
Dmitry
#2 lore raw
Quoted 1 line · * Dmitry Torokhov | 2008-04-25 11:26:23 [-0400]:

Hi Sebastian,

Hello Dimitry,

Quoted 11 lines

drivers/input/touchscreen/ucb1400_ts.c static int ucb1400_ts_thread(void *_ucb) · line 329

Quoted 9 lines
drivers/input/touchscreen/ucb1400_ts.c +1 -0
index 9337352..ad14413 100644
@@ -326,12 +326,14 @@ static int ucb1400_ts_thread(void *_ucb)
 			 */
 			if (valid) {
 				ucb1400_ts_event_release(ucb->ts_idev);
+				input_report_key(ucb->ts_idev, BTN_TOUCH, 0);

Why don't you put input_repoer_key() inside ts_event_release()?

yep, looks better.

Quoted 9 lines

drivers/input/touchscreen/ucb1400_ts.c static int ucb1400_ts_thread(void *_ucb) · line 336

Quoted 7 lines
drivers/input/touchscreen/ucb1400_ts.c +1 -0
 				valid = 0;
 			}
 
 			timeout = MAX_SCHEDULE_TIMEOUT;
 		} else {
 			valid = 1;
+			input_report_key(ucb->ts_idev, BTN_TOUCH, 1);

And here it should go into ucb1400_ts_evt_add().

same..

Quoted 3 lines

Plus, you might want
to select some kind of pressure thresholds before reporting touch press and release.

Sure but depending on what? Are there any drivers doing this allready? I didn't find any on my grep.
Since these values are HW specifc they should be some userspace control (like for max/min x/y).

Quoted 4 lines

Thanks.

Signature · 1 line
Dmitry

Sebastian

maintainer
#3 lore raw
In reply to Sebastian Siewior
Quoted 29 lines · Sebastian Siewior
Quoted 1 line · * Dmitry Torokhov | 2008-04-25 11:26:23 [-0400]:

Hi Sebastian,

Hello Dimitry,

Quoted 11 lines

drivers/input/touchscreen/ucb1400_ts.c static int ucb1400_ts_thread(void *_ucb) · line 329

Quoted 9 lines
drivers/input/touchscreen/ucb1400_ts.c +1 -0
index 9337352..ad14413 100644
@@ -326,12 +326,14 @@ static int ucb1400_ts_thread(void *_ucb)
 			 */
 			if (valid) {
 				ucb1400_ts_event_release(ucb->ts_idev);
+				input_report_key(ucb->ts_idev, BTN_TOUCH, 0);

Why don't you put input_repoer_key() inside ts_event_release()?

yep, looks better.

Quoted 9 lines

drivers/input/touchscreen/ucb1400_ts.c static int ucb1400_ts_thread(void *_ucb) · line 336

Quoted 7 lines
drivers/input/touchscreen/ucb1400_ts.c +1 -0
 				valid = 0;
 			}
 
 			timeout = MAX_SCHEDULE_TIMEOUT;
 		} else {
 			valid = 1;
+			input_report_key(ucb->ts_idev, BTN_TOUCH, 1);

And here it should go into ucb1400_ts_evt_add().

same..

Quoted 7 lines
Quoted 3 lines

Plus, you might want
to select some kind of pressure thresholds before reporting touch press and release.

Sure but depending on what? Are there any drivers doing this allready? I didn't find any on my grep.
Since these values are HW specifc they should be some userspace control (like for max/min x/y).

Synaptics for example does it. You just need to guesstimate what values are most likely to work by default (since you are trying to provide compatibility with a legacy interface, just to get user going) and then leave fine-tuning to evdev/tslib.

Signature · 1 line
Dmitry
#4 lore raw
Quoted 8 lines · * Dmitry Torokhov | 2008-04-25 14:32:53 [-0400]:
Quoted 7 lines
Quoted 3 lines

Plus, you might want
to select some kind of pressure thresholds before reporting touch press and release.

Sure but depending on what? Are there any drivers doing this allready? I didn't find any on my grep.
Since these values are HW specifc they should be some userspace control (like for max/min x/y).

Quoted 4 lines

Synaptics for example does it. You just need to guesstimate what values are most likely to work by default (since you are trying to provide compatibility with a legacy interface, just to get user going) and then leave fine-tuning to evdev/tslib.

The code:

|        /* Post events
|         * BTN_TOUCH has to be first as mousedev relies on it when doing
|         * absolute -> relative conversion
|         */
|        if (hw.z > 30) input_report_key(dev, BTN_TOUCH, 1);
|        if (hw.z < 25) input_report_key(dev, BTN_TOUCH, 0);

Nothing happens if z is lets say 27. How do I do fine tunning with evdev? This looks like nothing has any influence on 30 & 25. My minimum pressure seems to be around 500 and I didn't get it past 700. I get nothing if I touch lightly the touchscreen so I thing having nothing is allready sane.

Quoted 1 line

Dmitry

Sebastian

maintainer
#5 lore raw
Quoted 16 lines · Sebastian Siewior
Quoted 8 lines · * Dmitry Torokhov | 2008-04-25 14:32:53 [-0400]:
Quoted 7 lines
Quoted 3 lines

Plus, you might want
to select some kind of pressure thresholds before reporting touch press and release.

Sure but depending on what? Are there any drivers doing this allready? I didn't find any on my grep.
Since these values are HW specifc they should be some userspace control (like for max/min x/y).

Quoted 4 lines

Synaptics for example does it. You just need to guesstimate what values are most likely to work by default (since you are trying to provide compatibility with a legacy interface, just to get user going) and then leave fine-tuning to evdev/tslib.

The code:

Quoted 8 lines
|        /* Post events
|         * BTN_TOUCH has to be first as mousedev relies on it when doing
|         * absolute -> relative conversion
|         */
|        if (hw.z > 30) input_report_key(dev, BTN_TOUCH, 1);
|        if (hw.z < 25) input_report_key(dev, BTN_TOUCH, 0);

Nothing happens if z is lets say 27.

Right, you want to have hysteresis to avoid jitter.

Quoted 2 lines

How do I do fine tunning with
evdev? This looks like nothing has any influence on 30 & 25.

Synaptics native driver ignores BTN_TOUCH and goes strictly by ABS_PRESSURE. The same would be valid for evdev/tslib combo on UCB1400. BTN_TOUCH is for mousedev (and similar dumb consumers) benefit only.

Quoted 3 lines

My minimum pressure seems to be around 500 and I didn't get it past 700. I get nothing if I touch lightly the touchscreen so I thing having nothing is allready sane.

Ah, OK then.

Signature · 1 line
Dmitry
#6 lore raw
Quoted 11 lines · * Dmitry Torokhov | 2008-04-25 14:56:24 [-0400]:
Quoted 9 lines

The code:

|        /* Post events
|         * BTN_TOUCH has to be first as mousedev relies on it when doing
|         * absolute -> relative conversion
|         */
|        if (hw.z > 30) input_report_key(dev, BTN_TOUCH, 1);
|        if (hw.z < 25) input_report_key(dev, BTN_TOUCH, 0);

Nothing happens if z is lets say 27.

Right, you want to have hysteresis to avoid jitter.

Aha, good to know.

Quoted 7 lines
Quoted 2 lines

How do I do fine tunning with
evdev? This looks like nothing has any influence on 30 & 25.

Synaptics native driver ignores BTN_TOUCH and goes strictly by ABS_PRESSURE. The same would be valid for evdev/tslib combo on UCB1400. BTN_TOUCH is for mousedev (and similar dumb consumers) benefit only.

Oh okey. Now I have the picture. I was going to try mice interface with qtopia once everything is working (what could take few days). It looked on the first shot like I could use the bare mice interface without tslib once I get calibration working (right now I thing that it could be easily solved with proper max/min x & y values). If this is not is not working than I would have get tslib working what would make the BTN_TOUCH thing useless.

Quoted 1 line

Dmitry

Sebastian

maintainer
#7 lore raw
Quoted 22 lines · Sebastian Siewior
Quoted 11 lines · * Dmitry Torokhov | 2008-04-25 14:56:24 [-0400]:
Quoted 9 lines

The code:

|        /* Post events
|         * BTN_TOUCH has to be first as mousedev relies on it when doing
|         * absolute -> relative conversion
|         */
|        if (hw.z > 30) input_report_key(dev, BTN_TOUCH, 1);
|        if (hw.z < 25) input_report_key(dev, BTN_TOUCH, 0);

Nothing happens if z is lets say 27.

Right, you want to have hysteresis to avoid jitter.

Aha, good to know.

Quoted 7 lines
Quoted 2 lines

How do I do fine tunning with
evdev? This looks like nothing has any influence on 30 & 25.

Synaptics native driver ignores BTN_TOUCH and goes strictly by ABS_PRESSURE. The same would be valid for evdev/tslib combo on UCB1400. BTN_TOUCH is for mousedev (and similar dumb consumers) benefit only.

Quoted 7 lines

Oh okey. Now I have the picture. I was going to try mice interface with qtopia once everything is working (what could take few days). It looked on the first shot like I could use the bare mice interface without tslib once I get calibration working (right now I thing that it could be easily solved with proper max/min x & y values). If this is not is not working than I would have get tslib working what would make the BTN_TOUCH thing useless.

Yeah, mousedev may work to a degree but if you want precise operation of your toucscreen interfacing through tslib is way to go.

So do you think we should still apply your patch?

Signature · 1 line
Dmitry
#8 lore raw
Quoted 1 line · * Dmitry Torokhov | 2008-04-25 16:22:46 [-0400]:

So do you think we should still apply your patch?

This patch ain't a big thing. Drop it for now please, thank you for considering it. Depending on how things will work I will either resend it or drop it totally.

Quoted 1 line

Dmitry

Sebastian