[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20260112094820.24482-1-holden_hsu@163.com>
Date: Mon, 12 Jan 2026 01:48:20 -0800
From: Holden Hsu <holden_hsu@....com>
To: sean@...s.org
Cc: mchehab@...nel.org,
holden_hsu@....com,
linux-media@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] media: dib0700: split combined RC map into per-device maps
The TODO in the code mentioned that the unified table was a "real
mess" because it combined keymaps for multiple different devices.
This commit splits the RC_MAP_DIB0700_NEC_TABLE into three distinct
maps:
- rc-pixelview: for Prolink Pixelview SBTVD
- rc-evolutepc: for EvolutePC TVWay+
- rc-elgato: for Elgato EyeTV Diversity
The drivers/media/usb/dvb-usb/dib0700_devices.c is updated to use
these new specific map names for each hardware entry. This cleanup
allows for better maintenance and protocol handling in the future.
Also,
include/media/rc-map.h and
drivers/media/usb/dvb-usb/dib0700_devices.c
are modified to adapt to this TODO modification.
Signed-off-by: Holden Hsu <holden_hsu@....com>
---
drivers/media/rc/keymaps/rc-dib0700-nec.c | 63 +++++++++++++++++----
drivers/media/usb/dvb-usb/dib0700_devices.c | 4 +-
include/media/rc-map.h | 3 +
3 files changed, 58 insertions(+), 12 deletions(-)
diff --git a/drivers/media/rc/keymaps/rc-dib0700-nec.c b/drivers/media/rc/keymaps/rc-dib0700-nec.c
index 0323049fd..1475560a2 100644
--- a/drivers/media/rc/keymaps/rc-dib0700-nec.c
+++ b/drivers/media/rc/keymaps/rc-dib0700-nec.c
@@ -13,8 +13,8 @@
#include <media/rc-map.h>
#include <linux/module.h>
-static struct rc_map_table dib0700_nec_table[] = {
- /* Key codes for the Pixelview SBTVD remote */
+/* Key codes for the Pixelview SBTVD remote */
+static struct rc_map_table pixelview_table[] = {
{ 0x866b13, KEY_MUTE },
{ 0x866b12, KEY_POWER },
{ 0x866b01, KEY_NUMERIC_1 },
@@ -44,8 +44,10 @@ static struct rc_map_table dib0700_nec_table[] = {
{ 0x866b18, KEY_RECORD },
{ 0x866b1a, KEY_STOP },
+};
- /* Key codes for the EvolutePC TVWay+ remote */
+/* Key codes for the EvolutePC TVWay+ remote */
+static struct rc_map_table evolutepc_table[] = {
{ 0x7a00, KEY_MENU },
{ 0x7a01, KEY_RECORD },
{ 0x7a02, KEY_PLAY },
@@ -56,8 +58,10 @@ static struct rc_map_table dib0700_nec_table[] = {
{ 0x7a13, KEY_VOLUMEDOWN },
{ 0x7a40, KEY_POWER },
{ 0x7a41, KEY_MUTE },
+};
- /* Key codes for the Elgato EyeTV Diversity silver remote */
+/* Key codes for the Elgato EyeTV Diversity silver remote */
+static struct rc_map_table elgato_table[] = {
{ 0x4501, KEY_POWER },
{ 0x4502, KEY_MUTE },
{ 0x4503, KEY_NUMERIC_1 },
@@ -94,23 +98,62 @@ static struct rc_map_table dib0700_nec_table[] = {
{ 0x4542, KEY_SELECT }, /* Select video input, 'Select' for Teletext */
};
-static struct rc_map_list dib0700_nec_map = {
+static struct rc_map_list pixelview_map = {
+ .map = {
+ .scan = pixelview_table,
+ .size = ARRAY_SIZE(pixelview_table),
+ .rc_proto = RC_PROTO_NEC,
+ .name = "RC_MAP_PIXELVIEW",
+ }
+};
+static struct rc_map_list evolutepc_map = {
+ .map = {
+ .scan = evolutepc_table,
+ .size = ARRAY_SIZE(evolutepc_table),
+ .rc_proto = RC_PROTO_NEC,
+ .name = "RC_MAP_EVOLUTEPC",
+ }
+};
+static struct rc_map_list elgato_map = {
.map = {
- .scan = dib0700_nec_table,
- .size = ARRAY_SIZE(dib0700_nec_table),
+ .scan = elgato_table,
+ .size = ARRAY_SIZE(elgato_table),
.rc_proto = RC_PROTO_NEC,
- .name = RC_MAP_DIB0700_NEC_TABLE,
+ .name = "RC_MAP_ELGATO",
}
};
static int __init init_rc_map(void)
{
- return rc_map_register(&dib0700_nec_map);
+ int ret;
+
+ ret = rc_map_register(&pixelview_map);
+ if (ret)
+ return ret;
+
+ ret = rc_map_register(&evolutepc_map);
+ if (ret)
+ goto unregister_pixelview;
+
+ ret = rc_map_register(&elgato_map);
+ if (ret)
+ goto unregister_evolutepc;
+
+ return 0;
+
+unregister_evolutepc:
+ rc_map_unregister(&evolutepc_map);
+unregister_pixelview:
+ rc_map_unregister(&pixelview_map);
+
+ return ret;
}
static void __exit exit_rc_map(void)
{
- rc_map_unregister(&dib0700_nec_map);
+ rc_map_unregister(&elgato_map);
+ rc_map_unregister(&evolutepc_map);
+ rc_map_unregister(&pixelview_map);
}
module_init(init_rc_map)
diff --git a/drivers/media/usb/dvb-usb/dib0700_devices.c b/drivers/media/usb/dvb-usb/dib0700_devices.c
index 6ddc20513..75941844c 100644
--- a/drivers/media/usb/dvb-usb/dib0700_devices.c
+++ b/drivers/media/usb/dvb-usb/dib0700_devices.c
@@ -4537,7 +4537,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
.rc.core = {
.rc_interval = DEFAULT_RC_INTERVAL,
- .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
+ .rc_codes = RC_MAP_ELGATO,
.module_name = "dib0700",
.rc_query = dib0700_rc_query_old_firmware,
.allowed_protos = RC_PROTO_BIT_RC5 |
@@ -4766,7 +4766,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
.rc.core = {
.rc_interval = DEFAULT_RC_INTERVAL,
- .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
+ .rc_codes = RC_MAP_EVOLUTEPC,
.module_name = "dib0700",
.rc_query = dib0700_rc_query_old_firmware,
.allowed_protos = RC_PROTO_BIT_RC5 |
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index d90e4611b..9e7414049 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -236,6 +236,9 @@ struct rc_map *rc_map_get(const char *name);
#define RC_MAP_D680_DMB "rc-d680-dmb"
#define RC_MAP_DELOCK_61959 "rc-delock-61959"
#define RC_MAP_DIB0700_NEC_TABLE "rc-dib0700-nec"
+#define RC_MAP_PIXELVIEW "rc-pixelview"
+#define RC_MAP_EVOLUTEPC "rc-evolutepc"
+#define RC_MAP_ELGATO "rc-elgato"
#define RC_MAP_DIB0700_RC5_TABLE "rc-dib0700-rc5"
#define RC_MAP_DIGITALNOW_TINYTWIN "rc-digitalnow-tinytwin"
#define RC_MAP_DIGITTRADE "rc-digittrade"
--
2.43.0
Powered by blists - more mailing lists