Re: [PATCH] dw2102: Use RC Core instead of the legacy RC.

2013-11-14 Thread Antti Palosaari

On 14.11.2013 22:45, CrazyCat wrote:

On Thursday 14 November 2013 11:26:44 Mauro Carvalho Chehab wrote:

Type here is likely RC_TYPE_NEC. It seems, however, that the keycodes
have just the least-significant 8 bits.


Geniatech HDStar (su3000) remote is RC5 (conflict with my Philips TV remote). 
But rc pulse decoded by Cypress FX2 firmware and send only one byte code.
So i mark this remote as TYPE_UNKNOWN (like existing keymaps for DVBWorld, 
TeVii, TBS).


If you know whole RC5 code and that single reported byte is part of 
that, you should IMHO add correct keytable to Kernel and emulate those 
missing bytes. See for example how I implemented anysee.c.


regards
Antti




You should also port the above keytables if they don't exist there yet,
or if the existing table have just the least-significant 8 bits, and if
this device can report the full NEC keycode.


TBS, TeVii, DVBWorld (DM1105) RC keymas already present. So i use it.

Tested with real TeVii S630, 660; Prof 7500; DW2104; Geniatech HDStar.

But now  i implement separate rc_query routine for prof  (device send inverted 
key code).

Signed-off-by: Evgeny Plehov 
---
  drivers/media/rc/keymaps/Makefile|3 +-
  drivers/media/rc/keymaps/rc-su3000.c |   77 ++
  drivers/media/usb/dvb-usb/dw2102.c   |  277 +++---
  include/media/rc-map.h   |1 +
  4 files changed, 133 insertions(+), 225 deletions(-)
  create mode 100644 drivers/media/rc/keymaps/rc-su3000.c

diff --git a/drivers/media/rc/keymaps/Makefile 
b/drivers/media/rc/keymaps/Makefile
index b1cde8c..0b8c549 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -98,4 +98,5 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
rc-videomate-s350.o \
rc-videomate-tv-pvr.o \
rc-winfast.o \
-   rc-winfast-usbii-deluxe.o
+   rc-winfast-usbii-deluxe.o \
+   rc-su3000.o
diff --git a/drivers/media/rc/keymaps/rc-su3000.c 
b/drivers/media/rc/keymaps/rc-su3000.c
new file mode 100644
index 000..8b14bdd
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-su3000.c
@@ -0,0 +1,77 @@
+/* tbs-nec.h - Keytable for tbs_nec Remote Controller
+ *
+ * keymap imported from ir-keymaps.c
+ *
+ * Copyright (c) 2010 by Mauro Carvalho Chehab 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include 
+#include 
+
+static struct rc_map_table su3000[] = {
+   { 0x25, KEY_POWER },/* right-bottom Red */
+   { 0x0a, KEY_MUTE }, /* -/-- */
+   { 0x01, KEY_1 },
+   { 0x02, KEY_2 },
+   { 0x03, KEY_3 },
+   { 0x04, KEY_4 },
+   { 0x05, KEY_5 },
+   { 0x06, KEY_6 },
+   { 0x07, KEY_7 },
+   { 0x08, KEY_8 },
+   { 0x09, KEY_9 },
+   { 0x00, KEY_0 },
+   { 0x20, KEY_UP },   /* CH+ */
+   { 0x21, KEY_DOWN }, /* CH+ */
+   { 0x12, KEY_VOLUMEUP }, /* Brightness Up */
+   { 0x13, KEY_VOLUMEDOWN },/* Brightness Down */
+   { 0x1f, KEY_RECORD },
+   { 0x17, KEY_PLAY },
+   { 0x16, KEY_PAUSE },
+   { 0x0b, KEY_STOP },
+   { 0x27, KEY_FASTFORWARD },/* >> */
+   { 0x26, KEY_REWIND },   /* << */
+   { 0x0d, KEY_OK },   /* Mute */
+   { 0x11, KEY_LEFT }, /* VOL- */
+   { 0x10, KEY_RIGHT },/* VOL+ */
+   { 0x29, KEY_BACK }, /* button under 9 */
+   { 0x2c, KEY_MENU }, /* TTX */
+   { 0x2b, KEY_EPG },  /* EPG */
+   { 0x1e, KEY_RED },  /* OSD */
+   { 0x0e, KEY_GREEN },/* Window */
+   { 0x2d, KEY_YELLOW },   /* button under << */
+   { 0x0f, KEY_BLUE }, /* bottom yellow button */
+   { 0x14, KEY_AUDIO },/* Snapshot */
+   { 0x38, KEY_TV },   /* TV/Radio */
+   { 0x0c, KEY_ESC }   /* upper Red button */
+};
+
+static struct rc_map_list su3000_map = {
+   .map = {
+   .scan= su3000,
+   .size= ARRAY_SIZE(su3000),
+   .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
+   .name= RC_MAP_SU3000,
+   }
+};
+
+static int __init init_rc_map_su3000(void)
+{
+   return rc_map_register(&su3000_map);
+}
+
+static void __exit exit_rc_map_su3000(void)
+{
+   rc_map_unregister(&su3000_map);
+}
+
+module_init(init_rc_map_su3000)
+module_exit(exit_rc_map_su3000)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Mauro Carvalho Chehab ");
diff --git a/drivers/media/usb/dvb-usb/dw2102.c 
b/drivers/media/usb/dvb-usb/dw2102.c
index 12e00aa..5a4fa6d 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -109,11 +109,6 @@
"Please see linux/Documentation/dvb/ for more details " \
"on firmware-problems."


