From cc47cd95b1c360908c8e900e461e24c8f7feb907 Mon Sep 17 00:00:00 2001 From: Luigi Rizzo Date: Fri, 2 Feb 2007 18:19:15 +0000 Subject: [PATCH] New port linux-gspca-kmod, a usb webcam driver based on the linux driver 'gspca' (from http://mxhaard.free.fr/index.html) built on FreeBSD using devel/linux-kmod-compat . The driver supports a very large number of webcams. However, THIS IS EXPERIMENTAL CODE, TRY IT AT YOUR OWN RISK. This is only for 6.x/7.x and at the moment only for i386. Most bugs and limitations are due to linux-kmod-compat rather than this port itself, so upgrading linux-kmod-compat (and rebuilding this port) will most likely improve functionality and remove some bugs. As usual if some of the port gurus wants to help fixing any mistakes that i may have made in the port (or missing things, e.g. a suitable warning message when the port is installed), i will be very grateful (and can spend more time working on the emulation code). --- multimedia/linux-gspca-kmod/Makefile | 29 ++++ multimedia/linux-gspca-kmod/distinfo | 3 + .../linux-gspca-kmod/files/Makefile.kld | 43 ++++++ .../linux-gspca-kmod/files/patch-20070110 | 131 ++++++++++++++++++ multimedia/linux-gspca-kmod/pkg-descr | 4 + multimedia/linux-gspca-kmod/pkg-plist | 3 + 6 files changed, 213 insertions(+) create mode 100644 multimedia/linux-gspca-kmod/Makefile create mode 100644 multimedia/linux-gspca-kmod/distinfo create mode 100644 multimedia/linux-gspca-kmod/files/Makefile.kld create mode 100644 multimedia/linux-gspca-kmod/files/patch-20070110 create mode 100644 multimedia/linux-gspca-kmod/pkg-descr create mode 100644 multimedia/linux-gspca-kmod/pkg-plist diff --git a/multimedia/linux-gspca-kmod/Makefile b/multimedia/linux-gspca-kmod/Makefile new file mode 100644 index 000000000000..7effc502f499 --- /dev/null +++ b/multimedia/linux-gspca-kmod/Makefile @@ -0,0 +1,29 @@ +# New ports collection makefile for: gspcav1-kmod +# Date created: 1 February 2007 +# Whom: luigi +# +# $FreeBSD$ +# + +PORTNAME= linux-gspca-kmod +PORTVERSION= 1.0.12 +CATEGORIES= multimedia +MASTER_SITES= http://mxhaard.free.fr/spca50x/Download/ +DISTNAME= gspcav1-20070110 + +MAINTAINER= luigi@FreeBSD.org +COMMENT= A port of the linux gspcav1 webcam driver + +# Requires the linux emulation layer to be built +BUILD_DEPENDS= /usr/share/mk/bsd.linux_kmod.mk:${PORTSDIR}/devel/linux-kmod-compat + +NO_PACKAGE= depends on kernel sources + +# This is our Makefile to be used for build/install. +MAKEFILE= Makefile.kld +ALL_TARGET= depend all + +post-extract: + @${CP} ${FILESDIR}/${MAKEFILE} ${WRKSRC} + +.include diff --git a/multimedia/linux-gspca-kmod/distinfo b/multimedia/linux-gspca-kmod/distinfo new file mode 100644 index 000000000000..628ebb5c27a7 --- /dev/null +++ b/multimedia/linux-gspca-kmod/distinfo @@ -0,0 +1,3 @@ +MD5 (gspcav1-20070110.tar.gz) = 1e3fa004490a07b7b76de03d70b3e8ea +SHA256 (gspcav1-20070110.tar.gz) = f05d6793b943b7d1115e2b4b047ec1131c07c9ef0fd890d1616e5be0edd4a555 +SIZE (gspcav1-20070110.tar.gz) = 159466 diff --git a/multimedia/linux-gspca-kmod/files/Makefile.kld b/multimedia/linux-gspca-kmod/files/Makefile.kld new file mode 100644 index 000000000000..4c41351d6d00 --- /dev/null +++ b/multimedia/linux-gspca-kmod/files/Makefile.kld @@ -0,0 +1,43 @@ +# Makefile.kld to build a driver with linux emulation. +# See /usr/share/mk/bsd.linux_kmod.mk for more info + +.PATH: ${.CURDIR} ${.CURDIR}/decoder + +SRCS= gspca_core.c gspcadecoder.c # sources for the linux driver + +KMOD=gspca # module name + +CFLAGS+= -ISunplus -ISunplus-jpeg -ISonix -IConexant +CFLAGS+= -IVimicro -Idecoder +CFLAGS+= -DUSB_DEBUG + +#--- Here are the driver-specific variables + +VERSION = 01.00.12 + +### +# The following flags enable experimental features. +# By default, these are enabled for development versions of the driver, and +# disabled for release versions. + +# Optional: Enable driver debugging +CFLAGS += -DGSPCA_ENABLE_DEBUG + +# Optional: Enable direct register read/write for PAC207 development +#CFLAGS += -DGSPCA_ENABLE_REGISTERPLAY + +### +# The following flags enable features that aren't yet implemented, and +# therefore are disabled by default. + +# Optional: Enable compression +CFLAGS += -DGSPCA_ENABLE_COMPRESSION + +### +# Rest of Makefile follows here. You probably won't need to touch this. + +# Setup defines +CFLAGS += -DCONFIG_USB_GSPCA_MODULE=1 +CFLAGS += -DVID_HARDWARE_GSPCA=0xFF -DGSPCA_VERSION=\"$(VERSION)\" + +.include diff --git a/multimedia/linux-gspca-kmod/files/patch-20070110 b/multimedia/linux-gspca-kmod/files/patch-20070110 new file mode 100644 index 000000000000..9db7a7a07944 --- /dev/null +++ b/multimedia/linux-gspca-kmod/files/patch-20070110 @@ -0,0 +1,131 @@ +diff -ubwr ./Conexant/cx11646.h /usr/ports/luigi/gspca/work-luigi/gspcav1-20070110/Conexant/cx11646.h +--- ./Conexant/cx11646.h Fri Apr 21 12:02:04 2006 ++++ /usr/ports/luigi/gspca/work-luigi/gspcav1-20070110/Conexant/cx11646.h Mon Jan 22 08:40:08 2007 +@@ -25,12 +25,6 @@ + static void cx11646_start(struct usb_spca50x *spca50x); + static void cx11646_stop0(struct usb_spca50x *spca50x); + static void cx11646_stopN(struct usb_spca50x *spca50x); +-static __u16 cx_getbrightness(struct usb_spca50x *spca50x); +-static __u16 cx_getcontrast(struct usb_spca50x *spca50x); +-static __u16 cx_getcolors(struct usb_spca50x *spca50x); +-static void cx_setbrightness(struct usb_spca50x *spca50x); +-static void cx_setcontrast(struct usb_spca50x *spca50x); +-static void cx_setcolors(struct usb_spca50x *spca50x); + static int cx11646_config(struct usb_spca50x *spca50x); + static void cx11646_shutdown(struct usb_spca50x *spca50x); + static void cx11646_setAutobright(struct usb_spca50x *spca50x); +diff -ubwr ./decoder/gspcadecoder.c /usr/ports/luigi/gspca/work-luigi/gspcav1-20070110/decoder/gspcadecoder.c +--- ./decoder/gspcadecoder.c Thu Dec 7 16:54:34 2006 ++++ /usr/ports/luigi/gspca/work-luigi/gspcav1-20070110/decoder/gspcadecoder.c Wed Jan 31 13:30:17 2007 +@@ -304,7 +304,6 @@ + + }; + +-int spca50x_outpicture(struct spca50x_frame *myframe); + + static int jpeg_decode411(struct spca50x_frame *myframe, int force_rgb); + static int jpeg_decode422(struct spca50x_frame *myframe, int force_rgb); +@@ -891,6 +890,7 @@ + *bitfill += 7; + return 0xff; + } ++static + int internal_spca561_decode(int width, int height, unsigned char *inbuf, unsigned char *outbuf) // {{{ + { + // buffers +@@ -1361,6 +1361,7 @@ + + return 0; + } ++static + void decode_spca561(unsigned char *inbuf, char *outbuf, int width, + int height) + { +@@ -1480,6 +1481,7 @@ + dscans[i].dc = 0; + return 0; + } ++static + void + jpeg_reset_input_context(struct dec_data *decode, unsigned char *buf, + int oescap) +@@ -1857,12 +1859,12 @@ + { + unsigned int i, j, k, l; + int tc, th, tt, tac, tdc; +- unsigned char *ptr; ++ const unsigned char *ptr; + unsigned int qIndex = spca50x->qindex; + memcpy(spca50x->maindecode.comps, comp_template, + MAXCOMP * sizeof(struct comp)); + /* set up the huffman table */ +- ptr = (unsigned char *) GsmartJPEGHuffmanTable; ++ ptr = (const unsigned char *) GsmartJPEGHuffmanTable; + l = GSMART_JPG_HUFFMAN_TABLE_LENGTH; + while (l > 0) { + int hufflen[16]; +@@ -1889,7 +1891,7 @@ + } + + /* set up the scan table */ +- ptr = (unsigned char *) GsmartJPEGScanTable; ++ ptr = (const unsigned char *) GsmartJPEGScanTable; + for (i = 0; i < 3; i++) { + spca50x->maindecode.dscans[i].cid = *ptr++; + tdc = *ptr++; +diff -ubwr ./gspca.h /usr/ports/luigi/gspca/work-luigi/gspcav1-20070110/gspca.h +--- ./gspca.h Wed Nov 29 18:24:32 2006 ++++ /usr/ports/luigi/gspca/work-luigi/gspcav1-20070110/gspca.h Wed Jan 31 16:16:43 2007 +@@ -34,7 +34,7 @@ + #define PAC207_ENDPOINT_ADDRESS 5 /* Isoc endpoint number */ + /* only 2 or 4 frames are allowed here !!! */ + #define SPCA50X_NUMFRAMES 2 +-#define SPCA50X_NUMSBUF 2 ++#define SPCA50X_NUMSBUF 4 + #define VENDOR_SONIX 0x0c45 + #define VENDOR_ETOMS 0x102c + #define VENDOR_SUNPLUS 0x04fc +diff -ubwr ./gspca_core.c /usr/ports/luigi/gspca/work-luigi/gspcav1-20070110/gspca_core.c +--- ./gspca_core.c Wed Jan 10 22:22:01 2007 ++++ /usr/ports/luigi/gspca/work-luigi/gspcav1-20070110/gspca_core.c Wed Jan 31 13:30:17 2007 +@@ -32,7 +32,7 @@ + * along with this program; if not, write to the Free Software Foundation, + * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +-static const char version[] = GSPCA_VERSION; ++static const char gspca_version[] = GSPCA_VERSION; + #ifndef AUTOCONF_INCLUDED + #include + #endif +@@ -163,13 +163,6 @@ + static int spca5xx_set_light_freq(struct usb_spca50x *spca50x, int freq); + + static struct usb_driver spca5xx_driver; +-#ifndef max +-static inline int +-max(int a, int b) +-{ +- return (a > b) ? a : b; +-} +-#endif /* max */ + /********************************************************************** + * List of known SPCA50X-based cameras + **********************************************************************/ +@@ -854,7 +847,7 @@ + * FIXME as I don't know how to set the bandwith budget + * we allow the maximum + **/ +-struct usb_host_endpoint * ++static struct usb_host_endpoint * + gspca_set_isoc_ep(struct usb_spca50x *spca50x, int nbalt) + { + int i, j; +@@ -4100,7 +4093,7 @@ + { + if (usb_register(&spca5xx_driver) < 0) + return -1; +- info("gspca driver %s registered", version); ++ info("gspca driver %s registered", gspca_version); + return 0; + } + static void __exit diff --git a/multimedia/linux-gspca-kmod/pkg-descr b/multimedia/linux-gspca-kmod/pkg-descr new file mode 100644 index 000000000000..941efa0a4e73 --- /dev/null +++ b/multimedia/linux-gspca-kmod/pkg-descr @@ -0,0 +1,4 @@ +This port builds a kernel module with the 'gspca' USB webcam driver +using the adaptation layer in devel/linux-kmod-compat +The web site for the original gspca driver (for Linux) is + http://mxhaard.free.fr/index.html diff --git a/multimedia/linux-gspca-kmod/pkg-plist b/multimedia/linux-gspca-kmod/pkg-plist new file mode 100644 index 000000000000..6a3e166a87ec --- /dev/null +++ b/multimedia/linux-gspca-kmod/pkg-plist @@ -0,0 +1,3 @@ +@comment The module is installed in /boot/modules +@cwd /boot/modules +gspca.ko