Commit 4f7b7c01 authored by Devin Heitmueller's avatar Devin Heitmueller Committed by Mauro Carvalho Chehab

[media] staging: as102: Properly handle multiple product names

Properly handle the case where the driver can be associated with
multiple different products (as opposed to always saying the device
is named after the value in a #define).
Signed-off-by: default avatarDevin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: default avatarPiotr Chmura <chmooreck@poczta.onet.pl>
Signed-off-by: default avatarSylwester Nawrocki <snjw23@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 5f9745b2
...@@ -209,7 +209,7 @@ int as102_dvb_register(struct as102_dev_t *as102_dev) ...@@ -209,7 +209,7 @@ int as102_dvb_register(struct as102_dev_t *as102_dev)
#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) #if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE)
ret = dvb_register_adapter(&as102_dev->dvb_adap, ret = dvb_register_adapter(&as102_dev->dvb_adap,
DEVICE_FULL_NAME, as102_dev->name,
THIS_MODULE, THIS_MODULE,
#if defined(CONFIG_AS102_USB) #if defined(CONFIG_AS102_USB)
&as102_dev->bus_adap.usb_dev->dev &as102_dev->bus_adap.usb_dev->dev
......
...@@ -106,6 +106,7 @@ struct as102_bus_adapter_t { ...@@ -106,6 +106,7 @@ struct as102_bus_adapter_t {
}; };
struct as102_dev_t { struct as102_dev_t {
const char *name;
struct as102_bus_adapter_t bus_adap; struct as102_bus_adapter_t bus_adap;
struct list_head device_entry; struct list_head device_entry;
struct kref kref; struct kref kref;
......
...@@ -346,7 +346,7 @@ static int as102_fe_ts_bus_ctrl(struct dvb_frontend *fe, int acquire) ...@@ -346,7 +346,7 @@ static int as102_fe_ts_bus_ctrl(struct dvb_frontend *fe, int acquire)
static struct dvb_frontend_ops as102_fe_ops = { static struct dvb_frontend_ops as102_fe_ops = {
.info = { .info = {
.name = DEVICE_FULL_NAME, .name = "Unknown AS102 device",
.type = FE_OFDM, .type = FE_OFDM,
.frequency_min = 174000000, .frequency_min = 174000000,
.frequency_max = 862000000, .frequency_max = 862000000,
...@@ -408,6 +408,8 @@ int as102_dvb_register_fe(struct as102_dev_t *as102_dev, ...@@ -408,6 +408,8 @@ int as102_dvb_register_fe(struct as102_dev_t *as102_dev,
/* init frontend callback ops */ /* init frontend callback ops */
memcpy(&dvb_fe->ops, &as102_fe_ops, sizeof(struct dvb_frontend_ops)); memcpy(&dvb_fe->ops, &as102_fe_ops, sizeof(struct dvb_frontend_ops));
strncpy(dvb_fe->ops.info.name, as102_dev->name,
sizeof(dvb_fe->ops.info.name));
/* register dbvb frontend */ /* register dbvb frontend */
errno = dvb_register_frontend(dvb_adap, dvb_fe); errno = dvb_register_frontend(dvb_adap, dvb_fe);
......
...@@ -44,6 +44,15 @@ static struct usb_device_id as102_usb_id_table[] = { ...@@ -44,6 +44,15 @@ static struct usb_device_id as102_usb_id_table[] = {
{ } /* Terminating entry */ { } /* Terminating entry */
}; };
/* Note that this table must always have the same number of entries as the
as102_usb_id_table struct */
static const char *as102_device_names[] = {
AS102_REFERENCE_DESIGN,
AS102_PCTV_74E,
AS102_ELGATO_EYETV_DTT_NAME,
NULL /* Terminating entry */
};
struct usb_driver as102_usb_driver = { struct usb_driver as102_usb_driver = {
.name = DRIVER_FULL_NAME, .name = DRIVER_FULL_NAME,
.probe = as102_usb_probe, .probe = as102_usb_probe,
...@@ -344,6 +353,7 @@ static int as102_usb_probe(struct usb_interface *intf, ...@@ -344,6 +353,7 @@ static int as102_usb_probe(struct usb_interface *intf,
{ {
int ret; int ret;
struct as102_dev_t *as102_dev; struct as102_dev_t *as102_dev;
int i;
ENTER(); ENTER();
...@@ -353,6 +363,23 @@ static int as102_usb_probe(struct usb_interface *intf, ...@@ -353,6 +363,23 @@ static int as102_usb_probe(struct usb_interface *intf,
return -ENOMEM; return -ENOMEM;
} }
/* This should never actually happen */
if ((sizeof(as102_usb_id_table) / sizeof(struct usb_device_id)) !=
(sizeof(as102_device_names) / sizeof(const char *))) {
printk(KERN_ERR "Device names table invalid size");
return -EINVAL;
}
/* Assign the user-friendly device name */
for (i = 0; i < (sizeof(as102_usb_id_table) /
sizeof(struct usb_device_id)); i++) {
if (id == &as102_usb_id_table[i])
as102_dev->name = as102_device_names[i];
}
if (as102_dev->name == NULL)
as102_dev->name = "Unknown AS102 device";
/* set private callback functions */ /* set private callback functions */
as102_dev->bus_adap.ops = &as102_priv_ops; as102_dev->bus_adap.ops = &as102_priv_ops;
......
...@@ -28,16 +28,17 @@ ...@@ -28,16 +28,17 @@
/* define these values to match the supported devices */ /* define these values to match the supported devices */
/* Abilis system: "TITAN" */ /* Abilis system: "TITAN" */
#define AS102_REFERENCE_DESIGN "Abilis Systems DVB-Titan"
#define AS102_USB_DEVICE_VENDOR_ID 0x1BA6 #define AS102_USB_DEVICE_VENDOR_ID 0x1BA6
#define AS102_USB_DEVICE_PID_0001 0x0001 #define AS102_USB_DEVICE_PID_0001 0x0001
/* PCTV Systems: PCTV picoStick (74e) */ /* PCTV Systems: PCTV picoStick (74e) */
#define DEVICE_FULL_NAME "PCTV Systems : PCTV picoStick (74e)" #define AS102_PCTV_74E "PCTV Systems picoStick (74e)"
#define PCTV_74E_USB_VID 0x2013 #define PCTV_74E_USB_VID 0x2013
#define PCTV_74E_USB_PID 0x0246 #define PCTV_74E_USB_PID 0x0246
/* Elgato: EyeTV DTT Deluxe */ /* Elgato: EyeTV DTT Deluxe */
#define ELGATO_EYETV_DTT_NAME "Elgato EyeTV DTT Deluxe" #define AS102_ELGATO_EYETV_DTT_NAME "Elgato EyeTV DTT Deluxe"
#define ELGATO_EYETV_DTT_USB_VID 0x0fd9 #define ELGATO_EYETV_DTT_USB_VID 0x0fd9
#define ELGATO_EYETV_DTT_USB_PID 0x002c #define ELGATO_EYETV_DTT_USB_PID 0x002c
......
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