V4L/DVB (8511): gspca: Get the card name of QUERYCAP from the usb product name.

Previous thread: V4L/DVB (8515): gspca: Webcam 0c45:6143 added in sonixj. by Linux Kernel Mailing List on Monday, July 28, 2008 - 10:04 am. (1 message)

Next thread: V4L/DVB (8513): gspca: Set the specific per webcam information in driver_info. by Linux Kernel Mailing List on Monday, July 28, 2008 - 10:04 am. (1 message)
From: Linux Kernel Mailing List
Date: Monday, July 28, 2008 - 10:04 am

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c6edaf...
Commit:     c6edaf1674d3c17770b1c9966306b802adb21a2b
Parent:     353facd4ab5acc6e9d83985eec9ca17e5d0cb470
Author:     Jean-Francois Moine <moinejf@free.fr>
AuthorDate: Wed Jul 23 03:24:06 2008 -0300
Committer:  Mauro Carvalho Chehab <mchehab@infradead.org>
CommitDate: Sun Jul 27 11:06:29 2008 -0300

    V4L/DVB (8511): gspca: Get the card name of QUERYCAP from the usb product name.
    
    This is a preliminary for using the driver_info of the struct
    usb_device_id to handle the specific per webcam information.
    
    Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
---
 drivers/media/video/gspca/gspca.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index 2a416cf..ab053a2 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -834,7 +834,16 @@ static int vidioc_querycap(struct file *file, void  *priv,
 
 	memset(cap, 0, sizeof *cap);
 	strncpy(cap->driver, gspca_dev->sd_desc->name, sizeof cap->driver);
-	strncpy(cap->card, gspca_dev->cam.dev_name, sizeof cap->card);
+/*	strncpy(cap->card, gspca_dev->cam.dev_name, sizeof cap->card); */
+	if (gspca_dev->dev->product != NULL) {
+		strncpy(cap->card, gspca_dev->dev->product,
+			sizeof cap->card);
+	} else {
+		snprintf(cap->card, sizeof cap->card,
+			"USB Camera (%04x:%04x)",
+			le16_to_cpu(gspca_dev->dev->descriptor.idVendor),
+			le16_to_cpu(gspca_dev->dev->descriptor.idProduct));
+	}
 	strncpy(cap->bus_info, gspca_dev->dev->bus->bus_name,
 		sizeof cap->bus_info);
 	cap->version = DRIVER_VERSION_NUMBER;
--

Previous thread: V4L/DVB (8515): gspca: Webcam 0c45:6143 added in sonixj. by Linux Kernel Mailing List on Monday, July 28, 2008 - 10:04 am. (1 message)

Next thread: V4L/DVB (8513): gspca: Set the specific per webcam information in driver_info. by Linux Kernel Mailing List on Monday, July 28, 2008 - 10:04 am. (1 message)