[PATCH] GTA0[12]: make headset button report PLAY pressed on press

Paul Fertser fercerpav at gmail.com
Mon Jun 8 21:46:53 CEST 2009


As discussed on the ML, currently headset button reports "KEY_PAUSE
released" on press and "pressed" on release. For "pause" semantics it makes
sense but if someone thinks of that as of just another button, it'd be good
to have "pressed/released" events consistent with button press/release.

Luca Capello <luca at pca.it> suggested to change the button event to KEY_PLAY
and to invert the state to make it more consistent.

This trivial patch inverts button events for GTA03 KEY_PLUS and KEY_MINUS,
i'm not sure how undesirable that is. I can prepare an alternative that
preserves current behaviour on GTA03 per request.

Signed-off-by: Paul Fertser <fercerpav at gmail.com>
---
 drivers/input/keyboard/neo1973kbd.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/input/keyboard/neo1973kbd.c b/drivers/input/keyboard/neo1973kbd.c
index a95dd58..8756ae6 100644
--- a/drivers/input/keyboard/neo1973kbd.c
+++ b/drivers/input/keyboard/neo1973kbd.c
@@ -75,7 +75,7 @@ static struct neo1973kbd_key keys[] = {
 	[NEO1973_KEY_HOLD] = {
 		.name = "Neo1973 HOLD button",
 		.isr = neo1973kbd_default_key_irq,
-		.input_key = KEY_PAUSE,
+		.input_key = KEY_PLAY,
 	},
 	[NEO1973_KEY_JACK] = {
 		.name = "Neo1973 Headphone jack",
@@ -161,7 +161,7 @@ static irqreturn_t neo1973kbd_default_key_irq(int irq, void *dev_id)
 			continue;
 
 		input_report_key(kbd->input, keys[n].input_key,
-				  gpio_get_value(kbd->pdev->resource[n].start));
+				  !gpio_get_value(kbd->pdev->resource[n].start));
 		input_sync(kbd->input);
 	}
 
@@ -346,7 +346,7 @@ static int neo1973kbd_probe(struct platform_device *pdev)
 	input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_SW);
 	set_bit(SW_HEADPHONE_INSERT, input_dev->swbit);
 	set_bit(KEY_PHONE, input_dev->keybit);
-	set_bit(KEY_PAUSE, input_dev->keybit);
+	set_bit(KEY_PLAY, input_dev->keybit);
 
 	rc = input_register_device(neo1973kbd->input);
 	if (rc)
-- 
1.6.0.6




More information about the openmoko-kernel mailing list