summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/pvrusb2
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2007-11-26 01:58:20 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 19:03:02 -0200
commit78a47101ac0ac75019a740d62c70ccb16ff7c7c1 (patch)
treea329cea6e4ebb8145d29e076075bad9595af5318 /drivers/media/video/pvrusb2
parentf66fbd71f24f5f0264bb8526cfb91ea5c6219f50 (diff)
downloadop-kernel-dev-78a47101ac0ac75019a740d62c70ccb16ff7c7c1.zip
op-kernel-dev-78a47101ac0ac75019a740d62c70ccb16ff7c7c1.tar.gz
V4L/DVB (6695): pvrusb2: Implement functions to pass descriptive hardware info
Implement additional pvrusb2 device info table entries for a device identifier and a device description. Export this information via the driver's internal API. Make this information available via the sysfs driver interface. Also propagate this information into the v4l2 capability structure. An app can now retrieve and report a descriptive string about the particular type of hardware device it is operating. Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/pvrusb2')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c12
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.h6
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-sysfs.c60
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-v4l2.c1
4 files changed, 79 insertions, 0 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index c08162c..4ffaf3f 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -2474,6 +2474,18 @@ const char *pvr2_hdw_get_driver_name(struct pvr2_hdw *hdw)
}
+const char *pvr2_hdw_get_desc(struct pvr2_hdw *hdw)
+{
+ return hdw->hdw_desc->description;
+}
+
+
+const char *pvr2_hdw_get_type(struct pvr2_hdw *hdw)
+{
+ return hdw->hdw_desc->shortname;
+}
+
+
int pvr2_hdw_is_hsm(struct pvr2_hdw *hdw)
{
int result;
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.h b/drivers/media/video/pvrusb2/pvrusb2-hdw.h
index 205fa03..3ad7a13d6 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.h
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.h
@@ -158,6 +158,12 @@ int pvr2_hdw_get_tuner_status(struct pvr2_hdw *,struct v4l2_tuner *);
/* Query device and see if it thinks it is on a high-speed USB link */
int pvr2_hdw_is_hsm(struct pvr2_hdw *);
+/* Return a string token representative of the hardware type */
+const char *pvr2_hdw_get_type(struct pvr2_hdw *);
+
+/* Return a single line description of the hardware type */
+const char *pvr2_hdw_get_desc(struct pvr2_hdw *);
+
/* Turn streaming on/off */
int pvr2_hdw_set_streaming(struct pvr2_hdw *,int);
diff --git a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
index 3c57a7d..7a1cd87 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
@@ -43,10 +43,14 @@ struct pvr2_sysfs {
struct device_attribute attr_v4l_radio_minor_number;
struct device_attribute attr_unit_number;
struct device_attribute attr_bus_info;
+ struct device_attribute attr_hdw_name;
+ struct device_attribute attr_hdw_desc;
int v4l_minor_number_created_ok;
int v4l_radio_minor_number_created_ok;
int unit_number_created_ok;
int bus_info_created_ok;
+ int hdw_name_created_ok;
+ int hdw_desc_created_ok;
};
#ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC
@@ -712,6 +716,14 @@ static void class_dev_destroy(struct pvr2_sysfs *sfp)
pvr2_sysfs_tear_down_debugifc(sfp);
#endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */
pvr2_sysfs_tear_down_controls(sfp);
+ if (sfp->hdw_desc_created_ok) {
+ device_remove_file(sfp->class_dev,
+ &sfp->attr_hdw_desc);
+ }
+ if (sfp->hdw_name_created_ok) {
+ device_remove_file(sfp->class_dev,
+ &sfp->attr_hdw_name);
+ }
if (sfp->bus_info_created_ok) {
device_remove_file(sfp->class_dev,
&sfp->attr_bus_info);
@@ -758,6 +770,28 @@ static ssize_t bus_info_show(struct device *class_dev,
}
+static ssize_t hdw_name_show(struct device *class_dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct pvr2_sysfs *sfp;
+ sfp = (struct pvr2_sysfs *)class_dev->driver_data;
+ if (!sfp) return -EINVAL;
+ return scnprintf(buf,PAGE_SIZE,"%s\n",
+ pvr2_hdw_get_type(sfp->channel.hdw));
+}
+
+
+static ssize_t hdw_desc_show(struct device *class_dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct pvr2_sysfs *sfp;
+ sfp = (struct pvr2_sysfs *)class_dev->driver_data;
+ if (!sfp) return -EINVAL;
+ return scnprintf(buf,PAGE_SIZE,"%s\n",
+ pvr2_hdw_get_desc(sfp->channel.hdw));
+}
+
+
static ssize_t v4l_radio_minor_number_show(struct device *class_dev,
struct device_attribute *attr,
char *buf)
@@ -871,6 +905,32 @@ static void class_dev_create(struct pvr2_sysfs *sfp,
sfp->bus_info_created_ok = !0;
}
+ sfp->attr_hdw_name.attr.name = "device_hardware_type";
+ sfp->attr_hdw_name.attr.mode = S_IRUGO;
+ sfp->attr_hdw_name.show = hdw_name_show;
+ sfp->attr_hdw_name.store = NULL;
+ ret = device_create_file(sfp->class_dev,
+ &sfp->attr_hdw_name);
+ if (ret < 0) {
+ printk(KERN_WARNING "%s: device_create_file error: %d\n",
+ __FUNCTION__, ret);
+ } else {
+ sfp->hdw_name_created_ok = !0;
+ }
+
+ sfp->attr_hdw_desc.attr.name = "device_hardware_description";
+ sfp->attr_hdw_desc.attr.mode = S_IRUGO;
+ sfp->attr_hdw_desc.show = hdw_desc_show;
+ sfp->attr_hdw_desc.store = NULL;
+ ret = device_create_file(sfp->class_dev,
+ &sfp->attr_hdw_desc);
+ if (ret < 0) {
+ printk(KERN_WARNING "%s: device_create_file error: %d\n",
+ __FUNCTION__, ret);
+ } else {
+ sfp->hdw_desc_created_ok = !0;
+ }
+
pvr2_sysfs_add_controls(sfp);
#ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC
pvr2_sysfs_add_debugifc(sfp);
diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
index 6f06f595..8f0587e 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
@@ -205,6 +205,7 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
memcpy(cap, &pvr_capability, sizeof(struct v4l2_capability));
strlcpy(cap->bus_info,pvr2_hdw_get_bus_info(hdw),
sizeof(cap->bus_info));
+ strlcpy(cap->card,pvr2_hdw_get_desc(hdw),sizeof(cap->card));
ret = 0;
break;
OpenPOWER on IntegriCloud