Bug#276082: [PATCH] keymap-loading interface for budget-ci
Darren Salt
pkg-vdr-dvb-devel@lists.alioth.debian.org
Mon, 11 Oct 2004 22:22:35 +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.
--1458367870--1972188164--1285565509
Content-Type: text/plain; charset=us-ascii
Package: dvb-utils
Version: 1.1.0-3
Severity: wishlist
Tags: patch
The attached patch adds a utility "budget_ci_loadkeys" (basically, a patched
av7110_loadkeys) which should be used to write to /proc/budget_ci_ir in order
to program the keymap for some DVB receiver cards.
It requires a corresponding kernel DVB patch (sent separately).
Suitable keymaps already exist in the package, although I'd do
s/KEY_([[:digit:]])/BTN_\1/.
--
| Darren Salt | nr. Ashington, | linux (or ds) at
| woody, sarge, | Northumberland | youmustbejoking
| RISC OS | Toon Army | demon co uk
| Oh, sarge too...
I can't reach the brakes on this piano!
--1458367870--1972188164--1285565509
Content-Type: text/plain; charset=iso-8859-1; name="dvb-utils.budget_ci_loadkeys.patch"
Content-Disposition: attachment; filename="dvb-utils.budget_ci_loadkeys.patch"
Content-Transfer-Encoding: quoted-printable
diff -urNad linuxtv-dvb-apps-1.1.0/util/av7110_loadkeys/Makefile linuxtv-=
dvb-apps-1.1.0/util/av7110_loadkeys/Makefile
--- linuxtv-dvb-apps-1.1.0/util/av7110_loadkeys/Makefile 2004-09-27 20:48=
:23.000000000 +0100
+++ linuxtv-dvb-apps-1.1.0/util/av7110_loadkeys/Makefile 2004-09-27 20:48=
:39.000000000 +0100
@@ -1,14 +1,23 @@
CC =3D gcc
-CFLAGS =3D -g -Wall -O2
+CFLAGS =3D -g -Wall -O2 -D_GNU_SOURCE
=20
-all: av7110_loadkeys evtest
+all: av7110_loadkeys budget_ci_loadkeys evtest
=20
av7110_loadkeys: av7110_loadkeys.o
=20
+budget_ci_loadkeys: budget_ci_loadkeys.o
+
evtest: evtest.o
=20
+av7110_loadkeys.o: CFLAGS +=3D -UHW_MSP430
av7110_loadkeys.o: av7110_loadkeys.c input_keynames.h
=20
+budget_ci_loadkeys.c: av7110_loadkeys.c
+ ln av7110_loadkeys.c budget_ci_loadkeys.c
+
+budget_ci_loadkeys.o: CFLAGS +=3D -DHW_MSP430
+budget_ci_loadkeys.o: budget_ci_loadkeys.c input_keynames.h
+
evtest.o: evtest.c input_keynames.h
=20
=20
@@ -53,5 +62,6 @@
=20
=20
clean:
- $(RM) core* *.o input_keynames.h av7110_loadkeys evtest
+ $(RM) core* *.o input_keynames.h av7110_loadkeys budget_ci_loadkeys \
+ budget_ci_loadkeys.c evtest
=20
diff -urNad linuxtv-dvb-apps-1.1.0/util/av7110_loadkeys/av7110_loadkeys.c=
linuxtv-dvb-apps-1.1.0/util/av7110_loadkeys/av7110_loadkeys.c
--- linuxtv-dvb-apps-1.1.0/util/av7110_loadkeys/av7110_loadkeys.c 2004-09=
-27 20:48:23.000000000 +0100
+++ linuxtv-dvb-apps-1.1.0/util/av7110_loadkeys/av7110_loadkeys.c 2004-09=
-27 20:48:23.000000000 +0100
@@ -1,5 +1,6 @@
#include <asm/types.h>
#include <stdlib.h>
+#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/types.h>
@@ -111,12 +112,20 @@
=20
=20
=20
+#ifdef HW_MSP430
+const char usage [] =3D "\n\tusage: budget_ci_loadkeys keymap_filename.r=
c5\n\n";
+#else
const char usage [] =3D "\n\tusage: av7110_loadkeys [-i|--invert] [-a|--=
address <num>] keymap_filename.(rc5|rcmm)\n\n";
-
+#endif
=20
struct ir_setup {
+#ifdef HW_MSP430
+#define KEYTAB_SIZE 64
+#else
+#define KEYTAB_SIZE 256
__u32 ir_config;
- __u16 keytab [256];
+#endif
+ __u16 keytab [KEYTAB_SIZE];
} __attribute__ ((packed));
=20
=20
@@ -128,7 +137,10 @@
char *buf, *pos, *fname =3D NULL;
=20
for (i=3D1; i<argc; i++) {
+#ifndef HW_MSP430
+ /* AV7110 only; not MSP430 */
if (!strcmp("-i", argv[i]) || !strcmp("--invert", argv[i]))
+ =09
setup.ir_config |=3D 0x8000;
else if (!strcmp("-a", argv[i]) || !strcmp("--address", argv[i])) {
if (++i < argc) {
@@ -136,6 +148,7 @@
setup.ir_config |=3D 0x4000;
}
} else
+#endif
fname =3D argv[i];
}
=20
@@ -144,6 +157,14 @@
exit (-1);
}
=20
+#ifdef HW_MSP430
+ if (strncmp(".rc5", fname + strlen(fname) - 4, 4) !=3D 0) {
+ const char msg [] =3D "\nERROR: "
+ "input filename must have suffix .rc5\n";
+ write (0, msg, strlen(msg));
+ exit (-1);
+ }
+#else
if (strncmp(".rcmm", fname + strlen(fname) - 5, 5) =3D=3D 0)
setup.ir_config |=3D 0x0001;
else if (strncmp(".rc5", fname + strlen(fname) - 4, 4) !=3D 0) {
@@ -152,6 +173,7 @@
write (0, msg, strlen(msg));
exit (-1);
}
+#endif
=20
if ((fd =3D open (fname, O_RDONLY)) < 0)
print_error ("open", fname);
@@ -173,9 +195,11 @@
key =3D strtol (pos, &pos, 0);
keycode =3D parse_keyname (pos, &pos, buf + len - pos);
=20
- if (key < 0 || key > 0xff) {
- const char msg [] =3D=20
- "\nERROR: key must be in range 0 ... 0xff!\n\n";
+ if (key < 0 || key >=3D KEYTAB_SIZE) {
+ char *msg;
+ asprintf (&msg,
+ "\nERROR: key must be in range 0 ... 0x%02x!\n\n",
+ KEYTAB_SIZE);
=20
write (0, msg, strlen(msg));
exit (-1);
@@ -190,7 +214,7 @@
munmap (buf, len);
close (fd);
=20
- write (1, &setup, 4 + 256 * sizeof(__u16));
+ write (1, &setup, sizeof (setup));
=20
return 0;
}
--1458367870--1972188164--1285565509--