Re: [PATCH] dw2102: Use RC Core instead of the legacy RC.

2013-11-14 Thread CrazyCat
On Thursday 14 November 2013 11:26:44 Mauro Carvalho Chehab wrote:
> Type here is likely RC_TYPE_NEC. It seems, however, that the keycodes
> have just the least-significant 8 bits.

Geniatech HDStar (su3000) remote is RC5 (conflict with my Philips TV remote). 
But rc pulse decoded by Cypress FX2 firmware and send only one byte code.
So i mark this remote as TYPE_UNKNOWN (like existing keymaps for DVBWorld, 
TeVii, TBS).

> You should also port the above keytables if they don't exist there yet,
> or if the existing table have just the least-significant 8 bits, and if
> this device can report the full NEC keycode.

TBS, TeVii, DVBWorld (DM1105) RC keymas already present. So i use it.

Tested with real TeVii S630, 660; Prof 7500; DW2104; Geniatech HDStar.

But now  i implement separate rc_query routine for prof  (device send inverted 
key code).

Signed-off-by: Evgeny Plehov 
---
 drivers/media/rc/keymaps/Makefile|3 +-
 drivers/media/rc/keymaps/rc-su3000.c |   77 ++
 drivers/media/usb/dvb-usb/dw2102.c   |  277 +++---
 include/media/rc-map.h   |1 +
 4 files changed, 133 insertions(+), 225 deletions(-)
 create mode 100644 drivers/media/rc/keymaps/rc-su3000.c

