From owner-freebsd-multimedia@FreeBSD.ORG Thu Sep 8 07:46:36 2011 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5420106566C for ; Thu, 8 Sep 2011 07:46:36 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe05.c2i.net [212.247.154.130]) by mx1.freebsd.org (Postfix) with ESMTP id 55F328FC19 for ; Thu, 8 Sep 2011 07:46:35 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=npWEf5XEtLL8qLh8yAfHNcIa2ktE1/5Qf1/k+5E0ZhU= c=1 sm=1 a=CX0pRFDQ4JIA:10 a=WQU8e4WWZSUA:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=eq3QMAmQnGGowT92e5IA:9 a=wPNLvfGTeEIA:10 a=8kQB0OdkAAAA:8 a=AbXoaRu7GVRBjFZogBgA:9 a=HKUJo7mZ0wGSCxAfYTYA:7 a=9aOQ2cSd83gA:10 a=aavwdfFMX3zUXxn3:21 a=2G9VhY0fMo-NGMFK:21 a=T_HktwGXBy8R2PltwpMA:9 a=dmzZxMzJcAoQ0_DFmOAA:7 a=4jUF7Nk8RTzCWfgO:21 a=Oewt0-DUWerJntfq:21 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe05.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 174706708; Thu, 08 Sep 2011 09:46:33 +0200 To: freebsd-multimedia@freebsd.org From: Hans Petter Selasky X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq,NwSZ4V" =?iso-8859-15?q?=7CLR=2E+tj=7Dg5=0A=09=25V?=,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( =?iso-8859-15?q?=0A=09=3AAuzV9=3A=2EhESm-x4h240C=609=3Dw?= Date: Thu, 8 Sep 2011 09:43:51 +0200 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_3IHaOvaFwI5ByeL" Message-Id: <201109080943.51981.hselasky@c2i.net> Cc: Hans de Goede Subject: Re: Web camera stream is flipped upsidedown X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Sep 2011 07:46:37 -0000 --Boundary-00=_3IHaOvaFwI5ByeL Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit 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: 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 > iProduct = 0x0001 > iSerialNumber = 0x0003 > 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! --Boundary-00=_3IHaOvaFwI5ByeL Content-Type: text/x-patch; charset="iso-8859-1"; name="libv4l.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="libv4l.patch" commit 593e3a9167b4a194f2483cdf7fec4fe25606e8b8 Author: Hans Petter Selasky Date: Wed Jul 20 14:14:51 2011 +0200 Provide direct way of getting USB device information. Signed-off-by: Hans Petter Selasky 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) --Boundary-00=_3IHaOvaFwI5ByeL Content-Type: text/x-patch; charset="iso-8859-1"; name="videodev2.h.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="videodev2.h.patch" 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! */ --Boundary-00=_3IHaOvaFwI5ByeL--