diff mbox series

[v6,2/4] media: rc: add keymap for MagicBox M16S remote

Message ID tencent_7941C3ADC1F805DF58467BADCD88F4C0C406@qq.com (mailing list archive)
State New, archived
Headers show
Series [v6,1/4] dt-bindings: media: rc: add keymap bindings for MagicBox M16S remote | expand

Commit Message

Zhang Ning July 26, 2022, 1:15 p.m. UTC
MagicBox M16S Tv box shipped with a simple NEC remote.

Signed-off-by: Zhang Ning <zhangn1985@qq.com>
---
 drivers/media/rc/keymaps/Makefile      |  1 +
 drivers/media/rc/keymaps/rc-magicbox.c | 58 ++++++++++++++++++++++++++
 include/media/rc-map.h                 |  1 +
 3 files changed, 60 insertions(+)
 create mode 100644 drivers/media/rc/keymaps/rc-magicbox.c

Comments

Zhang Ning July 26, 2022, 1:39 p.m. UTC | #1
On Tue, Jul 26, 2022 at 09:15:21PM +0800, Zhang Ning wrote:
> MagicBox M16S Tv box shipped with a simple NEC remote.
> 
> Signed-off-by: Zhang Ning <zhangn1985@qq.com>
> ---
>  drivers/media/rc/keymaps/Makefile      |  1 +
>  drivers/media/rc/keymaps/rc-magicbox.c | 58 ++++++++++++++++++++++++++
>  include/media/rc-map.h                 |  1 +
>  3 files changed, 60 insertions(+)
>  create mode 100644 drivers/media/rc/keymaps/rc-magicbox.c
> 
> diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile
> index f513ff5caf4e..02c1c2150f03 100644
> --- a/drivers/media/rc/keymaps/Makefile
> +++ b/drivers/media/rc/keymaps/Makefile
> @@ -71,6 +71,7 @@ obj-$(CONFIG_RC_MAP) += \
>  			rc-kworld-plus-tv-analog.o \
>  			rc-leadtek-y04g0051.o \
>  			rc-lme2510.o \
> +			rc-magicbox.o \
>  			rc-manli.o \
>  			rc-mecool-kiii-pro.o \
>  			rc-mecool-kii-pro.o \
> diff --git a/drivers/media/rc/keymaps/rc-magicbox.c b/drivers/media/rc/keymaps/rc-magicbox.c
> new file mode 100644
> index 000000000000..015767429028
> --- /dev/null
> +++ b/drivers/media/rc/keymaps/rc-magicbox.c
> @@ -0,0 +1,58 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +//
> +// Copyright (C) 2022 Zhang Ning <zhangn1985@qq.com>
> +
> +/*
> + * Keytable for the MagicBox M16S remote control
> + */
> +
> +#include <media/rc-map.h>
> +#include <linux/module.h>
> +
> +static struct rc_map_table magicbox[] = {
> +	{ 0x9f57, KEY_POWER },
> +
> +	/*
> +	 * This key labeled "M" is used as magic key in vendor OS,
> +         * and mapped to KEY_MUTE.
oh no, mixed tab and space. I will fix it next version.

> +	 */
> +	{ 0x9f8a, KEY_MUTE },
> +
> +	{ 0x9f43, KEY_UP },
> +	{ 0x9f0a, KEY_DOWN },
> +	{ 0x9f06, KEY_LEFT },
> +	{ 0x9f0e, KEY_RIGHT },
> +	{ 0x9f02, KEY_OK },
> +
> +	{ 0x9f47, KEY_HOME },
> +	{ 0x9f4f, KEY_BACK },
> +	{ 0x9f16, KEY_MENU },
> +
> +	{ 0x9fff, KEY_VOLUMEUP },
> +	{ 0x9f5d, KEY_VOLUMEDOWN },
> +};
> +
> +static struct rc_map_list magicbox_map = {
> +	.map = {
> +		.scan     = magicbox,
> +		.size     = ARRAY_SIZE(magicbox),
> +		.rc_proto = RC_PROTO_NEC,
> +		.name     = RC_MAP_MAGICBOX,
> +	}
> +};
> +
> +static int __init init_rc_map_magicbox(void)
> +{
> +	return rc_map_register(&magicbox_map);
> +}
> +
> +static void __exit exit_rc_map_magicbox(void)
> +{
> +	rc_map_unregister(&magicbox_map);
> +}
> +
> +module_init(init_rc_map_magicbox)
> +module_exit(exit_rc_map_magicbox)
> +
> +MODULE_LICENSE("GPL");
> +MODULE_AUTHOR("Zhang Ning <zhangn1985@qq.com>");
> diff --git a/include/media/rc-map.h b/include/media/rc-map.h
> index 793b54342dff..656217b8e91b 100644
> --- a/include/media/rc-map.h
> +++ b/include/media/rc-map.h
> @@ -277,6 +277,7 @@ struct rc_map *rc_map_get(const char *name);
>  #define RC_MAP_KWORLD_PLUS_TV_ANALOG     "rc-kworld-plus-tv-analog"
>  #define RC_MAP_LEADTEK_Y04G0051          "rc-leadtek-y04g0051"
>  #define RC_MAP_LME2510                   "rc-lme2510"
> +#define RC_MAP_MAGICBOX                  "rc-magicbox"
>  #define RC_MAP_MANLI                     "rc-manli"
>  #define RC_MAP_MECOOL_KII_PRO            "rc-mecool-kii-pro"
>  #define RC_MAP_MECOOL_KIII_PRO           "rc-mecool-kiii-pro"
> -- 
> 2.35.1
>
Sean Young July 26, 2022, 1:59 p.m. UTC | #2
On Tue, Jul 26, 2022 at 09:39:46PM +0800, Zhang Ning wrote:
> On Tue, Jul 26, 2022 at 09:15:21PM +0800, Zhang Ning wrote:
> > MagicBox M16S Tv box shipped with a simple NEC remote.
> > 
> > Signed-off-by: Zhang Ning <zhangn1985@qq.com>
> > ---
> >  drivers/media/rc/keymaps/Makefile      |  1 +
> >  drivers/media/rc/keymaps/rc-magicbox.c | 58 ++++++++++++++++++++++++++
> >  include/media/rc-map.h                 |  1 +
> >  3 files changed, 60 insertions(+)
> >  create mode 100644 drivers/media/rc/keymaps/rc-magicbox.c
> > 
> > diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile
> > index f513ff5caf4e..02c1c2150f03 100644
> > --- a/drivers/media/rc/keymaps/Makefile
> > +++ b/drivers/media/rc/keymaps/Makefile
> > @@ -71,6 +71,7 @@ obj-$(CONFIG_RC_MAP) += \
> >  			rc-kworld-plus-tv-analog.o \
> >  			rc-leadtek-y04g0051.o \
> >  			rc-lme2510.o \
> > +			rc-magicbox.o \
> >  			rc-manli.o \
> >  			rc-mecool-kiii-pro.o \
> >  			rc-mecool-kii-pro.o \
> > diff --git a/drivers/media/rc/keymaps/rc-magicbox.c b/drivers/media/rc/keymaps/rc-magicbox.c
> > new file mode 100644
> > index 000000000000..015767429028
> > --- /dev/null
> > +++ b/drivers/media/rc/keymaps/rc-magicbox.c
> > @@ -0,0 +1,58 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +//
> > +// Copyright (C) 2022 Zhang Ning <zhangn1985@qq.com>
> > +
> > +/*
> > + * Keytable for the MagicBox M16S remote control
> > + */
> > +
> > +#include <media/rc-map.h>
> > +#include <linux/module.h>
> > +
> > +static struct rc_map_table magicbox[] = {
> > +	{ 0x9f57, KEY_POWER },
> > +
> > +	/*
> > +	 * This key labeled "M" is used as magic key in vendor OS,
> > +         * and mapped to KEY_MUTE.
> oh no, mixed tab and space. I will fix it next version.

That's something minor that can be fixed when merging.

Looks good to me, thank you for dealing with all the pedantic reviews.

Signed-off-by: Sean Young <sean@mess.org>

> 
> > +	 */
> > +	{ 0x9f8a, KEY_MUTE },
> > +
> > +	{ 0x9f43, KEY_UP },
> > +	{ 0x9f0a, KEY_DOWN },
> > +	{ 0x9f06, KEY_LEFT },
> > +	{ 0x9f0e, KEY_RIGHT },
> > +	{ 0x9f02, KEY_OK },
> > +
> > +	{ 0x9f47, KEY_HOME },
> > +	{ 0x9f4f, KEY_BACK },
> > +	{ 0x9f16, KEY_MENU },
> > +
> > +	{ 0x9fff, KEY_VOLUMEUP },
> > +	{ 0x9f5d, KEY_VOLUMEDOWN },
> > +};
> > +
> > +static struct rc_map_list magicbox_map = {
> > +	.map = {
> > +		.scan     = magicbox,
> > +		.size     = ARRAY_SIZE(magicbox),
> > +		.rc_proto = RC_PROTO_NEC,
> > +		.name     = RC_MAP_MAGICBOX,
> > +	}
> > +};
> > +
> > +static int __init init_rc_map_magicbox(void)
> > +{
> > +	return rc_map_register(&magicbox_map);
> > +}
> > +
> > +static void __exit exit_rc_map_magicbox(void)
> > +{
> > +	rc_map_unregister(&magicbox_map);
> > +}
> > +
> > +module_init(init_rc_map_magicbox)
> > +module_exit(exit_rc_map_magicbox)
> > +
> > +MODULE_LICENSE("GPL");
> > +MODULE_AUTHOR("Zhang Ning <zhangn1985@qq.com>");
> > diff --git a/include/media/rc-map.h b/include/media/rc-map.h
> > index 793b54342dff..656217b8e91b 100644
> > --- a/include/media/rc-map.h
> > +++ b/include/media/rc-map.h
> > @@ -277,6 +277,7 @@ struct rc_map *rc_map_get(const char *name);
> >  #define RC_MAP_KWORLD_PLUS_TV_ANALOG     "rc-kworld-plus-tv-analog"
> >  #define RC_MAP_LEADTEK_Y04G0051          "rc-leadtek-y04g0051"
> >  #define RC_MAP_LME2510                   "rc-lme2510"
> > +#define RC_MAP_MAGICBOX                  "rc-magicbox"
> >  #define RC_MAP_MANLI                     "rc-manli"
> >  #define RC_MAP_MECOOL_KII_PRO            "rc-mecool-kii-pro"
> >  #define RC_MAP_MECOOL_KIII_PRO           "rc-mecool-kiii-pro"
> > -- 
> > 2.35.1
> >
Zhang Ning July 26, 2022, 2:19 p.m. UTC | #3
On Tue, Jul 26, 2022 at 02:59:34PM +0100, Sean Young wrote:
> On Tue, Jul 26, 2022 at 09:39:46PM +0800, Zhang Ning wrote:
> > On Tue, Jul 26, 2022 at 09:15:21PM +0800, Zhang Ning wrote:
> > > MagicBox M16S Tv box shipped with a simple NEC remote.
> > > 
> > > Signed-off-by: Zhang Ning <zhangn1985@qq.com>
> > > ---
> > >  drivers/media/rc/keymaps/Makefile      |  1 +
> > >  drivers/media/rc/keymaps/rc-magicbox.c | 58 ++++++++++++++++++++++++++
> > >  include/media/rc-map.h                 |  1 +
> > >  3 files changed, 60 insertions(+)
> > >  create mode 100644 drivers/media/rc/keymaps/rc-magicbox.c
> > > 
> > > diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile
> > > index f513ff5caf4e..02c1c2150f03 100644
> > > --- a/drivers/media/rc/keymaps/Makefile
> > > +++ b/drivers/media/rc/keymaps/Makefile
> > > @@ -71,6 +71,7 @@ obj-$(CONFIG_RC_MAP) += \
> > >  			rc-kworld-plus-tv-analog.o \
> > >  			rc-leadtek-y04g0051.o \
> > >  			rc-lme2510.o \
> > > +			rc-magicbox.o \
> > >  			rc-manli.o \
> > >  			rc-mecool-kiii-pro.o \
> > >  			rc-mecool-kii-pro.o \
> > > diff --git a/drivers/media/rc/keymaps/rc-magicbox.c b/drivers/media/rc/keymaps/rc-magicbox.c
> > > new file mode 100644
> > > index 000000000000..015767429028
> > > --- /dev/null
> > > +++ b/drivers/media/rc/keymaps/rc-magicbox.c
> > > @@ -0,0 +1,58 @@
> > > +// SPDX-License-Identifier: GPL-2.0+
> > > +//
> > > +// Copyright (C) 2022 Zhang Ning <zhangn1985@qq.com>
> > > +
> > > +/*
> > > + * Keytable for the MagicBox M16S remote control
> > > + */
> > > +
> > > +#include <media/rc-map.h>
> > > +#include <linux/module.h>
> > > +
> > > +static struct rc_map_table magicbox[] = {
> > > +	{ 0x9f57, KEY_POWER },
> > > +
> > > +	/*
> > > +	 * This key labeled "M" is used as magic key in vendor OS,
> > > +         * and mapped to KEY_MUTE.
> > oh no, mixed tab and space. I will fix it next version.
> 
> That's something minor that can be fixed when merging.
> 
> Looks good to me, thank you for dealing with all the pedantic reviews.
> 
> Signed-off-by: Sean Young <sean@mess.org>

I want to send v7, due to checkpatch error.
I will add your Signed-off-by in next version.

thank you.

> 
> > 
> > > +	 */
> > > +	{ 0x9f8a, KEY_MUTE },
> > > +
> > > +	{ 0x9f43, KEY_UP },
> > > +	{ 0x9f0a, KEY_DOWN },
> > > +	{ 0x9f06, KEY_LEFT },
> > > +	{ 0x9f0e, KEY_RIGHT },
> > > +	{ 0x9f02, KEY_OK },
> > > +
> > > +	{ 0x9f47, KEY_HOME },
> > > +	{ 0x9f4f, KEY_BACK },
> > > +	{ 0x9f16, KEY_MENU },
> > > +
> > > +	{ 0x9fff, KEY_VOLUMEUP },
> > > +	{ 0x9f5d, KEY_VOLUMEDOWN },
> > > +};
> > > +
> > > +static struct rc_map_list magicbox_map = {
> > > +	.map = {
> > > +		.scan     = magicbox,
> > > +		.size     = ARRAY_SIZE(magicbox),
> > > +		.rc_proto = RC_PROTO_NEC,
> > > +		.name     = RC_MAP_MAGICBOX,
> > > +	}
> > > +};
> > > +
> > > +static int __init init_rc_map_magicbox(void)
> > > +{
> > > +	return rc_map_register(&magicbox_map);
> > > +}
> > > +
> > > +static void __exit exit_rc_map_magicbox(void)
> > > +{
> > > +	rc_map_unregister(&magicbox_map);
> > > +}
> > > +
> > > +module_init(init_rc_map_magicbox)
> > > +module_exit(exit_rc_map_magicbox)
> > > +
> > > +MODULE_LICENSE("GPL");
> > > +MODULE_AUTHOR("Zhang Ning <zhangn1985@qq.com>");
> > > diff --git a/include/media/rc-map.h b/include/media/rc-map.h
> > > index 793b54342dff..656217b8e91b 100644
> > > --- a/include/media/rc-map.h
> > > +++ b/include/media/rc-map.h
> > > @@ -277,6 +277,7 @@ struct rc_map *rc_map_get(const char *name);
> > >  #define RC_MAP_KWORLD_PLUS_TV_ANALOG     "rc-kworld-plus-tv-analog"
> > >  #define RC_MAP_LEADTEK_Y04G0051          "rc-leadtek-y04g0051"
> > >  #define RC_MAP_LME2510                   "rc-lme2510"
> > > +#define RC_MAP_MAGICBOX                  "rc-magicbox"
> > >  #define RC_MAP_MANLI                     "rc-manli"
> > >  #define RC_MAP_MECOOL_KII_PRO            "rc-mecool-kii-pro"
> > >  #define RC_MAP_MECOOL_KIII_PRO           "rc-mecool-kiii-pro"
> > > -- 
> > > 2.35.1
> > >
diff mbox series

