Bug#276083: [PATCH] keymap-loading interface for budget-ci
Darren Salt
pkg-vdr-dvb-devel@lists.alioth.debian.org
Mon, 11 Oct 2004 22:31:09 +0100
This message is in MIME format which your mailer apparently does not support.
You either require a newer version of your software which supports MIME, or
a separate MIME decoding utility. Alternatively, ask the sender of this
message to resend it in a different format.
--1608610353--239176158--2033598025
Content-Type: text/plain; charset=us-ascii
Package: dvb-driver-source
Version: 1.1.1-3
Severity: wishlist
Tags: patch
The attached patch adds a file /proc/budget_ci_ir which accepts a set of 64
keysyms (128 bytes) for programming of the remote control keymap. The code is
derived from the /proc interface code implemented in av7110_ir.c.
It should be written to by budget_ci_loadkeys (patch sent separately).
(Note also that this patch is applicable to kernel 2.6.8.1: budget_ci.c there
is identical. It should also be applicable, with trivial reject resolution,
to current linuxtv kernel CVS.)
--
| Darren Salt | linux (or ds) at | nr. Ashington,
| woody, sarge, | youmustbejoking | Northumberland
| RISC OS | demon co uk | Toon Army
| <URL:http://www.youmustbejoking.demon.co.uk/progs.linux.html>
Experiments should be reproducible. They should all fail in the same way.
--1608610353--239176158--2033598025
Content-Type: text/plain; charset=iso-8859-1; name="budget-ci-keys.patch"
Content-Disposition: attachment; filename="budget-ci-keys.patch"
Content-Transfer-Encoding: quoted-printable
--- linux/drivers/media/dvb/ttpci/budget-ci.c.orig 2003-11-20 10:50:15.00=
0000000 +0000
+++ linux/drivers/media/dvb/ttpci/budget-ci.c 2004-09-27 22:16:19.0000000=
00 +0100
@@ -34,6 +34,7 @@
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/input.h>
+#include <linux/proc_fs.h>
=20
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
#include "input_fake.h"
@@ -181,10 +182,48 @@
}
=20
=20
+static int budget_ci_ir_write_proc (struct file *file,
+ const char __user *buffer,
+ unsigned long count, void *data)
+{
+ /* adapted from av7110_ir.c */
+ char *page;
+ int i;
+ struct input_dev *input =3D (struct input_dev *)data;
+
+ if (count < sizeof (key_map))
+ return -EINVAL;
+=09
+ page =3D (char *)vmalloc(sizeof (key_map));
+ if (!page)
+ return -ENOMEM;
+=09
+ if (copy_from_user(page, buffer, sizeof (key_map))) {
+ vfree(page);
+ return -EFAULT;
+ }
+
+ memcpy (&key_map, page, sizeof (key_map));
+ vfree(page);
+
+ memset (input->keybit, 0, sizeof(input->keybit));
+
+ for (i=3D0; i<sizeof(key_map)/sizeof(key_map[0]); i++) {
+ if (key_map[i] > KEY_MAX)
+ key_map[i] =3D 0;
+ else if (key_map[i] > KEY_RESERVED)
+ set_bit (key_map[i], input->keybit);
+ }
+
+ return count;
+}
+
+
static int msp430_ir_init (struct budget_ci *budget_ci)
{
struct saa7146_dev *saa =3D budget_ci->budget.dev;
int i;
+ static struct proc_dir_entry *e;
=20
memset(&budget_ci->input_dev, 0, sizeof(struct input_dev));
=20
@@ -204,6 +243,13 @@
=20
saa7146_setgpio(saa, 3, SAA7146_GPIO_IRQHI);=20
=20
+ e =3D create_proc_entry ("budget_ci_ir", S_IFREG | S_IRUGO | S_IWUSR, N=
ULL);
+ if (e) {
+ e->write_proc =3D budget_ci_ir_write_proc;
+ e->data =3D &budget_ci->input_dev;
+ e->size =3D sizeof (key_map);
+ }
+
return 0;
}
=20
@@ -213,6 +259,8 @@
struct saa7146_dev *saa =3D budget_ci->budget.dev;
struct input_dev *dev =3D &budget_ci->input_dev;
=20
+ remove_proc_entry ("budget_ci_ir", NULL);
+
saa7146_write(saa, IER, saa7146_read(saa, IER) & ~MASK_06);
saa7146_setgpio(saa, 3, SAA7146_GPIO_INPUT);
saa7146_setgpio(saa, 2, SAA7146_GPIO_INPUT);
--1608610353--239176158--2033598025--