2019-02-19 02:39:56

by Jonas Karlman

[permalink] [raw]
Subject: [PATCH 1/3] [media] rc/keymaps: add keytable for Pine64 IR Remote Controller

This RC map is based on remote key schema at [1], the mouse button key
did not have an obvious target and was mapped to KEY_CONTEXT_MENU.

[1] http://files.pine64.org/doc/Pine%20A64%20Schematic/remote-wit-logo.jpg

Signed-off-by: Jonas Karlman <[email protected]>
---
drivers/media/rc/keymaps/Makefile | 1 +
drivers/media/rc/keymaps/rc-pine64.c | 59 ++++++++++++++++++++++++++++
include/media/rc-map.h | 1 +
3 files changed, 61 insertions(+)
create mode 100644 drivers/media/rc/keymaps/rc-pine64.c

diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile
index 5b1399af6b3a..0ea52f65bb03 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -76,6 +76,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
rc-norwood.o \
rc-npgtech.o \
rc-pctv-sedna.o \
+ rc-pine64.o \
rc-pinnacle-color.o \
rc-pinnacle-grey.o \
rc-pinnacle-pctv-hd.o \
diff --git a/drivers/media/rc/keymaps/rc-pine64.c b/drivers/media/rc/keymaps/rc-pine64.c
new file mode 100644
index 000000000000..94e5624f63f4
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-pine64.c
@@ -0,0 +1,59 @@
+// SPDX-License-Identifier: GPL-2.0+
+// Keytable for Pine64 IR Remote Controller
+// Copyright (c) 2017 Jonas Karlman
+
+#include <media/rc-map.h>
+#include <linux/module.h>
+
+static struct rc_map_table pine64[] = {
+ { 0x404000, KEY_NUMERIC_0 },
+ { 0x404001, KEY_NUMERIC_1 },
+ { 0x404002, KEY_NUMERIC_2 },
+ { 0x404003, KEY_NUMERIC_3 },
+ { 0x404004, KEY_NUMERIC_4 },
+ { 0x404005, KEY_NUMERIC_5 },
+ { 0x404006, KEY_NUMERIC_6 },
+ { 0x404007, KEY_NUMERIC_7 },
+ { 0x404008, KEY_NUMERIC_8 },
+ { 0x404009, KEY_NUMERIC_9 },
+ { 0x40400a, KEY_MUTE },
+ { 0x40400b, KEY_UP },
+ { 0x40400c, KEY_BACKSPACE },
+ { 0x40400d, KEY_OK },
+ { 0x40400e, KEY_DOWN },
+ { 0x404010, KEY_LEFT },
+ { 0x404011, KEY_RIGHT },
+ { 0x404017, KEY_VOLUMEDOWN },
+ { 0x404018, KEY_VOLUMEUP },
+ { 0x40401a, KEY_HOME },
+ { 0x40401d, KEY_MENU },
+ { 0x40401f, KEY_WWW },
+ { 0x404045, KEY_BACK },
+ { 0x404047, KEY_CONTEXT_MENU },
+ { 0x40404d, KEY_POWER },
+};
+
+static struct rc_map_list pine64_map = {
+ .map = {
+ .scan = pine64,
+ .size = ARRAY_SIZE(pine64),
+ .rc_proto = RC_PROTO_NECX,
+ .name = RC_MAP_PINE64,
+ }
+};
+
+static int __init init_rc_map_pine64(void)
+{
+ return rc_map_register(&pine64_map);
+}
+
+static void __exit exit_rc_map_pine64(void)
+{
+ rc_map_unregister(&pine64_map);
+}
+
+module_init(init_rc_map_pine64)
+module_exit(exit_rc_map_pine64)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Jonas Karlman");
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index d621acadfbf3..52b554aa784d 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -236,6 +236,7 @@ struct rc_map *rc_map_get(const char *name);
#define RC_MAP_NORWOOD "rc-norwood"
#define RC_MAP_NPGTECH "rc-npgtech"
#define RC_MAP_PCTV_SEDNA "rc-pctv-sedna"
+#define RC_MAP_PINE64 "rc-pine64"
#define RC_MAP_PINNACLE_COLOR "rc-pinnacle-color"
#define RC_MAP_PINNACLE_GREY "rc-pinnacle-grey"
#define RC_MAP_PINNACLE_PCTV_HD "rc-pinnacle-pctv-hd"
--
2.17.1



2019-02-20 09:58:59

by Sean Young

[permalink] [raw]
Subject: Re: [PATCH 1/3] [media] rc/keymaps: add keytable for Pine64 IR Remote Controller

On Mon, Feb 18, 2019 at 09:59:36PM +0000, Jonas Karlman wrote:
> This RC map is based on remote key schema at [1], the mouse button key
> did not have an obvious target and was mapped to KEY_CONTEXT_MENU.

How about BTN_LEFT ?

Thanks,

Sean

