Commit 5b8c8d41 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] mceusb: select default keytable based on vendor

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: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 9683e01e
...@@ -241,7 +241,6 @@ static const struct mceusb_model mceusb_model[] = { ...@@ -241,7 +241,6 @@ static const struct mceusb_model mceusb_model[] = {
* remotes, but we should have something handy, * remotes, but we should have something handy,
* to allow testing it * to allow testing it
*/ */
.rc_map = RC_MAP_HAUPPAUGE,
.name = "Conexant Hybrid TV (cx231xx) MCE IR", .name = "Conexant Hybrid TV (cx231xx) MCE IR",
}, },
[CX_HYBRID_TV] = { [CX_HYBRID_TV] = {
...@@ -249,7 +248,6 @@ static const struct mceusb_model mceusb_model[] = { ...@@ -249,7 +248,6 @@ static const struct mceusb_model mceusb_model[] = {
.name = "Conexant Hybrid TV (cx231xx) MCE IR", .name = "Conexant Hybrid TV (cx231xx) MCE IR",
}, },
[HAUPPAUGE_CX_HYBRID_TV] = { [HAUPPAUGE_CX_HYBRID_TV] = {
.rc_map = RC_MAP_HAUPPAUGE,
.no_tx = 1, /* eeprom says it has no tx */ .no_tx = 1, /* eeprom says it has no tx */
.name = "Conexant Hybrid TV (cx231xx) MCE IR no TX", .name = "Conexant Hybrid TV (cx231xx) MCE IR no TX",
}, },
...@@ -1200,8 +1198,10 @@ static void mceusb_flash_led(struct mceusb_dev *ir) ...@@ -1200,8 +1198,10 @@ static void mceusb_flash_led(struct mceusb_dev *ir)
mce_async_out(ir, FLASH_LED, sizeof(FLASH_LED)); 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 device *dev = ir->dev;
struct rc_dev *rc; struct rc_dev *rc;
int ret; int ret;
...@@ -1235,8 +1235,19 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir) ...@@ -1235,8 +1235,19 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir)
rc->tx_ir = mceusb_tx_ir; rc->tx_ir = mceusb_tx_ir;
} }
rc->driver_name = DRIVER_NAME; 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); ret = rc_register_device(rc);
if (ret < 0) { if (ret < 0) {
...@@ -1351,7 +1362,7 @@ static int mceusb_dev_probe(struct usb_interface *intf, ...@@ -1351,7 +1362,7 @@ static int mceusb_dev_probe(struct usb_interface *intf,
snprintf(name + strlen(name), sizeof(name) - strlen(name), snprintf(name + strlen(name), sizeof(name) - strlen(name),
" %s", buf); " %s", buf);
ir->rc = mceusb_init_rc_dev(ir); ir->rc = mceusb_init_rc_dev(ir, intf);
if (!ir->rc) if (!ir->rc)
goto rc_dev_fail; goto rc_dev_fail;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment