ports/103684: Please welcome the new "vid" port, based on the old, expired one.

Olivier olivier at gid0.org
Tue Sep 26 17:01:17 UTC 2006


>Number:         103684
>Category:       ports
>Synopsis:       Please welcome the new "vid" port, based on the old, expired one.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Sep 26 17:00:39 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Olivier
>Release:        FreeBSD 6.1-RELEASE-p2 i386
>Organization:
gid0.org 
>Environment:
System: FreeBSD l.gid0.org 6.1-RELEASE-p2 FreeBSD 6.1-RELEASE-p2 #0: Mon Jun 26 16:44:29 CEST 2006 root at l.gid0.org:/usr/obj/usr/src/sys/LAPTOP i386

>Description:
I'd like to take the maintainership for the resurrection of this port.
All included in the shar.

>How-To-Repeat:

>Fix:

--- vid.shar begins here ---
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	/usr/ports/graphics/vid
#	/usr/ports/graphics/vid/files
#	/usr/ports/graphics/vid/files/patch-vid.h
#	/usr/ports/graphics/vid/files/patch-vid.c
#	/usr/ports/graphics/vid/files/patch-Makefile
#	/usr/ports/graphics/vid/distinfo
#	/usr/ports/graphics/vid/Makefile
#	/usr/ports/graphics/vid/pkg-descr
#
echo c - /usr/ports/graphics/vid
mkdir -p /usr/ports/graphics/vid > /dev/null 2>&1
echo c - /usr/ports/graphics/vid/files
mkdir -p /usr/ports/graphics/vid/files > /dev/null 2>&1
echo x - /usr/ports/graphics/vid/files/patch-vid.h
sed 's/^X//' >/usr/ports/graphics/vid/files/patch-vid.h << 'END-of-/usr/ports/graphics/vid/files/patch-vid.h'
X--- vid.h.orig	Mon May  8 06:59:03 2000
X+++ vid.h	Wed Sep 20 18:12:13 2006
X@@ -37,6 +37,8 @@
X #define OV511_REG_CLKDIV	0x51
X #define OV511_REG_SNAP		0x52
X #define OV511_REG_EN_SYS	0x53
X+#define OV511_REG_PRW_CLK	0x54
X+#define OV511_REG_LED_CTL	0x55
X #define OV511_REG_USR		0x5E
X #define OV511_REG_CID		0x5F
X #define OV511_REG_PRH_Y		0x70
END-of-/usr/ports/graphics/vid/files/patch-vid.h
echo x - /usr/ports/graphics/vid/files/patch-vid.c
sed 's/^X//' >/usr/ports/graphics/vid/files/patch-vid.c << 'END-of-/usr/ports/graphics/vid/files/patch-vid.c'
X--- vid.c.orig	Mon May  8 06:59:03 2000
X+++ vid.c	Wed Sep 20 18:14:22 2006
X@@ -48,15 +48,15 @@
X   struct usb_ctl_request ur;
X   unsigned char data[1024];
X   
X-  ur.request.bmRequestType = UT_READ_VENDOR_INTERFACE;
X-  ur.request.bRequest = 2;
X+  ur.ucr_request.bmRequestType = UT_READ_VENDOR_INTERFACE;
X+  ur.ucr_request.bRequest = 2;
X   
X-  USETW(ur.request.wValue, 0);	/* unused */
X-  USETW(ur.request.wIndex, reg); /* index */
X-  USETW(ur.request.wLength, 1);	/* payload len in bytes */
X-  ur.data = data;
X-  ur.flags = 0;
X-  ur.actlen = 0;
X+  USETW(ur.ucr_request.wValue, 0);	/* unused */
X+  USETW(ur.ucr_request.wIndex, reg); /* index */
X+  USETW(ur.ucr_request.wLength, 1);	/* payload len in bytes */
X+  ur.ucr_data = data;
X+  ur.ucr_flags = 0;
X+  ur.ucr_actlen = 0;
X   
X   if(ioctl(fd, USB_DO_REQUEST, &ur) < 0) {
X     return -1;
X@@ -72,15 +72,15 @@
X 
X   data[0] = val;
X   
X-  ur.request.bmRequestType = UT_WRITE_VENDOR_INTERFACE;
X-  ur.request.bRequest = 2;
X+  ur.ucr_request.bmRequestType = UT_WRITE_VENDOR_INTERFACE;
X+  ur.ucr_request.bRequest = 2;
X   
X-  USETW(ur.request.wValue, 0);	/* unused */
X-  USETW(ur.request.wIndex, reg); /* index */
X-  USETW(ur.request.wLength, 1);	/* payload len in bytes */
X-  ur.data = data;
X-  ur.flags = 0;
X-  ur.actlen = 0;
X+  USETW(ur.ucr_request.wValue, 0);	/* unused */
X+  USETW(ur.ucr_request.wIndex, reg); /* index */
X+  USETW(ur.ucr_request.wLength, 1);	/* payload len in bytes */
X+  ur.ucr_data = data;
X+  ur.ucr_flags = 0;
X+  ur.ucr_actlen = 0;
X   
X   if(ioctl(fd, USB_DO_REQUEST, &ur) < 0) {
X     return -1;
X@@ -217,12 +217,15 @@
X   struct vidstate vs;		/* current read state */
X   int small = 0;		/* use 320x240 */
X   int frmnm = 0;		/* cyclic frame number key */
X+  int isplus;			/* bridge is OV511+ if true, else OV511 */
X+  int is20;			/* sensor is OV7620 if true, else OV7610 */
X+  int bufsize;			/* size of packet buffer */
X 
X   /* pnm_init(&argc, argv); */	/* required for PNM programs? */
X 
X   while(++argv, --argc) {
X     if(strcmp(*argv, "--version") == 0) {
X-      fprintf(stderr, "OV511 capture program version " VERSION
X+      fprintf(stderr, "OV511/OV511+ capture program version " VERSION
X 	      "\nCopyright 2000 Peter S. Housel"
X 	      "\nThis program is free software; "
X 	      "you may redistribute it under the terms of"
X@@ -235,7 +238,7 @@
X       exit(0);
X     } else if(strcmp(*argv, "--help") == 0) {
X       fprintf(stderr, "usage: vid [options]\n"
X-	      "Capture an image frame from an OV511-based USB video camera\n"
X+	      "Capture an image frame from an OV511/OV511+ based USB video camera\n"
X 	      "and write image data to standard output in PNM format\n\n"
X 	      "--version              print program version information\n"
X 	      "--usage                summarize command line options\n"
X@@ -287,8 +290,9 @@
X       exit(1);
X     }
X 
X-    if(udi.vendorNo != 0x05A9 || udi.productNo != 0x0511) {
X-      fprintf(stderr, "device %s is not an OmniVision OV511\n", devname);
X+    if(udi.udi_vendorNo != 0x05A9 || (udi.udi_productNo != 0x0511 &&
X+				  udi.udi_productNo != 0xa511)) {
X+      fprintf(stderr, "device %s is not an OmniVision OV511 or OV511+\n", devname);
X       exit(1);
X     }
X   } else {
X@@ -298,7 +302,8 @@
X       if((fd = open(dev, O_RDWR)) < 0)
X 	continue;
X       if(ioctl(fd, USB_GET_DEVICEINFO, &udi) < 0
X-	 || udi.vendorNo != 0x05A9 || udi.productNo != 0x0511) {
X+	 || udi.udi_vendorNo != 0x05A9 || (udi.udi_productNo != 0x0511 &&
X+				       udi.udi_productNo != 0xa511)) {
X 	close(fd);
X 	fd = -1;
X 	continue;
X@@ -308,12 +313,15 @@
X     }
X 
X     if(fd < 0) {
X-      fprintf(stderr, "vid: couldn't locate an OV511 device\n");
X+      fprintf(stderr, "vid: couldn't locate an OV511 or OV511+ device\n");
X       exit(1);
X     }
X 
X     devname = dev;
X   }
X+
X+  isplus = udi.udi_productNo == 0xa511;
X+  bufsize = (isplus ? 961 : 993);
X   
X   /* reset the OV511 */
X   if(ov511_reg_write(fd, OV511_REG_RST, 0x7f) < 0)
X@@ -398,23 +406,55 @@
X   if(ov511_reg_write(fd, OV511_REG_CE_EN, 0x0) < 0)
X     exit(1);
X 
X-  ov511_i2c_write(fd, OV7610_REG_RWB, 0x5);
X-  ov511_i2c_write(fd, OV7610_REG_EC, 0xFF);
X-  ov511_i2c_write(fd, OV7610_REG_COMB, 0x01);
X-  ov511_i2c_write(fd, OV7610_REG_FD, 0x06);
X-  ov511_i2c_write(fd, OV7610_REG_COME, 0x1c);
X-  ov511_i2c_write(fd, OV7610_REG_COMF, 0x90);
X-  ov511_i2c_write(fd, OV7610_REG_ECW, 0x2e);
X-  ov511_i2c_write(fd, OV7610_REG_ECB, 0x7C);
X-  ov511_i2c_write(fd, OV7610_REG_COMH, 0x24);
X-  ov511_i2c_write(fd, OV7610_REG_EHSH, 0x04);
X-  ov511_i2c_write(fd, OV7610_REG_EHSL, 0xAC);
X-  ov511_i2c_write(fd, OV7610_REG_EXBK, 0xFE);
X-  ov511_i2c_write(fd, OV7610_REG_COMJ, 0x93);
X-  ov511_i2c_write(fd, OV7610_REG_BADJ, 0x48);
X-  ov511_i2c_write(fd, OV7610_REG_COMK, 0x81);
X+  /* This returns 0 if we have an OV7620 sensor */
X+  if((is20 = ov511_i2c_read(fd, OV7610_REG_COMI)) < 0)
X+    exit(1);
X+  is20 = !is20;
X+
X+  /* set up the OV7610/OV7620 */
X+  if(is20) {
X+    ov511_i2c_write(fd, OV7610_REG_EC,      0xff);
X+    ov511_i2c_write(fd, OV7610_REG_FD,      0x06);
X+    ov511_i2c_write(fd, OV7610_REG_COMH,    0x24);
X+    ov511_i2c_write(fd, OV7610_REG_EHSL,    0xac);
X+    ov511_i2c_write(fd, OV7610_REG_COMA,    0x00);
X+    ov511_i2c_write(fd, OV7610_REG_COMH,    0x24);
X+    ov511_i2c_write(fd, OV7610_REG_RWB,     0x85);
X+    ov511_i2c_write(fd, OV7610_REG_COMD,    0x01);
X+    ov511_i2c_write(fd, 0x23,               0x00);
X+    ov511_i2c_write(fd, OV7610_REG_ECW,     0x10);
X+    ov511_i2c_write(fd, OV7610_REG_ECB,     0x8a);
X+    ov511_i2c_write(fd, OV7610_REG_COMG,    0xe2);
X+    ov511_i2c_write(fd, OV7610_REG_EHSH,    0x00);
X+    ov511_i2c_write(fd, OV7610_REG_EXBK,    0xfe);
X+    ov511_i2c_write(fd, 0x30,               0x71);
X+    ov511_i2c_write(fd, 0x31,               0x60);
X+    ov511_i2c_write(fd, 0x32,               0x26);
X+    ov511_i2c_write(fd, OV7610_REG_YGAM,    0x20);
X+    ov511_i2c_write(fd, OV7610_REG_BADJ,    0x48);
X+    ov511_i2c_write(fd, OV7610_REG_COMA,    0x24);
X+    ov511_i2c_write(fd, OV7610_REG_SYN_CLK, 0x01);
X+    ov511_i2c_write(fd, OV7610_REG_BBS,     0x24);
X+    ov511_i2c_write(fd, OV7610_REG_RBS,     0x24);
X+  } else {
X+    ov511_i2c_write(fd, OV7610_REG_RWB, 0x5);
X+    ov511_i2c_write(fd, OV7610_REG_EC, 0xFF);
X+    ov511_i2c_write(fd, OV7610_REG_COMB, 0x01);
X+    ov511_i2c_write(fd, OV7610_REG_FD, 0x06);
X+    ov511_i2c_write(fd, OV7610_REG_COME, 0x1c);
X+    ov511_i2c_write(fd, OV7610_REG_COMF, 0x90);
X+    ov511_i2c_write(fd, OV7610_REG_ECW, 0x2e);
X+    ov511_i2c_write(fd, OV7610_REG_ECB, 0x7C);
X+    ov511_i2c_write(fd, OV7610_REG_COMH, 0x24);
X+    ov511_i2c_write(fd, OV7610_REG_EHSH, 0x04);
X+    ov511_i2c_write(fd, OV7610_REG_EHSL, 0xAC);
X+    ov511_i2c_write(fd, OV7610_REG_EXBK, 0xFE);
X+    ov511_i2c_write(fd, OV7610_REG_COMJ, 0x93);
X+    ov511_i2c_write(fd, OV7610_REG_BADJ, 0x48);
X+    ov511_i2c_write(fd, OV7610_REG_COMK, 0x81);
X 
X-  ov511_i2c_write(fd, OV7610_REG_GAM, 0x04);
X+    ov511_i2c_write(fd, OV7610_REG_GAM, 0x04);
X+  }
X 
X   if(small) {
X     vs.width = 320;
X@@ -442,14 +482,14 @@
X   ov511_reg_write(fd, OV511_REG_LNDV, 0x00);
X 
X   /* set FIFO format (993-byte packets) */
X-  if(ov511_reg_write(fd, OV511_REG_PKSZ, 0x1F) < 0)
X+  if(ov511_reg_write(fd, OV511_REG_PKSZ, bufsize/32) < 0)
X     exit(1);
X   if(ov511_reg_write(fd, OV511_REG_PKFMT, 0x03) < 0)
X     exit(1);
X 
X   /* select the 993-byte alternative */
X-  alt.interface_index = 0;
X-  alt.alt_no = 1;
X+  alt.uai_interface_index = 0;
X+  alt.uai_alt_no = (isplus ? 7 : 1);
X   if(ioctl(fd, USB_SET_ALTINTERFACE, &alt) < 0) {
X     perror("USB_SET_ALTINTERFACE");
X     exit(1);
X@@ -475,36 +515,38 @@
X   }
X 
X   /* read, looking for start and end frames */
X-  while(vs.state != DONE && (len = read(isoc, &buf, 993)) >= 0) {
X+  while(vs.state != DONE && (len = read(isoc, &buf, bufsize)) >= 0) {
X     if(buf[0] == 0 && buf[1] == 0 && buf[2] == 0 && buf[3] == 0
X        && buf[4] == 0 && buf[5] == 0 && buf[6] == 0 && buf[7] == 0
X-       && (buf[8] & 0x80) == 0 && buf[992] == 0 && vs.state == SKIPPING) {
X+       && (buf[8] & 0x80) == 0 && buf[bufsize-1] == 0 && vs.state == SKIPPING) {
X 	vs.state = READING;
X 	vs.iY = vs.jY = vs.iUV = vs.jUV = 0;
X 	vs.residue = 0;
X-	procdata(&vs, buf + 9, 993 - 10);
X+	procdata(&vs, buf + 9, bufsize - 10);
X     } else if(buf[0] == 0 && buf[1] == 0 && buf[2] == 0 && buf[3] == 0
X 	      && buf[4] == 0 && buf[5] == 0 && buf[6] == 0 && buf[7] == 0
X-	      && (buf[8] & 0x80) == 0x80 && buf[992] == 0
X+	      && (buf[8] & 0x80) == 0x80 && buf[bufsize-1] == 0
X 	      && vs.state == READING) {
X       vs.state = DONE;
X     } else if(vs.state == READING) {
X-      procdata(&vs, buf, 993 - 1);
X+      procdata(&vs, buf, bufsize - 1);
X 
X       /* abort the capture and start over if packets come in out-of-order */
X-      if(buf[992] != frmnm && buf[992] != 1) {
X+      if(buf[bufsize-1] != frmnm && buf[bufsize-1] != 1) {
X 	vs.state = SKIPPING;
X       }
X-      frmnm = buf[992] + 1;
X+      frmnm = buf[bufsize-1] + 1;
X       if(frmnm == 256)
X 	frmnm = 1;
X-    } else if(buf[992] != 0) {
X-      frmnm = buf[992] + 1;
X+    } else if(buf[bufsize-1] != 0) {
X+      frmnm = buf[bufsize-1] + 1;
X       if(frmnm == 256)
X 	frmnm = 1;
X     }
X   }
X 
X+  /* reset and close the OV511 */
X+  ov511_reg_write(fd, OV511_REG_RST, 0x7f);
X   close(isoc);
X   close(fd);
X 
END-of-/usr/ports/graphics/vid/files/patch-vid.c
echo x - /usr/ports/graphics/vid/files/patch-Makefile
sed 's/^X//' >/usr/ports/graphics/vid/files/patch-Makefile << 'END-of-/usr/ports/graphics/vid/files/patch-Makefile'
X--- Makefile.orig	Wed Sep 20 18:12:33 2006
X+++ Makefile	Wed Sep 20 18:12:41 2006
X@@ -6,7 +6,7 @@
X 
X CFLAGS	= -O
X CPPFLAGS = -I/usr/local/include
X-LIBS	= -L/usr/local/lib -lpnm
X+LIBS	= -L/usr/local/lib -lnetpbm
X 
X default:	vid
X 
END-of-/usr/ports/graphics/vid/files/patch-Makefile
echo x - /usr/ports/graphics/vid/distinfo
sed 's/^X//' >/usr/ports/graphics/vid/distinfo << 'END-of-/usr/ports/graphics/vid/distinfo'
XMD5 (vid-1.0.1.tar.gz) = b23adc85c03cc5a21e3574559e6ee88b
XSHA256 (vid-1.0.1.tar.gz) = af1eec3a543129cace972d9060207a03221674a31d1ceea1b75b97fdb8060919
XSIZE (vid-1.0.1.tar.gz) = 13986
END-of-/usr/ports/graphics/vid/distinfo
echo x - /usr/ports/graphics/vid/Makefile
sed 's/^X//' >/usr/ports/graphics/vid/Makefile << 'END-of-/usr/ports/graphics/vid/Makefile'
X# New ports collection makefile for:	vid
X# Date created:		Tue Dec  5 13:32:13 GMT 2000
X# Whom:			Roger Hardiman <roger at freebsd.org>
X#
X# $FreeBSD: /repoman/r/pcvs/ports/graphics/vid/Makefile,v 1.11 2005/12/29 19:40:21 pav Exp $
X#
X
XPORTNAME=	vid
XPORTVERSION=	1.0.1
XPORTREVISION=	2
XCATEGORIES=	graphics
XMASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
XMASTER_SITE_SUBDIR=	ovtvid-bsd
X
XMAINTAINER=	olivier at gid0.org
XCOMMENT=	Grab images from USB Cameras using the OV511 and OV511+ chipset
X
XLIB_DEPENDS=	netpbm:${PORTSDIR}/graphics/netpbm
X
XPLIST_FILES=	bin/vid
X# The port does not understand 'make all' or 'make install'
X# so change the 'all_target' to be empty and use our own do-install handler.
X
XALL_TARGET=
X
Xdo-install:
X	${INSTALL_PROGRAM} ${WRKSRC}/vid ${PREFIX}/bin
X
X.include <bsd.port.mk>
END-of-/usr/ports/graphics/vid/Makefile
echo x - /usr/ports/graphics/vid/pkg-descr
sed 's/^X//' >/usr/ports/graphics/vid/pkg-descr << 'END-of-/usr/ports/graphics/vid/pkg-descr'
XThe ovtvid-bsd project has written for FreeBSD and NetBSD) a simple-minded
Ximage capture program for USB webcams based on the OmniVision Technologies
XOV511/OV511+ bridge chip attached to an OV7610 CCD imager.
X
XThis includes inexpensive webcams such as:
X    * Creative Labs WebCam 3
X    * D-Link DSB-C300
X    * Puretek PT-6007
X    * Alpha Vision Koala-Cam
X    * Lifeview RoboCam
X    * AverMedia InterCam Elite
X    * MediaForte MV300
X    * Trust Spacec at m 300
X
XThe program is heavily based on the OV511 Linux driver by Mark W. McClelland.
XRecent versions of that driver support a wider array of cameras; if it supports
Xsomething that this program doesn't then contact us and we'll see what we can do.
X
XWWW: http://ovtvid-bsd.sourceforge.net/
X
X- Olivier Smedts
Xolivier at freebsd.org
END-of-/usr/ports/graphics/vid/pkg-descr
exit
--- vid.shar ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list