diff --git a/drivers/media/rc/keymaps/Makefile 
b/drivers/media/rc/keymaps/Makefile
index b1cde8c..0b8c549 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -98,4 +98,5 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
rc-videomate-s350.o \
rc-videomate-tv-pvr.o \
rc-winfast.o \
-   rc-winfast-usbii-deluxe.o
+   rc-winfast-usbii-deluxe.o \
+   rc-su3000.o
diff --git a/drivers/media/rc/keymaps/rc-su3000.c 
b/drivers/media/rc/keymaps/rc-su3000.c
new file mode 100644
index 000..8b14bdd
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-su3000.c
@@ -0,0 +1,77 @@
+/* tbs-nec.h - Keytable for tbs_nec Remote Controller
+ *
+ * keymap imported from ir-keymaps.c
+ *
+ * Copyright (c) 2010 by Mauro Carvalho Chehab 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include 
+#include 
+
+static struct rc_map_table su3000[] = {
+   { 0x25, KEY_POWER },/* right-bottom Red */
+   { 0x0a, KEY_MUTE }, /* -/-- */
+   { 0x01, KEY_1 },
+   { 0x02, KEY_2 },
+   { 0x03, KEY_3 },
+   { 0x04, KEY_4 },
+   { 0x05, KEY_5 },
+   { 0x06, KEY_6 },
+   { 0x07, KEY_7 },
+   { 0x08, KEY_8 },
+   { 0x09, KEY_9 },
+   { 0x00, KEY_0 },
+   { 0x20, KEY_UP },   /* CH+ */
+   { 0x21, KEY_DOWN }, /* CH+ */
+   { 0x12, KEY_VOLUMEUP }, /* Brightness Up */
+   { 0x13, KEY_VOLUMEDOWN },/* Brightness Down */
+   { 0x1f, KEY_RECORD },
+   { 0x17, KEY_PLAY },
+   { 0x16, KEY_PAUSE },
+   { 0x0b, KEY_STOP },
+   { 0x27, KEY_FASTFORWARD },/* >> */
+   { 0x26, KEY_REWIND },   /* << */
+   { 0x0d, KEY_OK },   /* Mute */
+   { 0x11, KEY_LEFT }, /* VOL- */
+   { 0x10, KEY_RIGHT },/* VOL+ */
+   { 0x29, KEY_BACK }, /* button under 9 */
+   { 0x2c, KEY_MENU }, /* TTX */
+   { 0x2b, KEY_EPG },  /* EPG */
+   { 0x1e, KEY_RED },  /* OSD */
+   { 0x0e, KEY_GREEN },/* Window */
+   { 0x2d, KEY_YELLOW },   /* button under << */
+   { 0x0f, KEY_BLUE }, /* bottom yellow button */
+   { 0x14, KEY_AUDIO },/* Snapshot */
+   { 0x38, KEY_TV },   /* TV/Radio */
+   { 0x0c, KEY_ESC }   /* upper Red button */
+};
+
+static struct rc_map_list su3000_map = {
+   .map = {
+   .scan= su3000,
+   .size= ARRAY_SIZE(su3000),
+   .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
+   .name= RC_MAP_SU3000,
+   }
+};
+
+static int __init init_rc_map_su3000(void)
+{
+   return rc_map_register(&su3000_map);
+}
+
+static void __exit exit_rc_map_su3000(void)
+{
+   rc_map_unregister(&su3000_map);
+}
+
+module_init(init_rc_map_su3000)
+module_exit(exit_rc_map_su3000)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Mauro Carvalho Chehab ");
diff --git a/drivers/media/usb/dvb-usb/dw2102.c 
b/drivers/media/usb/dvb-usb/dw2102.c
index 12e00aa..5a4fa6d 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -109,11 +109,6 @@
"Please see linux/Documentation/dvb/ for more details " \
"on firmware-problems."
 
-struct rc_map_dvb_usb_table_table {
-   struct rc_map_table *rc_keys;
-   int rc_keys_size;
-};
-
 struct su3000_state {
u8 initialized;
 };