>
> [1] http://files.pine64.org/doc/Pine%20A64%20Schematic/remote-wit-logo.jpg
>
> Signed-off-by: Jonas Karlman <[email protected]>
> ---
> drivers/media/rc/keymaps/Makefile | 1 +
> drivers/media/rc/keymaps/rc-pine64.c | 59 ++++++++++++++++++++++++++++
> include/media/rc-map.h | 1 +
> 3 files changed, 61 insertions(+)
> create mode 100644 drivers/media/rc/keymaps/rc-pine64.c
>
> diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile
> index 5b1399af6b3a..0ea52f65bb03 100644
> --- a/drivers/media/rc/keymaps/Makefile
> +++ b/drivers/media/rc/keymaps/Makefile
> @@ -76,6 +76,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
> rc-norwood.o \
> rc-npgtech.o \
> rc-pctv-sedna.o \
> + rc-pine64.o \
> rc-pinnacle-color.o \
> rc-pinnacle-grey.o \
> rc-pinnacle-pctv-hd.o \
> diff --git a/drivers/media/rc/keymaps/rc-pine64.c b/drivers/media/rc/keymaps/rc-pine64.c
> new file mode 100644
> index 000000000000..94e5624f63f4
> --- /dev/null
> +++ b/drivers/media/rc/keymaps/rc-pine64.c
> @@ -0,0 +1,59 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +// Keytable for Pine64 IR Remote Controller
> +// Copyright (c) 2017 Jonas Karlman
> +
> +#include <media/rc-map.h>
> +#include <linux/module.h>
> +
> +static struct rc_map_table pine64[] = {
> + { 0x404000, KEY_NUMERIC_0 },
> + { 0x404001, KEY_NUMERIC_1 },
> + { 0x404002, KEY_NUMERIC_2 },
> + { 0x404003, KEY_NUMERIC_3 },
> + { 0x404004, KEY_NUMERIC_4 },
> + { 0x404005, KEY_NUMERIC_5 },
> + { 0x404006, KEY_NUMERIC_6 },
> + { 0x404007, KEY_NUMERIC_7 },
> + { 0x404008, KEY_NUMERIC_8 },
> + { 0x404009, KEY_NUMERIC_9 },
> + { 0x40400a, KEY_MUTE },
> + { 0x40400b, KEY_UP },
> + { 0x40400c, KEY_BACKSPACE },
> + { 0x40400d, KEY_OK },
> + { 0x40400e, KEY_DOWN },
> + { 0x404010, KEY_LEFT },
> + { 0x404011, KEY_RIGHT },
> + { 0x404017, KEY_VOLUMEDOWN },
> + { 0x404018, KEY_VOLUMEUP },
> + { 0x40401a, KEY_HOME },
> + { 0x40401d, KEY_MENU },
> + { 0x40401f, KEY_WWW },
> + { 0x404045, KEY_BACK },
> + { 0x404047, KEY_CONTEXT_MENU },
> + { 0x40404d, KEY_POWER },
> +};
> +
> +static struct rc_map_list pine64_map = {
> + .map = {
> + .scan = pine64,
> + .size = ARRAY_SIZE(pine64),
> + .rc_proto = RC_PROTO_NECX,
> + .name = RC_MAP_PINE64,
> + }
> +};
> +
> +static int __init init_rc_map_pine64(void)
> +{
> + return rc_map_register(&pine64_map);
> +}
> +
> +static void __exit exit_rc_map_pine64(void)
> +{
> + rc_map_unregister(&pine64_map);
> +}
> +
> +module_init(init_rc_map_pine64)
> +module_exit(exit_rc_map_pine64)
> +
> +MODULE_LICENSE("GPL");
> +MODULE_AUTHOR("Jonas Karlman");
> diff --git a/include/media/rc-map.h b/include/media/rc-map.h
> index d621acadfbf3..52b554aa784d 100644
> --- a/include/media/rc-map.h
> +++ b/include/media/rc-map.h
> @@ -236,6 +236,7 @@ struct rc_map *rc_map_get(const char *name);
> #define RC_MAP_NORWOOD "rc-norwood"
> #define RC_MAP_NPGTECH "rc-npgtech"
> #define RC_MAP_PCTV_SEDNA "rc-pctv-sedna"
> +#define RC_MAP_PINE64 "rc-pine64"
> #define RC_MAP_PINNACLE_COLOR "rc-pinnacle-color"
> #define RC_MAP_PINNACLE_GREY "rc-pinnacle-grey"
> #define RC_MAP_PINNACLE_PCTV_HD "rc-pinnacle-pctv-hd"
> --
> 2.17.1

2019-02-22 15:01:42

by Jonas Karlman

[permalink] [raw]
Subject: Re: [PATCH 1/3] [media] rc/keymaps: add keytable for Pine64 IR Remote Controller

On 2019-02-20 10:57, Sean Young wrote:
> On Mon, Feb 18, 2019 at 09:59:36PM +0000, Jonas Karlman wrote:
>> This RC map is based on remote key schema at [1], the mouse button key
>> did not have an obvious target and was mapped to KEY_CONTEXT_MENU.
> How about BTN_LEFT ?

That should work, I only looked at the KEY_ events :-)

