diff --git a/graphics/vid/Makefile b/graphics/vid/Makefile new file mode 100644 index 00000000000..36393a63448 --- /dev/null +++ b/graphics/vid/Makefile @@ -0,0 +1,31 @@ +# $OpenBSD: Makefile,v 1.1.1.1 2001/06/19 03:25:08 angelos Exp $ +# $FreeBSD: ports/graphics/vid/Makefile,v 1.5 2001/02/21 07:48:56 roger Exp $ +# + +COMMENT= "Get images from USB cameras using the OV511(+) chipsets" + +DISTNAME= vid-1.0.1 +CATEGORIES= graphics +NEED_VERSION= 1.402 + +MAINTAINER= ports@openbsd.org + +# GNU +PERMIT_PACKAGE_CDROM= Yes +PERMIT_PACKAGE_FTP= Yes +PERMIT_DISTFILES_CDROM= Yes +PERMIT_DISTFILES_FTP= Yes + +MASTER_SITES= http://members.home.com/housel/ + +BUILD_DEPENDS= picttoppm:netpbm-*:graphics/netpbm + +# The port does not understand 'make all' or 'make install' +# so change the 'all_target' to be empty and use our own do-install handler. + +ALL_TARGET= + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/vid ${PREFIX}/bin + +.include diff --git a/graphics/vid/files/md5 b/graphics/vid/files/md5 new file mode 100644 index 00000000000..8ced19b3d61 --- /dev/null +++ b/graphics/vid/files/md5 @@ -0,0 +1,3 @@ +MD5 (vid-1.0.1.tar.gz) = b23adc85c03cc5a21e3574559e6ee88b +RMD160 (vid-1.0.1.tar.gz) = 5e06bd923506fbd2978e3a05f98b6315c1ed5fd0 +SHA1 (vid-1.0.1.tar.gz) = 4967f9d02429f9202ea879c051c736d112856063 diff --git a/graphics/vid/patches/patch-Makefile b/graphics/vid/patches/patch-Makefile new file mode 100644 index 00000000000..2f46248f346 --- /dev/null +++ b/graphics/vid/patches/patch-Makefile @@ -0,0 +1,12 @@ +$OpenBSD: patch-Makefile,v 1.1.1.1 2001/06/19 03:25:08 angelos Exp $ +--- Makefile.orig Sat Jun 9 01:33:46 2001 ++++ Makefile Sat Jun 9 01:33:56 2001 +@@ -6,7 +6,7 @@ VERSION = 1.0.1 + + CFLAGS = -O + CPPFLAGS = -I/usr/local/include +-LIBS = -L/usr/local/lib -lpnm ++LIBS = -L/usr/local/lib -lpnm -lppm -lpbm -lpgm + + default: vid + diff --git a/graphics/vid/patches/patch-vid_c b/graphics/vid/patches/patch-vid_c new file mode 100644 index 00000000000..d1405cd8c8f --- /dev/null +++ b/graphics/vid/patches/patch-vid_c @@ -0,0 +1,205 @@ +$OpenBSD: patch-vid_c,v 1.1.1.1 2001/06/19 03:25:08 angelos Exp $ +--- vid.c.orig Mon May 8 00:59:03 2000 ++++ vid.c Sat Jun 9 01:33:37 2001 +@@ -217,12 +217,15 @@ main(int argc, char *argv[]) { + struct vidstate vs; /* current read state */ + int small = 0; /* use 320x240 */ + int frmnm = 0; /* cyclic frame number key */ ++ int isplus; /* bridge is OV511+ if true, else OV511 */ ++ int is20; /* sensor is OV7620 if true, else OV7610 */ ++ int bufsize; /* size of packet buffer */ + + /* pnm_init(&argc, argv); */ /* required for PNM programs? */ + + while(++argv, --argc) { + if(strcmp(*argv, "--version") == 0) { +- fprintf(stderr, "OV511 capture program version " VERSION ++ fprintf(stderr, "OV511/OV511+ capture program version " VERSION + "\nCopyright 2000 Peter S. Housel" + "\nThis program is free software; " + "you may redistribute it under the terms of" +@@ -235,7 +238,7 @@ main(int argc, char *argv[]) { + exit(0); + } else if(strcmp(*argv, "--help") == 0) { + fprintf(stderr, "usage: vid [options]\n" +- "Capture an image frame from an OV511-based USB video camera\n" ++ "Capture an image frame from an OV511/OV511+ based USB video camera\n" + "and write image data to standard output in PNM format\n\n" + "--version print program version information\n" + "--usage summarize command line options\n" +@@ -287,8 +290,9 @@ main(int argc, char *argv[]) { + exit(1); + } + +- if(udi.vendorNo != 0x05A9 || udi.productNo != 0x0511) { +- fprintf(stderr, "device %s is not an OmniVision OV511\n", devname); ++ if(udi.vendorNo != 0x05A9 || (udi.productNo != 0x0511 && ++ udi.productNo != 0xa511)) { ++ fprintf(stderr, "device %s is not an OmniVision OV511 or OV511+\n", devname); + exit(1); + } + } else { +@@ -298,7 +302,8 @@ main(int argc, char *argv[]) { + if((fd = open(dev, O_RDWR)) < 0) + continue; + if(ioctl(fd, USB_GET_DEVICEINFO, &udi) < 0 +- || udi.vendorNo != 0x05A9 || udi.productNo != 0x0511) { ++ || udi.vendorNo != 0x05A9 || (udi.productNo != 0x0511 && ++ udi.productNo != 0xa511)) { + close(fd); + fd = -1; + continue; +@@ -308,12 +313,15 @@ main(int argc, char *argv[]) { + } + + if(fd < 0) { +- fprintf(stderr, "vid: couldn't locate an OV511 device\n"); ++ fprintf(stderr, "vid: couldn't locate an OV511 or OV511+ device\n"); + exit(1); + } + + devname = dev; + } ++ ++ isplus = udi.productNo == 0xa511; ++ bufsize = (isplus ? 961 : 993); + + /* reset the OV511 */ + if(ov511_reg_write(fd, OV511_REG_RST, 0x7f) < 0) +@@ -398,23 +406,55 @@ main(int argc, char *argv[]) { + if(ov511_reg_write(fd, OV511_REG_CE_EN, 0x0) < 0) + exit(1); + +- ov511_i2c_write(fd, OV7610_REG_RWB, 0x5); +- ov511_i2c_write(fd, OV7610_REG_EC, 0xFF); +- ov511_i2c_write(fd, OV7610_REG_COMB, 0x01); +- ov511_i2c_write(fd, OV7610_REG_FD, 0x06); +- ov511_i2c_write(fd, OV7610_REG_COME, 0x1c); +- ov511_i2c_write(fd, OV7610_REG_COMF, 0x90); +- ov511_i2c_write(fd, OV7610_REG_ECW, 0x2e); +- ov511_i2c_write(fd, OV7610_REG_ECB, 0x7C); +- ov511_i2c_write(fd, OV7610_REG_COMH, 0x24); +- ov511_i2c_write(fd, OV7610_REG_EHSH, 0x04); +- ov511_i2c_write(fd, OV7610_REG_EHSL, 0xAC); +- ov511_i2c_write(fd, OV7610_REG_EXBK, 0xFE); +- ov511_i2c_write(fd, OV7610_REG_COMJ, 0x93); +- ov511_i2c_write(fd, OV7610_REG_BADJ, 0x48); +- ov511_i2c_write(fd, OV7610_REG_COMK, 0x81); ++ /* This returns 0 if we have an OV7620 sensor */ ++ if((is20 = ov511_i2c_read(fd, OV7610_REG_COMI)) < 0) ++ exit(1); ++ is20 = !is20; ++ ++ /* set up the OV7610/OV7620 */ ++ if(is20) { ++ ov511_i2c_write(fd, OV7610_REG_EC, 0xff); ++ ov511_i2c_write(fd, OV7610_REG_FD, 0x06); ++ ov511_i2c_write(fd, OV7610_REG_COMH, 0x24); ++ ov511_i2c_write(fd, OV7610_REG_EHSL, 0xac); ++ ov511_i2c_write(fd, OV7610_REG_COMA, 0x00); ++ ov511_i2c_write(fd, OV7610_REG_COMH, 0x24); ++ ov511_i2c_write(fd, OV7610_REG_RWB, 0x85); ++ ov511_i2c_write(fd, OV7610_REG_COMD, 0x01); ++ ov511_i2c_write(fd, 0x23, 0x00); ++ ov511_i2c_write(fd, OV7610_REG_ECW, 0x10); ++ ov511_i2c_write(fd, OV7610_REG_ECB, 0x8a); ++ ov511_i2c_write(fd, OV7610_REG_COMG, 0xe2); ++ ov511_i2c_write(fd, OV7610_REG_EHSH, 0x00); ++ ov511_i2c_write(fd, OV7610_REG_EXBK, 0xfe); ++ ov511_i2c_write(fd, 0x30, 0x71); ++ ov511_i2c_write(fd, 0x31, 0x60); ++ ov511_i2c_write(fd, 0x32, 0x26); ++ ov511_i2c_write(fd, OV7610_REG_YGAM, 0x20); ++ ov511_i2c_write(fd, OV7610_REG_BADJ, 0x48); ++ ov511_i2c_write(fd, OV7610_REG_COMA, 0x24); ++ ov511_i2c_write(fd, OV7610_REG_SYN_CLK, 0x01); ++ ov511_i2c_write(fd, OV7610_REG_BBS, 0x24); ++ ov511_i2c_write(fd, OV7610_REG_RBS, 0x24); ++ } else { ++ ov511_i2c_write(fd, OV7610_REG_RWB, 0x5); ++ ov511_i2c_write(fd, OV7610_REG_EC, 0xFF); ++ ov511_i2c_write(fd, OV7610_REG_COMB, 0x01); ++ ov511_i2c_write(fd, OV7610_REG_FD, 0x06); ++ ov511_i2c_write(fd, OV7610_REG_COME, 0x1c); ++ ov511_i2c_write(fd, OV7610_REG_COMF, 0x90); ++ ov511_i2c_write(fd, OV7610_REG_ECW, 0x2e); ++ ov511_i2c_write(fd, OV7610_REG_ECB, 0x7C); ++ ov511_i2c_write(fd, OV7610_REG_COMH, 0x24); ++ ov511_i2c_write(fd, OV7610_REG_EHSH, 0x04); ++ ov511_i2c_write(fd, OV7610_REG_EHSL, 0xAC); ++ ov511_i2c_write(fd, OV7610_REG_EXBK, 0xFE); ++ ov511_i2c_write(fd, OV7610_REG_COMJ, 0x93); ++ ov511_i2c_write(fd, OV7610_REG_BADJ, 0x48); ++ ov511_i2c_write(fd, OV7610_REG_COMK, 0x81); + +- ov511_i2c_write(fd, OV7610_REG_GAM, 0x04); ++ ov511_i2c_write(fd, OV7610_REG_GAM, 0x04); ++ } + + if(small) { + vs.width = 320; +@@ -442,14 +482,14 @@ main(int argc, char *argv[]) { + ov511_reg_write(fd, OV511_REG_LNDV, 0x00); + + /* set FIFO format (993-byte packets) */ +- if(ov511_reg_write(fd, OV511_REG_PKSZ, 0x1F) < 0) ++ if(ov511_reg_write(fd, OV511_REG_PKSZ, bufsize/32) < 0) + exit(1); + if(ov511_reg_write(fd, OV511_REG_PKFMT, 0x03) < 0) + exit(1); + + /* select the 993-byte alternative */ + alt.interface_index = 0; +- alt.alt_no = 1; ++ alt.alt_no = (isplus ? 7 : 1); + if(ioctl(fd, USB_SET_ALTINTERFACE, &alt) < 0) { + perror("USB_SET_ALTINTERFACE"); + exit(1); +@@ -475,36 +515,38 @@ main(int argc, char *argv[]) { + } + + /* read, looking for start and end frames */ +- while(vs.state != DONE && (len = read(isoc, &buf, 993)) >= 0) { ++ while(vs.state != DONE && (len = read(isoc, &buf, bufsize)) >= 0) { + if(buf[0] == 0 && buf[1] == 0 && buf[2] == 0 && buf[3] == 0 + && buf[4] == 0 && buf[5] == 0 && buf[6] == 0 && buf[7] == 0 +- && (buf[8] & 0x80) == 0 && buf[992] == 0 && vs.state == SKIPPING) { ++ && (buf[8] & 0x80) == 0 && buf[bufsize-1] == 0 && vs.state == SKIPPING) { + vs.state = READING; + vs.iY = vs.jY = vs.iUV = vs.jUV = 0; + vs.residue = 0; +- procdata(&vs, buf + 9, 993 - 10); ++ procdata(&vs, buf + 9, bufsize - 10); + } else if(buf[0] == 0 && buf[1] == 0 && buf[2] == 0 && buf[3] == 0 + && buf[4] == 0 && buf[5] == 0 && buf[6] == 0 && buf[7] == 0 +- && (buf[8] & 0x80) == 0x80 && buf[992] == 0 ++ && (buf[8] & 0x80) == 0x80 && buf[bufsize-1] == 0 + && vs.state == READING) { + vs.state = DONE; + } else if(vs.state == READING) { +- procdata(&vs, buf, 993 - 1); ++ procdata(&vs, buf, bufsize - 1); + + /* abort the capture and start over if packets come in out-of-order */ +- if(buf[992] != frmnm && buf[992] != 1) { ++ if(buf[bufsize-1] != frmnm && buf[bufsize-1] != 1) { + vs.state = SKIPPING; + } +- frmnm = buf[992] + 1; ++ frmnm = buf[bufsize-1] + 1; + if(frmnm == 256) + frmnm = 1; +- } else if(buf[992] != 0) { +- frmnm = buf[992] + 1; ++ } else if(buf[bufsize-1] != 0) { ++ frmnm = buf[bufsize-1] + 1; + if(frmnm == 256) + frmnm = 1; + } + } + ++ /* reset and close the OV511 */ ++ ov511_reg_write(fd, OV511_REG_RST, 0x7f); + close(isoc); + close(fd); + diff --git a/graphics/vid/patches/patch-vid_h b/graphics/vid/patches/patch-vid_h new file mode 100644 index 00000000000..c671b51f984 --- /dev/null +++ b/graphics/vid/patches/patch-vid_h @@ -0,0 +1,12 @@ +$OpenBSD: patch-vid_h,v 1.1.1.1 2001/06/19 03:25:08 angelos Exp $ +--- vid.h.orig Mon May 8 00:59:03 2000 ++++ vid.h Sat Jun 9 01:33:37 2001 +@@ -37,6 +37,8 @@ + #define OV511_REG_CLKDIV 0x51 + #define OV511_REG_SNAP 0x52 + #define OV511_REG_EN_SYS 0x53 ++#define OV511_REG_PRW_CLK 0x54 ++#define OV511_REG_LED_CTL 0x55 + #define OV511_REG_USR 0x5E + #define OV511_REG_CID 0x5F + #define OV511_REG_PRH_Y 0x70 diff --git a/graphics/vid/pkg/DESCR b/graphics/vid/pkg/DESCR new file mode 100644 index 00000000000..cf6519d7675 --- /dev/null +++ b/graphics/vid/pkg/DESCR @@ -0,0 +1,27 @@ +vid is a Image Capture program for USB cameras using the +Omnivision OV511 and OV511+ chipset. + + +These include the + + Creative Labs WebCam 3 (*** see note about the OV511+ below ***) + D-Link DSB-C300 + Puretek PT-6007 + Alpha Vision Koala-Cam + Lifeview RoboCam + AverMedia InterCam Elite + MediaForte MV300 + Trust SpaceCam 300 (*** see note about the OV511+ below ***) + +The program was written by Peter Housel has added support for OV511+ cameras. +Older Creative WebCam 3's use the OV511 but newer ones use the OV511+ + +On my OV511+ Trust SpaceCam 300 the image appears orange. I'm investigating. + + +WWW: http://members.home.com/housel/ diff --git a/graphics/vid/pkg/PLIST b/graphics/vid/pkg/PLIST new file mode 100644 index 00000000000..0104a150a28 --- /dev/null +++ b/graphics/vid/pkg/PLIST @@ -0,0 +1,2 @@ +@comment $OpenBSD: PLIST,v 1.1.1.1 2001/06/19 03:25:08 angelos Exp $ +bin/vid