Commit 943a9034 authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

[media] rtl28xxu: dynamic USB ID support

DVB USB core refuses to	load driver when current USB ID
does not match IDs on driver table. Due to that dynamic
IDs does not work. Replace reference design ID by dynamic
ID in .probe() in order to get it working.
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 662f9602
...@@ -909,6 +909,8 @@ static int rtl28xxu_probe(struct usb_interface *intf, ...@@ -909,6 +909,8 @@ static int rtl28xxu_probe(struct usb_interface *intf,
int ret, i; int ret, i;
int properties_count = ARRAY_SIZE(rtl28xxu_properties); int properties_count = ARRAY_SIZE(rtl28xxu_properties);
struct dvb_usb_device *d; struct dvb_usb_device *d;
struct usb_device *udev;
bool found;
deb_info("%s: interface=%d\n", __func__, deb_info("%s: interface=%d\n", __func__,
intf->cur_altsetting->desc.bInterfaceNumber); intf->cur_altsetting->desc.bInterfaceNumber);
...@@ -916,6 +918,29 @@ static int rtl28xxu_probe(struct usb_interface *intf, ...@@ -916,6 +918,29 @@ static int rtl28xxu_probe(struct usb_interface *intf,
if (intf->cur_altsetting->desc.bInterfaceNumber != 0) if (intf->cur_altsetting->desc.bInterfaceNumber != 0)
return 0; return 0;
/* Dynamic USB ID support. Replaces first device ID with current one .*/
udev = interface_to_usbdev(intf);
for (i = 0, found = false; i < ARRAY_SIZE(rtl28xxu_table) - 1; i++) {
if (rtl28xxu_table[i].idVendor ==
le16_to_cpu(udev->descriptor.idVendor) &&
rtl28xxu_table[i].idProduct ==
le16_to_cpu(udev->descriptor.idProduct)) {
found = true;
break;
}
}
if (!found) {
deb_info("%s: using dynamic ID %04x:%04x\n", __func__,
le16_to_cpu(udev->descriptor.idVendor),
le16_to_cpu(udev->descriptor.idProduct));
rtl28xxu_properties[0].devices[0].warm_ids[0]->idVendor =
le16_to_cpu(udev->descriptor.idVendor);
rtl28xxu_properties[0].devices[0].warm_ids[0]->idProduct =
le16_to_cpu(udev->descriptor.idProduct);
}
for (i = 0; i < properties_count; i++) { for (i = 0; i < properties_count; i++) {
ret = dvb_usb_device_init(intf, &rtl28xxu_properties[i], ret = dvb_usb_device_init(intf, &rtl28xxu_properties[i],
THIS_MODULE, &d, adapter_nr); THIS_MODULE, &d, adapter_nr);
......
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