[PATCH] Dynamic keymap for budget-ci

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The attached patch changes budget-ci so that the keymap can be changed using the regular input-kbd tool (like it can for other remotes using ir-kbd-*).

Compiled and tested with a programmable remote.

Signed-off-by: David Härdeman <david@xxxxxxxxxxx>

--- linux-2.6.18.orig/drivers/media/dvb/ttpci/budget-ci.c	2006-09-22 18:04:22.000000000 +0200
+++ linux-2.6.18/drivers/media/dvb/ttpci/budget-ci.c	2006-09-23 00:23:16.000000000 +0200
@@ -136,14 +136,14 @@
 	struct input_dev *dev = (struct input_dev *) data;
 
 	if (dev->rep[0] == 0 || dev->rep[0] == ~0) {
-		input_event(dev, EV_KEY, key_map[dev->repeat_key], !!0);
+		input_report_key(dev, INPUT_KEYCODE(dev, dev->repeat_key), 0);
 		return;
 	}
 
 	dev->rep[0] = 0;
 	dev->timer.expires = jiffies + HZ * 350 / 1000;
 	add_timer(&dev->timer);
-	input_event(dev, EV_KEY, key_map[dev->repeat_key], 2);	/* REPEAT */
+	input_report_key(dev, INPUT_KEYCODE(dev, dev->repeat_key), 2); /* REPEAT */
 }
 
 static void msp430_ir_interrupt(unsigned long data)
@@ -162,10 +162,10 @@
 				return;
 			}
 			del_timer(&dev->timer);
-			input_event(dev, EV_KEY, key_map[dev->repeat_key], !!0);
+			input_report_key(dev, INPUT_KEYCODE(dev, dev->repeat_key), 0);
 		}
 
-		if (!key_map[code]) {
+		if (!INPUT_KEYCODE(dev, code)) {
 			printk("DVB (%s): no key for %02x!\n", __FUNCTION__, code);
 			return;
 		}
@@ -177,7 +177,7 @@
 		/* 350 milliseconds */
 		dev->timer.expires = jiffies + HZ * 350 / 1000;
 		/* MAKE */
-		input_event(dev, EV_KEY, key_map[code], !0);
+		input_report_key(dev, INPUT_KEYCODE(dev, dev->repeat_key), !0);
 		add_timer(&dev->timer);
 	}
 }
@@ -187,14 +187,24 @@
 	struct saa7146_dev *saa = budget_ci->budget.dev;
 	struct input_dev *input_dev;
 	int i;
+	u16 *kmap;
 
+	kmap = kmalloc(sizeof(key_map), GFP_KERNEL);
+	if (!kmap)
+		return -ENOMEM;
 	budget_ci->input_dev = input_dev = input_allocate_device();
-	if (!input_dev)
+	if (!input_dev) {
+		kfree(kmap);
 		return -ENOMEM;
+	}
 
 	sprintf(budget_ci->ir_dev_name, "Budget-CI dvb ir receiver %s", saa->name);
+	memcpy(kmap, key_map, sizeof(key_map));
 
 	input_dev->name = budget_ci->ir_dev_name;
+	input_dev->keycode = kmap;
+	input_dev->keycodesize = sizeof(u16);
+	input_dev->keycodemax = ARRAY_SIZE(key_map);
 
 	set_bit(EV_KEY, input_dev->evbit);
 	for (i = 0; i < ARRAY_SIZE(key_map); i++)
@@ -222,6 +232,7 @@
 	if (del_timer(&dev->timer))
 		input_event(dev, EV_KEY, key_map[dev->repeat_key], !!0);
 
+	kfree(dev->keycode);
 	input_unregister_device(dev);
 }
 
_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux