All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [media] mceusb: select default keytable based on vendor
@ 2014-07-27 20:47 Mauro Carvalho Chehab
  2014-07-29  5:45 ` Matthias Schwarzott
  0 siblings, 1 reply; 4+ messages in thread
From: Mauro Carvalho Chehab @ 2014-07-27 20:47 UTC (permalink / raw)
  Cc: Mauro Carvalho Chehab, Linux Media Mailing List, Mauro Carvalho Chehab

Some vendors have their on keymap table that are used on
all (or almost all) models for that vendor.

So, instead of specifying the keymap table per USB ID,
let's use the Vendor ID's table by default.

At the end, this will mean less code to be added when newer
devices for those vendors are added.

Of course, if rc_map is specified per board, it takes
precedence.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
---
 drivers/media/rc/mceusb.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index 48a6a0826a77..45b0894288e5 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -241,7 +241,6 @@ static const struct mceusb_model mceusb_model[] = {
 		 * remotes, but we should have something handy,
 		 * to allow testing it
 		 */
-		.rc_map = RC_MAP_HAUPPAUGE,
 		.name = "Conexant Hybrid TV (cx231xx) MCE IR",
 	},
 	[CX_HYBRID_TV] = {
@@ -249,7 +248,6 @@ static const struct mceusb_model mceusb_model[] = {
 		.name = "Conexant Hybrid TV (cx231xx) MCE IR",
 	},
 	[HAUPPAUGE_CX_HYBRID_TV] = {
-		.rc_map = RC_MAP_HAUPPAUGE,
 		.no_tx = 1, /* eeprom says it has no tx */
 		.name = "Conexant Hybrid TV (cx231xx) MCE IR no TX",
 	},
@@ -1200,8 +1198,10 @@ static void mceusb_flash_led(struct mceusb_dev *ir)
 	mce_async_out(ir, FLASH_LED, sizeof(FLASH_LED));
 }
 
-static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir)
+static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir,
+					 struct usb_interface *intf)
 {
+	struct usb_device *udev = usb_get_dev(interface_to_usbdev(intf));
 	struct device *dev = ir->dev;
 	struct rc_dev *rc;
 	int ret;
@@ -1235,8 +1235,19 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir)
 		rc->tx_ir = mceusb_tx_ir;
 	}
 	rc->driver_name = DRIVER_NAME;
-	rc->map_name = mceusb_model[ir->model].rc_map ?
-			mceusb_model[ir->model].rc_map : RC_MAP_RC6_MCE;
+
+	switch (le16_to_cpu(udev->descriptor.idVendor)) {
+	case VENDOR_HAUPPAUGE:
+		rc->map_name = RC_MAP_HAUPPAUGE;
+		break;
+	case VENDOR_PCTV:
+		rc->map_name = RC_MAP_PINNACLE_PCTV_HD;
+		break;
+	default:
+		rc->map_name = RC_MAP_RC6_MCE;
+	}
+	if (mceusb_model[ir->model].rc_map)
+		rc->map_name = mceusb_model[ir->model].rc_map;
 
 	ret = rc_register_device(rc);
 	if (ret < 0) {
@@ -1351,7 +1362,7 @@ static int mceusb_dev_probe(struct usb_interface *intf,
 		snprintf(name + strlen(name), sizeof(name) - strlen(name),
 			 " %s", buf);
 
-	ir->rc = mceusb_init_rc_dev(ir);
+	ir->rc = mceusb_init_rc_dev(ir, intf);
 	if (!ir->rc)
 		goto rc_dev_fail;
 
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] [media] mceusb: select default keytable based on vendor
  2014-07-27 20:47 [PATCH] [media] mceusb: select default keytable based on vendor Mauro Carvalho Chehab
@ 2014-07-29  5:45 ` Matthias Schwarzott
  2014-07-29 14:06   ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 4+ messages in thread
From: Matthias Schwarzott @ 2014-07-29  5:45 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: Linux Media Mailing List, Mauro Carvalho Chehab

On 27.07.2014 22:47, Mauro Carvalho Chehab wrote:
> Some vendors have their on keymap table that are used on
> all (or almost all) models for that vendor.
> 
> So, instead of specifying the keymap table per USB ID,
> let's use the Vendor ID's table by default.
> 
> At the end, this will mean less code to be added when newer
> devices for those vendors are added.
> 

I also did prepare something to add mceusb support, but with this only
vendor dependant rc_map selection, it definitly is less code.

Your mceusb patches work correctly for my 930C-HD (b130) and PCTV 522e
devices.

Regards
Matthias


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] [media] mceusb: select default keytable based on vendor
  2014-07-29  5:45 ` Matthias Schwarzott
@ 2014-07-29 14:06   ` Mauro Carvalho Chehab
  2014-07-29 18:29     ` Matthias Schwarzott
  0 siblings, 1 reply; 4+ messages in thread
From: Mauro Carvalho Chehab @ 2014-07-29 14:06 UTC (permalink / raw)
  To: Matthias Schwarzott; +Cc: Linux Media Mailing List, Mauro Carvalho Chehab

Em Tue, 29 Jul 2014 07:45:29 +0200
Matthias Schwarzott <zzam@gentoo.org> escreveu:

> On 27.07.2014 22:47, Mauro Carvalho Chehab wrote:
> > Some vendors have their on keymap table that are used on
> > all (or almost all) models for that vendor.
> > 
> > So, instead of specifying the keymap table per USB ID,
> > let's use the Vendor ID's table by default.
> > 
> > At the end, this will mean less code to be added when newer
> > devices for those vendors are added.
> > 
> 
> I also did prepare something to add mceusb support, but with this only
> vendor dependant rc_map selection, it definitly is less code.
> 
> Your mceusb patches work correctly for my 930C-HD (b130) and PCTV 522e
> devices.

Thanks for testing!

Btw, do you have plans to add DVB-C support to the frontend too?
I think that this is the only big feature missing.

Regards,
Mauro

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] [media] mceusb: select default keytable based on vendor
  2014-07-29 14:06   ` Mauro Carvalho Chehab
@ 2014-07-29 18:29     ` Matthias Schwarzott
  0 siblings, 0 replies; 4+ messages in thread
From: Matthias Schwarzott @ 2014-07-29 18:29 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: Linux Media Mailing List, Mauro Carvalho Chehab

On 29.07.2014 16:06, Mauro Carvalho Chehab wrote:
> Em Tue, 29 Jul 2014 07:45:29 +0200
> Matthias Schwarzott <zzam@gentoo.org> escreveu:
> 
>> On 27.07.2014 22:47, Mauro Carvalho Chehab wrote:
>>> Some vendors have their on keymap table that are used on
>>> all (or almost all) models for that vendor.
>>>
>>> So, instead of specifying the keymap table per USB ID,
>>> let's use the Vendor ID's table by default.
>>>
>>> At the end, this will mean less code to be added when newer
>>> devices for those vendors are added.
>>>
>>
>> I also did prepare something to add mceusb support, but with this only
>> vendor dependant rc_map selection, it definitly is less code.
>>
>> Your mceusb patches work correctly for my 930C-HD (b130) and PCTV 522e
>> devices.
> 
> Thanks for testing!
> 
Testing IR is fast to do :)

> Btw, do you have plans to add DVB-C support to the frontend too?
> I think that this is the only big feature missing.
> 
Yes, adding DVB-C Support is my next large goal.

Regards
Matthias


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-07-29 18:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-27 20:47 [PATCH] [media] mceusb: select default keytable based on vendor Mauro Carvalho Chehab
2014-07-29  5:45 ` Matthias Schwarzott
2014-07-29 14:06   ` Mauro Carvalho Chehab
2014-07-29 18:29     ` Matthias Schwarzott

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.