@@ -128,12 +123,6 @@ module_param_named(debug, dvb_usb_dw2102_debug, int, 0644);
 MODULE_PARM_DESC(d

Re: [PATCH] dw2102: Use RC Core instead of the legacy RC.

2013-11-14 Thread Mauro Carvalho Chehab
Em Thu, 14 Nov 2013 01:57:36 +0200
CrazyCat  escreveu:

> Use RC Core instead of the legacy RC
> 
> Signed-off-by: Evgeny Plehov 
> ---
> diff --git a/drivers/media/rc/keymaps/Makefile 
> b/drivers/media/rc/keymaps/Makefile
> index b1cde8c..0b8c549 100644
> --- a/drivers/media/rc/keymaps/Makefile
> +++ b/drivers/media/rc/keymaps/Makefile
> @@ -98,4 +98,5 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
>   rc-videomate-s350.o \
>   rc-videomate-tv-pvr.o \
>   rc-winfast.o \
> - rc-winfast-usbii-deluxe.o
> + rc-winfast-usbii-deluxe.o \
> + rc-su3000.o
> diff --git a/drivers/media/rc/keymaps/rc-su3000.c 
> b/drivers/media/rc/keymaps/rc-su3000.c
> new file mode 100644
> index 000..8b14bdd
> --- /dev/null
> +++ b/drivers/media/rc/keymaps/rc-su3000.c
> @@ -0,0 +1,77 @@
> +/* tbs-nec.h - Keytable for tbs_nec Remote Controller
> + *
> + * keymap imported from ir-keymaps.c
> + *
> + * Copyright (c) 2010 by Mauro Carvalho Chehab 
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +
> +#include 
> +#include 
> +
> +static struct rc_map_table su3000[] = {
> + { 0x25, KEY_POWER },/* right-bottom Red */
> + { 0x0a, KEY_MUTE }, /* -/-- */
> + { 0x01, KEY_1 },
> + { 0x02, KEY_2 },
> + { 0x03, KEY_3 },
> + { 0x04, KEY_4 },
> + { 0x05, KEY_5 },
> + { 0x06, KEY_6 },
> + { 0x07, KEY_7 },
> + { 0x08, KEY_8 },
> + { 0x09, KEY_9 },
> + { 0x00, KEY_0 },
> + { 0x20, KEY_UP },   /* CH+ */
> + { 0x21, KEY_DOWN }, /* CH+ */
> + { 0x12, KEY_VOLUMEUP }, /* Brightness Up */
> + { 0x13, KEY_VOLUMEDOWN },/* Brightness Down */
> + { 0x1f, KEY_RECORD },
> + { 0x17, KEY_PLAY },
> + { 0x16, KEY_PAUSE },
> + { 0x0b, KEY_STOP },
> + { 0x27, KEY_FASTFORWARD },/* >> */
> + { 0x26, KEY_REWIND },   /* << */
> + { 0x0d, KEY_OK },   /* Mute */
> + { 0x11, KEY_LEFT }, /* VOL- */
> + { 0x10, KEY_RIGHT },/* VOL+ */
> + { 0x29, KEY_BACK }, /* button under 9 */
> + { 0x2c, KEY_MENU }, /* TTX */
> + { 0x2b, KEY_EPG },  /* EPG */
> + { 0x1e, KEY_RED },  /* OSD */
> + { 0x0e, KEY_GREEN },/* Window */
> + { 0x2d, KEY_YELLOW },   /* button under << */
> + { 0x0f, KEY_BLUE }, /* bottom yellow button */
> + { 0x14, KEY_AUDIO },/* Snapshot */
> + { 0x38, KEY_TV },   /* TV/Radio */
> + { 0x0c, KEY_ESC }   /* upper Red button */
> +};
> +
> +static struct rc_map_list su3000_map = {
> + .map = {
> + .scan= su3000,
> + .size= ARRAY_SIZE(su3000),
> + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */

Type here is likely RC_TYPE_NEC. It seems, however, that the keycodes
have just the least-significant 8 bits.

> + .name= RC_MAP_SU3000,
> + }
> +};
> +
> +static int __init init_rc_map_su3000(void)
> +{
> + return rc_map_register(&su3000_map);
> +}
> +
> +static void __exit exit_rc_map_su3000(void)
> +{
> + rc_map_unregister(&su3000_map);
> +}
> +
> +module_init(init_rc_map_su3000)
> +module_exit(exit_rc_map_su3000)
> +
> +MODULE_LICENSE("GPL");
> +MODULE_AUTHOR("Mauro Carvalho Chehab ");
> diff --git a/drivers/media/usb/dvb-usb/dw2102.c 
> b/drivers/media/usb/dvb-usb/dw2102.c
> index 12e00aa..8400238 100644
> --- a/drivers/media/usb/dvb-usb/dw2102.c
> +++ b/drivers/media/usb/dvb-usb/dw2102.c
> @@ -109,11 +109,6 @@
>   "Please see linux/Documentation/dvb/ for more details " \
>   "on firmware-problems."
>  
> -struct rc_map_dvb_usb_table_table {
> - struct rc_map_table *rc_keys;
> - int rc_keys_size;
> -};
> -
>  struct su3000_state {
>   u8 initialized;
>  };
> @@ -128,12 +123,6 @@ module_param_named(debug, dvb_usb_dw2102_debug, int, 
> 0644);
>  MODULE_PARM_DESC(debug, "set debugging level (1=info 2=xfer 4=rc(or-able))."
>   DVB_USB_DEBUG_STATUS);
>  
> -/* keymaps */
> -static int ir_keymap;
> -module_param_named(keymap, ir_keymap, int, 0644);
> -MODULE_PARM_DESC(keymap, "set keymap 0=default 1=dvbworld 2=tevii 3=tbs  ..."
> - " 256=none");
> -
>  /* demod probe */
>  static int demod_probe = 1;
>  module_param_named(demod, demod_probe, int, 0644);
> @@ -1389,174 +1378,8 @@ static int dw3101_tuner_attach(struct dvb_usb_adapter 
> *adap)
>   return 0;
>  }
>  
> -static struct rc_map_table rc_map_dw210x_table[] = {
> - { 0xf80a, KEY_POWER2 }, /*power*/
> - { 0xf80c, KEY_MUTE },   /*mute*/
> - { 0xf811, KEY_1 },
> - { 0xf812, KEY_2 },
> - { 0xf813, KEY_3 },
> - { 0xf814, KEY_4 },
> - { 0xf815, KEY_