Patch

diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile
index f513ff5caf4e..02c1c2150f03 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -71,6 +71,7 @@  obj-$(CONFIG_RC_MAP) += \
 			rc-kworld-plus-tv-analog.o \
 			rc-leadtek-y04g0051.o \
 			rc-lme2510.o \
+			rc-magicbox.o \
 			rc-manli.o \
 			rc-mecool-kiii-pro.o \
 			rc-mecool-kii-pro.o \
diff --git a/drivers/media/rc/keymaps/rc-magicbox.c b/drivers/media/rc/keymaps/rc-magicbox.c
new file mode 100644
index 000000000000..015767429028
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-magicbox.c
@@ -0,0 +1,58 @@ 
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright (C) 2022 Zhang Ning <zhangn1985@qq.com>
+
+/*
+ * Keytable for the MagicBox M16S remote control
+ */
+
+#include <media/rc-map.h>
+#include <linux/module.h>
+
+static struct rc_map_table magicbox[] = {
+	{ 0x9f57, KEY_POWER },
+
+	/*
+	 * This key labeled "M" is used as magic key in vendor OS,
+         * and mapped to KEY_MUTE.
+	 */
+	{ 0x9f8a, KEY_MUTE },
+
+	{ 0x9f43, KEY_UP },
+	{ 0x9f0a, KEY_DOWN },
+	{ 0x9f06, KEY_LEFT },
+	{ 0x9f0e, KEY_RIGHT },
+	{ 0x9f02, KEY_OK },
+
+	{ 0x9f47, KEY_HOME },
+	{ 0x9f4f, KEY_BACK },
+	{ 0x9f16, KEY_MENU },
+
+	{ 0x9fff, KEY_VOLUMEUP },
+	{ 0x9f5d, KEY_VOLUMEDOWN },
+};
+
+static struct rc_map_list magicbox_map = {
+	.map = {
+		.scan     = magicbox,
+		.size     = ARRAY_SIZE(magicbox),
+		.rc_proto = RC_PROTO_NEC,
+		.name     = RC_MAP_MAGICBOX,
+	}
+};
+
+static int __init init_rc_map_magicbox(void)
+{
+	return rc_map_register(&magicbox_map);
+}
+
+static void __exit exit_rc_map_magicbox(void)
+{
+	rc_map_unregister(&magicbox_map);
+}
+
+module_init(init_rc_map_magicbox)
+module_exit(exit_rc_map_magicbox)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Zhang Ning <zhangn1985@qq.com>");
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index 793b54342dff..656217b8e91b 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -277,6 +277,7 @@  struct rc_map *rc_map_get(const char *name);
 #define RC_MAP_KWORLD_PLUS_TV_ANALOG     "rc-kworld-plus-tv-analog"
 #define RC_MAP_LEADTEK_Y04G0051          "rc-leadtek-y04g0051"
 #define RC_MAP_LME2510                   "rc-lme2510"
+#define RC_MAP_MAGICBOX                  "rc-magicbox"
 #define RC_MAP_MANLI                     "rc-manli"
 #define RC_MAP_MECOOL_KII_PRO            "rc-mecool-kii-pro"
 #define RC_MAP_MECOOL_KIII_PRO           "rc-mecool-kiii-pro"