#define warn(format, arg...) \
printk(KERN_WARNING DVB_USB_LOG_PREFIX ": " format "\n" , ## arg)
-/**
- * struct dvb_usb_device_description - name and its according USB IDs
- * @name: real name of the box, regardless which DVB USB device class is in use
- * @cold_ids: array of struct usb_device_id which describe the device in
- * pre-firmware state
- * @warm_ids: array of struct usb_device_id which describe the device in
- * post-firmware state
- *
- * Each DVB USB device class can have one or more actual devices, this struct
- * assigns a name to it.
- */
-struct dvb_usb_device_description {
+struct dvb_usb_driver_info {
const char *name;
-
-#define DVB_USB_ID_MAX_NUM 15
- struct usb_device_id *cold_ids[DVB_USB_ID_MAX_NUM];
- struct usb_device_id *warm_ids[DVB_USB_ID_MAX_NUM];
+ const struct dvb_usb_device_properties *props;
};
static inline u8 rc5_custom(struct rc_map_table *key)
* the generic_bulk_ctrl_endpoint. When this is non-zero, this will be used
* instead of the generic_bulk_ctrl_endpoint when reading usb responses in
* the dvb_usb_generic_rw helper function.
- *
- * @num_device_descs: number of struct dvb_usb_device_description in @devices
- * @devices: array of struct dvb_usb_device_description compatibles with these
- * properties.
*/
#define MAX_NO_OF_ADAPTER_PER_DEVICE 2
struct dvb_usb_device_properties {
int generic_bulk_ctrl_endpoint;
int generic_bulk_ctrl_endpoint_response;
-
- int num_device_descs;
- struct dvb_usb_device_description devices[12];
};
/**
*/
struct dvb_usb_device {
struct dvb_usb_device_properties props;
- struct dvb_usb_device_description *desc;
+ const char *name;
struct usb_device *udev;
int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap)
{
int i;
- int ret = dvb_register_adapter(&adap->dvb_adap, adap->dev->desc->name,
+ int ret = dvb_register_adapter(&adap->dvb_adap, adap->dev->name,
adap->dev->props.owner,
&adap->dev->udev->dev,
adap->dev->props.adapter_nr);
if (adap->props.fe[i].frontend_attach == NULL) {
err("strange: '%s' #%d,%d " \
"doesn't want to attach a frontend.",
- adap->dev->desc->name, adap->id, i);
+ adap->dev->name, adap->id, i);
return 0;
}
/* only print error when there is no FE at all */
if (i == 0)
err("no frontend was attached by '%s'",
- adap->dev->desc->name);
+ adap->dev->name);
return 0;
}
return 0;
}
-/* determine the name and the state of the just found USB device */
-static struct dvb_usb_device_description *dvb_usb_find_device(
- struct usb_device *udev,
- struct dvb_usb_device_properties *props, bool *cold)
-{
- int i, j;
- struct dvb_usb_device_description *desc = NULL;
-
- *cold = true;
-
- for (i = 0; i < props->num_device_descs; i++) {
- for (j = 0; j < DVB_USB_ID_MAX_NUM && props->devices[i].cold_ids[j] != NULL; j++) {
- deb_info("check for cold %x %x\n",
- props->devices[i].cold_ids[j]->idVendor,
- props->devices[i].cold_ids[j]->idProduct);
- if (props->devices[i].cold_ids[j]->idVendor == le16_to_cpu(udev->descriptor.idVendor) &&
- props->devices[i].cold_ids[j]->idProduct == le16_to_cpu(udev->descriptor.idProduct)) {
- *cold = true;
- desc = &props->devices[i];
- break;
- }
- }
-
- if (desc != NULL)
- break;
-
- for (j = 0; j < DVB_USB_ID_MAX_NUM && props->devices[i].warm_ids[j] != NULL; j++) {
- deb_info("check for warm %x %x\n",
- props->devices[i].warm_ids[j]->idVendor,
- props->devices[i].warm_ids[j]->idProduct);
-
- if (props->devices[i].warm_ids[j]->idVendor == le16_to_cpu(udev->descriptor.idVendor) &&
- props->devices[i].warm_ids[j]->idProduct == le16_to_cpu(udev->descriptor.idProduct)) {
- *cold = false;
- desc = &props->devices[i];
- break;
- }
- }
- }
-
- return desc;
-}
-
int dvb_usb_device_power_ctrl(struct dvb_usb_device *d, int onoff)
{
if (onoff)
{
struct usb_device *udev = interface_to_usbdev(intf);
struct dvb_usb_device *d = NULL;
- struct dvb_usb_device_description *desc = NULL;
- struct dvb_usb_device_properties *props =
- (struct dvb_usb_device_properties *) id->driver_info;
+ struct dvb_usb_driver_info *driver_info =
+ (struct dvb_usb_driver_info *) id->driver_info;
+ const struct dvb_usb_device_properties *props = driver_info->props;
int ret = -ENOMEM;
- bool cold;
+ bool cold = false;
d = kzalloc(sizeof(struct dvb_usb_device), GFP_KERNEL);
if (d == NULL) {
}
d->udev = udev;
+ d->name = driver_info->name;
memcpy(&d->props, props, sizeof(struct dvb_usb_device_properties));
if (d->props.size_of_priv > 0) {
}
}
- desc = dvb_usb_find_device(udev, props, &cold);
-
- if (desc == NULL) {
- deb_err("something went very wrong, device was not found in" \
- " current device list - let's see what" \
- " comes next.\n");
- ret = -ENODEV;
- goto err_kfree;
- }
-
- d->desc = desc;
-
if (d->props.identify_state) {
ret = d->props.identify_state(d);
if (ret == 0) {
if (cold) {
info("found a '%s' in cold state, will try to load a firmware",
- desc->name);
+ d->name);
ret = dvb_usb_download_firmware(d);
if (ret == 0) {
;
}
}
- info("found a '%s' in warm state.", desc->name);
+ info("found a '%s' in warm state.", d->name);
usb_set_intfdata(intf, d);
ret = dvb_usb_init(d);
if (ret == 0)
- info("%s successfully initialized and connected.", desc->name);
+ info("%s successfully initialized and connected.", d->name);
else
- info("%s error while loading driver (%d)", desc->name, ret);
+ info("%s error while loading driver (%d)", d->name, ret);
return 0;
void dvb_usbv2_device_exit(struct usb_interface *intf)
{
struct dvb_usb_device *d = usb_get_intfdata(intf);
- const char *name = "generic DVB-USB module";
+ const char *name;
usb_set_intfdata(intf, NULL);
- if (d != NULL && d->desc != NULL) {
- name = d->desc->name;
+ if (d) {
+ name = d->name;
dvb_usb_exit(d);
}
info("%s successfully deinitialized and disconnected.", name);
-
}
EXPORT_SYMBOL(dvb_usbv2_device_exit);