Date: Thu, 8 Sep 2011 09:43:51 +0200 From: Hans Petter Selasky <hselasky@c2i.net> To: freebsd-multimedia@freebsd.org Cc: Hans de Goede <hdegoede@redhat.com> Subject: Re: Web camera stream is flipped upsidedown Message-ID: <201109080943.51981.hselasky@c2i.net>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On Wednesday 07 September 2011 23:08:14 Eugene Dzhurinsky wrote:
> Hello!
>
> I have some problem with my web camera on Asus K40IN laptop.
>
> FreeBSD localhost 8.2-STABLE FreeBSD 8.2-STABLE
>
Hi Eugene,
LibV4L is responsible for the flipping.
Try to patch LibV4L using the attached patch after "make extract patch", and
also the installed videodev2.h.
--HPS
> usbconfig -u 1 -a 2 dump_device_desc
> ugen1.2: <CNF7129 Chicony Electronics Co., Ltd.> at usbus1, cfg=0 md=HOST
> spd=HIGH (480Mbps) pwr=ON
>
> bLength = 0x0012
> bDescriptorType = 0x0001
> bcdUSB = 0x0200
> bDeviceClass = 0x00ef
> bDeviceSubClass = 0x0002
> bDeviceProtocol = 0x0001
> bMaxPacketSize0 = 0x0040
> idVendor = 0x04f2
> idProduct = 0xb071
> bcdDevice = 0x1515
> iManufacturer = 0x0002 <Chicony Electronics Co., Ltd.>
> iProduct = 0x0001 <CNF7129>
> iSerialNumber = 0x0003 <SN0001>
> bNumConfigurations = 0x0001
>
> I installed and started webcamd, and now I have the problem - pwcview shows
> video flipped upsidedown, same happens in Skype.
>
> Is it possible to fix this with some settings for webcamd?
>
> Thanks in advance!
[-- Attachment #2 --]
commit 593e3a9167b4a194f2483cdf7fec4fe25606e8b8
Author: Hans Petter Selasky <hselasky@c2i.net>
Date: Wed Jul 20 14:14:51 2011 +0200
Provide direct way of getting USB device information.
Signed-off-by: Hans Petter Selasky <hselasky@c2i.net>
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 8b1224c..1ce7b78 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1916,6 +1916,25 @@ struct v4l2_dbg_chip_ident {
__u32 revision; /* chip revision, chip specific */
} __attribute__ ((packed));
+/**
+ * struct v4l2_usb_info - retrieve USB specific information
+ * @vid: device vendor ID
+ * @pid: device product ID
+ * @bcd: device revision
+ * @bus: device bus number
+ * @addr: device address number
+ * @speed: link speed in kilo bits per second
+ */
+/* VIDIOC_QUERYUSBINFO */
+struct v4l2_usb_info {
+ __u32 speed; /* USB link speed in kbit/s */
+ __u16 vid; /* USB vendor information */
+ __u16 pid; /* USB product information */
+ __u16 bcd; /* USB device revision */
+ __u8 bus; /* USB number */
+ __u8 addr; /* USB address */
+} __attribute__((packed,aligned(64)));
+
/*
* I O C T L C O D E S F O R V I D E O D E V I C E S
*
@@ -2005,6 +2024,7 @@ struct v4l2_dbg_chip_ident {
#define VIDIOC_DQEVENT _IOR('V', 89, struct v4l2_event)
#define VIDIOC_SUBSCRIBE_EVENT _IOW('V', 90, struct v4l2_event_subscription)
#define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription)
+#define VIDIOC_QUERYUSBINFO _IOR('V', 92, struct v4l2_usb_info)
/* Reminder: when adding new ioctls please add support for them to
drivers/media/video/v4l2-compat-ioctl32.c as well! */
diff --git a/lib/libv4lconvert/control/libv4lcontrol.c b/lib/libv4lconvert/control/libv4lcontrol.c
index b11d96c..098c7bd 100644
--- a/lib/libv4lconvert/control/libv4lcontrol.c
+++ b/lib/libv4lconvert/control/libv4lcontrol.c
@@ -637,6 +637,13 @@ static const struct v4lcontrol_flags_info v4lcontrol_flags[] = {
static const struct v4l2_queryctrl fake_controls[];
+#ifdef __FreeBSD__
+static void v4lcontrol_get_dmi_string(const char *string, char *buf, int size)
+{
+ /* TODO */
+ memset(buf, 0, size);
+}
+#else
static void v4lcontrol_get_dmi_string(const char *string, char *buf, int size)
{
FILE *f;
@@ -663,7 +670,24 @@ static void v4lcontrol_get_dmi_string(const char *string, char *buf, int size)
s[strlen(s) - 1] = 0;
fclose(f);
}
+#endif
+#ifdef __FreeBSD__
+static int
+v4lcontrol_get_usb_info(struct v4lcontrol_data *data, unsigned short *vendor_id,
+ unsigned short *product_id, int *speed)
+{
+ struct v4l2_usb_info usb_info;
+
+ if (SYS_IOCTL(data->fd, VIDIOC_QUERYUSBINFO, &usb_info) == 0) {
+ *vendor_id = usb_info.vid;
+ *product_id = usb_info.pid;
+ *speed = usb_info.speed;
+ return (1);
+ }
+ return (0);
+}
+#else
static int v4lcontrol_get_usb_info(struct v4lcontrol_data *data,
unsigned short *vendor_id, unsigned short *product_id,
int *speed)
@@ -758,6 +782,7 @@ static int v4lcontrol_get_usb_info(struct v4lcontrol_data *data,
return 1;
}
+#endif
static void v4lcontrol_get_flags_from_db(struct v4lcontrol_data *data,
unsigned short vendor_id, unsigned short product_id)
[-- Attachment #3 --]
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 8b1224c..1ce7b78 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1916,6 +1916,25 @@ struct v4l2_dbg_chip_ident {
__u32 revision; /* chip revision, chip specific */
} __attribute__ ((packed));
+/**
+ * struct v4l2_usb_info - retrieve USB specific information
+ * @vid: device vendor ID
+ * @pid: device product ID
+ * @bcd: device revision
+ * @bus: device bus number
+ * @addr: device address number
+ * @speed: link speed in kilo bits per second
+ */
+/* VIDIOC_QUERYUSBINFO */
+struct v4l2_usb_info {
+ __u32 speed; /* USB link speed in kbit/s */
+ __u16 vid; /* USB vendor information */
+ __u16 pid; /* USB product information */
+ __u16 bcd; /* USB device revision */
+ __u8 bus; /* USB number */
+ __u8 addr; /* USB address */
+} __attribute__((packed,aligned(64)));
+
/*
* I O C T L C O D E S F O R V I D E O D E V I C E S
*
@@ -2005,6 +2024,7 @@ struct v4l2_dbg_chip_ident {
#define VIDIOC_DQEVENT _IOR('V', 89, struct v4l2_event)
#define VIDIOC_SUBSCRIBE_EVENT _IOW('V', 90, struct v4l2_event_subscription)
#define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription)
+#define VIDIOC_QUERYUSBINFO _IOR('V', 92, struct v4l2_usb_info)
/* Reminder: when adding new ioctls please add support for them to
drivers/media/video/v4l2-compat-ioctl32.c as well! */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201109080943.51981.hselasky>