I will send a v2 using BTN_LEFT instead of KEY_CONTEXT_MENU.

Regards,
Jonas

>
> Thanks,
>
> Sean
>
>> [1] http://files.pine64.org/doc/Pine%20A64%20Schematic/remote-wit-logo.jpg
>>
>> Signed-off-by: Jonas Karlman <[email protected]>
>> ---
>> drivers/media/rc/keymaps/Makefile | 1 +
>> drivers/media/rc/keymaps/rc-pine64.c | 59 ++++++++++++++++++++++++++++
>> include/media/rc-map.h | 1 +
>> 3 files changed, 61 insertions(+)
>> create mode 100644 drivers/media/rc/keymaps/rc-pine64.c
>>
>> diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile
>> index 5b1399af6b3a..0ea52f65bb03 100644
>> --- a/drivers/media/rc/keymaps/Makefile
>> +++ b/drivers/media/rc/keymaps/Makefile
>> @@ -76,6 +76,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
>> rc-norwood.o \
>> rc-npgtech.o \
>> rc-pctv-sedna.o \
>> + rc-pine64.o \
>> rc-pinnacle-color.o \
>> rc-pinnacle-grey.o \
>> rc-pinnacle-pctv-hd.o \
>> diff --git a/drivers/media/rc/keymaps/rc-pine64.c b/drivers/media/rc/keymaps/rc-pine64.c
>> new file mode 100644
>> index 000000000000..94e5624f63f4
>> --- /dev/null
>> +++ b/drivers/media/rc/keymaps/rc-pine64.c
>> @@ -0,0 +1,59 @@
>> +// SPDX-License-Identifier: GPL-2.0+
>> +// Keytable for Pine64 IR Remote Controller
>> +// Copyright (c) 2017 Jonas Karlman
>> +
>> +#include <media/rc-map.h>
>> +#include <linux/module.h>
>> +
>> +static struct rc_map_table pine64[] = {
>> + { 0x404000, KEY_NUMERIC_0 },
>> + { 0x404001, KEY_NUMERIC_1 },
>> + { 0x404002, KEY_NUMERIC_2 },
>> + { 0x404003, KEY_NUMERIC_3 },
>> + { 0x404004, KEY_NUMERIC_4 },
>> + { 0x404005, KEY_NUMERIC_5 },
>> + { 0x404006, KEY_NUMERIC_6 },
>> + { 0x404007, KEY_NUMERIC_7 },
>> + { 0x404008, KEY_NUMERIC_8 },
>> + { 0x404009, KEY_NUMERIC_9 },
>> + { 0x40400a, KEY_MUTE },
>> + { 0x40400b, KEY_UP },
>> + { 0x40400c, KEY_BACKSPACE },
>> + { 0x40400d, KEY_OK },
>> + { 0x40400e, KEY_DOWN },
>> + { 0x404010, KEY_LEFT },
>> + { 0x404011, KEY_RIGHT },
>> + { 0x404017, KEY_VOLUMEDOWN },
>> + { 0x404018, KEY_VOLUMEUP },
>> + { 0x40401a, KEY_HOME },
>> + { 0x40401d, KEY_MENU },
>> + { 0x40401f, KEY_WWW },
>> + { 0x404045, KEY_BACK },
>> + { 0x404047, KEY_CONTEXT_MENU },
>> + { 0x40404d, KEY_POWER },
>> +};
>> +
>> +static struct rc_map_list pine64_map = {
>> + .map = {
>> + .scan = pine64,
>> + .size = ARRAY_SIZE(pine64),
>> + .rc_proto = RC_PROTO_NECX,
>> + .name = RC_MAP_PINE64,
>> + }
>> +};
>> +
>> +static int __init init_rc_map_pine64(void)
>> +{
>> + return rc_map_register(&pine64_map);
>> +}
>> +
>> +static void __exit exit_rc_map_pine64(void)
>> +{
>> + rc_map_unregister(&pine64_map);
>> +}
>> +
>> +module_init(init_rc_map_pine64)
>> +module_exit(exit_rc_map_pine64)
>> +
>> +MODULE_LICENSE("GPL");
>> +MODULE_AUTHOR("Jonas Karlman");
>> diff --git a/include/media/rc-map.h b/include/media/rc-map.h
>> index d621acadfbf3..52b554aa784d 100644
>> --- a/include/media/rc-map.h
>> +++ b/include/media/rc-map.h
>> @@ -236,6 +236,7 @@ struct rc_map *rc_map_get(const char *name);
>> #define RC_MAP_NORWOOD "rc-norwood"
>> #define RC_MAP_NPGTECH "rc-npgtech"
>> #define RC_MAP_PCTV_SEDNA "rc-pctv-sedna"
>> +#define RC_MAP_PINE64 "rc-pine64"
>> #define RC_MAP_PINNACLE_COLOR "rc-pinnacle-color"
>> #define RC_MAP_PINNACLE_GREY "rc-pinnacle-grey"
>> #define RC_MAP_PINNACLE_PCTV_HD "rc-pinnacle-pctv-hd"
>> --
>> 2.17.1