Hi,

On Saturday 29 October 2011 09:30:04 Alexey Fisher wrote:
> Am 28.10.2011 18:01, schrieb cheshirekow:
> > On Sun, 2011-10-23 at 13:50 -0400, cheshirekow wrote:
> >> On 10/22/2011 03:16 AM, Alexey Fisher wrote:
> >>> Can you please attach the output of this command:
> >>> lsusb -vd 10f1:1a26>  lsusb_dump
> >> 
> >> Sure. The dump file is attached.
> >> 
> >> Thanks!
> > 
> > Has anyone by chance managed to take a look at this lsusb dump?
> > 
> > To recap:
> > the HP Slate has two integrated we cams: One forward facing for video
> > calls, and one higher-resolution rear-facing for snapping photos. There
> > appears to be a single controller for both cameras. In linux, lsusb only
> > shows one webcam device. In windows, the device manager also shows only
> > one device for the webcam. However, in windows applications that use the
> > webcam (i.e. HP's webcam application, and in skype) I'm able to select
> > which one to use as an option. In linux, there is only one video
> > device, /dev/video0.
> > 
> > There does not appear to be any control available from uvcdynctrl or
> > within vlc to select which physical camera to use. I've tried setting
> > the resolution in vlc when I use the "open capture device" menu item. I
> > know that the forward facing camera is VGA so I tried specifying
> > 640x480, but the result is that it shows the rear-camera stream at a low
> > resolution, rather then showing the forward-camera stream.
> > 
> > I'd appreciate any suggestions on how to get the forward-facing camera
> > to work in linux (for skype/google video calls). Also, if it is clear
> > that this facility is not available in UVC and that there is no way this
> > is possilble, that would also be useful information.
> > 
> > Thanks again
> 
> Hi,
> 
> suddenly i do not see any control to switch the sensor. I assume there
> can be two variants how it may work:
> 1. vendor specific extension unit for uvc
> 2. or usb mode switcher
> 
> if both sensors have same capabilities, the 1. make sense. If not then
> second. Because this usb dump report settings only for one sensor.
> 
> For 1. it will be probably possible to control it with libwebcam. For 2.
> it should be possible to control it with some kind of usb_modeswitch
> (i'm not up to date).
> 
> To find what it is actually, there can be fallowing options:
> 1. sniff usb traffic
> 2. see if the windows driver has some advise for us
> 3. unscrew your laptop and find what control use your webcam.

My guess is that the camera uses either an extension unit (XU) control or a 
vendor-specific request to select between the two sensors (which is very 
unfortunate, given that the UVC specification has explicit support for dual-
sensor cameras, and I would have liked to test that code :-)).

Let's start with the XU control. I've attached a patch for the yavta test 
application (http://git.ideasonboard.org/?p=yavta.git;a=summary) to this e-
mail. Could you please apply it, compile the application with

make

run

yavta /dev/video0

and report the results ?

If your kernel headers are not recent enough (which I expect), compilation 
will fail. In that case you will need to download a recent kernel source tree, 
run

make headers_install

in the kernel tree (this will install the headers in the local directory, it 
won't mess up with your system) and then compile yavta with

make KDIR=/path/to/kernel/tree

-- 
Regards,

Laurent Pinchart
diff --git a/Makefile b/Makefile
index 4a9f055..9987d56 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,8 @@
 CROSS_COMPILE ?=
+KDIR ?=
 
 CC	:= $(CROSS_COMPILE)gcc
-CFLAGS	?= -O2 -W -Wall
+CFLAGS	?= -O2 -W -Wall -I$(KDIR)/usr/include
 LDFLAGS	?=
 LIBS	:= -lrt
 
diff --git a/yavta.c b/yavta.c
index be2f40c..7a3e35f 100644
--- a/yavta.c
+++ b/yavta.c
@@ -32,6 +32,8 @@
 #include <sys/select.h>
 #include <sys/time.h>
 
+#include <linux/usb/video.h>
+#include <linux/uvcvideo.h>
 #include <linux/videodev2.h>
 
 #ifndef V4L2_BUF_FLAG_ERROR
@@ -233,6 +235,75 @@ static void video_close(struct device *dev)
 	close(dev->fd);
 }
 
+/* -----------------------------------------------------------------------------
+ * UVC XU controls
+ */
+
+static void query_xu_controls(struct device *dev, unsigned int unit,
+			      unsigned int count)
+{
+	struct uvc_xu_control_query query;
+	unsigned int i;
+	uint8_t data[2];
+	uint16_t size;
+	uint8_t info;
+	int ret;
+
+	for (i = 0; i < count; ++i)
+	{
+		memset(&query, 0, sizeof query);
+		query.unit = unit;
+		query.selector = i + 1;
+		query.query = UVC_GET_INFO;
+		query.size = 1;
+		query.data = data;
+
+		ret = ioctl(dev->fd, UVCIOC_CTRL_QUERY, &query);
+		if (ret < 0)
+		{
+			printf("failed to query XU control %u info: %s (%d)\n", i,
+			       strerror(errno), errno);
+			continue;
+		}
+
+		info = data[0];
+
+		memset(&query, 0, sizeof query);
+		query.unit = unit;
+		query.selector = i + 1;
+		query.query = UVC_GET_LEN;
+		query.size = 2;
+		query.data = data;
+
+		ret = ioctl(dev->fd, UVCIOC_CTRL_QUERY, &query);
+		if (ret < 0)
+		{
+			printf("failed to query XU control %u size: %s (%d)\n", i,
+			       strerror(errno), errno);
+			continue;
+		}
+
+		size = (data[1] << 8) | data[0];
+
+		printf("XU control %u: info ", i);
+		if (info & UVC_CONTROL_CAP_GET)
+			printf("GET ");
+		if (info & UVC_CONTROL_CAP_SET)
+			printf("SET ");
+		if (info & UVC_CONTROL_CAP_DISABLED)
+			printf("DISABLED ");
+		if (info & UVC_CONTROL_CAP_AUTOUPDATE)
+			printf("AUTOUPDATE ");
+		if (info & UVC_CONTROL_CAP_ASYNCHRONOUS)
+			printf("ASYNCHRONOUS ");
+		printf("(0x%02x) %u bytes\n", info, size);
+	}
+}
+
+/* -----------------------------------------------------------------------------
+ * V4L2 controls
+ */
+
 static void uvc_get_control(struct device *dev, unsigned int id)
 {
 	struct v4l2_control ctrl;
@@ -1354,6 +1425,8 @@ int main(int argc, char *argv[])
 	if (ret < 0)
 		return 1;
 
+	query_xu_controls(&dev, 2, 8);
+
 	if (dev.type == (enum v4l2_buf_type)-1)
 		no_query = 1;
 
_______________________________________________
Linux-uvc-devel mailing list
Linux-uvc-devel@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/linux-uvc-devel

Reply via email to