Date: Fri, 10 Aug 2001 16:30:52 +0900 (JST) From: Yoichi NAKAYAMA <yoichi@eken.phys.nagoya-u.ac.jp> To: FreeBSD-gnats-submit@freebsd.org Cc: Yoichi NAKAYAMA <yoichi@eken.phys.nagoya-u.ac.jp> Subject: ports/29591: fix port: graphics/picturebook Message-ID: <200108100730.f7A7Uqi05267@e-ppp4.eken.phys.nagoya-u.ac.jp>
next in thread | raw e-mail | index | archive | help
>Number: 29591 >Category: ports >Synopsis: fix port: graphics/picturebook >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Aug 10 00:40:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Yoichi NAKAYAMA >Release: FreeBSD 4.3-STABLE i386 >Organization: E-ken, Dept. of Physics, Nagoya University, JAPAN >Environment: >Description: This is a fix for ports/graphics/picturebook to install setbrightness, vaiobat with patches(patch-ba, patch-bb) contributed by Hiroshi TOKUDA <tokudah@nttdata.co.jp> and add some fixes appeared in bsd-nomads mailing list. I've tested those on SONY PCG-C1VSX/K with FreeBSD-current. btw, on my machine, when I turn the camera to opposite direction while capture -s, sometimes capture mode changes although I don't touch the jogdial. >How-To-Repeat: >Fix: diff -ruN picturebook/Makefile picturebook.new/Makefile --- picturebook/Makefile Wed Apr 25 02:13:23 2001 +++ picturebook.new/Makefile Mon Jul 30 14:58:05 2001 @@ -7,6 +7,7 @@ PORTNAME= picturebook PORTVERSION= 20010422 +PORTREVISION= 1 CATEGORIES= graphics MASTER_SITES= http://samba.org/picturebook/ DISTNAME= capture @@ -16,8 +17,13 @@ WRKSRC= ${WRKDIR}/picturebook USE_IMLIB=yes +post-build: + (cd ${WRKSRC}; ${CC} -o setbrightness setbrightness.c; \ + ${CC} -o vaiobat vaiobat.c) do-install: ${INSTALL_PROGRAM} ${WRKSRC}/capture ${PREFIX}/bin/capture + ${INSTALL_PROGRAM} ${WRKSRC}/setbrightness ${PREFIX}/sbin/setbrightness + ${INSTALL_PROGRAM} ${WRKSRC}/vaiobat ${PREFIX}/sbin/vaiobat ${MKDIR} ${PREFIX}/share/doc/picturebook ${INSTALL_MAN} ${WRKSRC}/README ${PREFIX}/share/doc/picturebook/README .if!defined(NOPORTDOCS) diff -ruN picturebook/files/patch-ba picturebook.new/files/patch-ba --- picturebook/files/patch-ba Thu Jan 1 09:00:00 1970 +++ picturebook.new/files/patch-ba Mon Jul 30 14:48:17 2001 @@ -0,0 +1,92 @@ +--- setbrightness.c.orig Tue Dec 12 09:42:20 2000 ++++ setbrightness.c Mon Jul 30 14:29:54 2001 +@@ -4,17 +4,47 @@ + #include <unistd.h> + #include <fcntl.h> + #include <errno.h> ++#ifdef LINUX + #include <sys/io.h> ++#endif + #include <sys/mman.h> + #include <dirent.h> + #include <ctype.h> ++#ifdef LINUX + #include <malloc.h> ++#endif + #include <string.h> + #include <signal.h> ++#ifdef HAVE_GETOPT_H + #include <getopt.h> ++#endif ++#ifdef LINUX + #include <linux/pci.h> ++#endif + #include <sys/time.h> + ++#ifdef __FreeBSD__ ++#include <machine/cpufunc.h> ++static int deviofd=-1; ++static int iopl(int lvl) ++{ ++ if(lvl==0){ ++ if(deviofd!=-1){ ++ close(deviofd); ++ deviofd=-1; ++ } ++ return 0; ++ }else if(lvl==3){ ++ if(deviofd==-1){ ++ deviofd=open("/dev/io",0); ++ } ++ return deviofd; ++ } ++ return -1; ++} ++ ++#endif ++ + + #define DATA_REG 0x62 + #define CST_REG 0x66 +@@ -24,28 +54,35 @@ + static void ecr_set(u16 addr, u16 value) + { + while (inw(CST_REG) & 3) usleep(1); +- outw(0x81, CST_REG); ++ outw(CST_REG, 0x81); + while (inw(CST_REG) & 2) usleep(1); +- outw(addr, DATA_REG); ++ outw(DATA_REG, addr); + while (inw(CST_REG) & 2) usleep(1); +- outw(value, DATA_REG); ++ outw(DATA_REG, value); + while (inw(CST_REG) & 2) usleep(1); + } + + static u16 ecr_get(u16 addr) + { + while (inw(CST_REG) & 3) usleep(1); +- outb(0x80, CST_REG); ++ outb(CST_REG, 0x80); + while (inw(CST_REG) & 2) usleep(1); +- outb(addr, DATA_REG); ++ outb(DATA_REG, addr); + while (inw(CST_REG) & 2) usleep(1); + return inw(DATA_REG); + } + + int main(int argc, char *argv[]) + { ++ if(open("/dev/io", O_RDWR, 0) < 0) ++ { ++ perror("/dev/io"); ++ return 1; ++ } + iopl(3); + printf("currently %x\n", ecr_get(0x96)); +- ecr_set(0x96, atoi(argv[1])); ++ if ( argv[1] != NULL ){ ++ ecr_set(0x96, atoi(argv[1])); ++ } + return 0; + } diff -ruN picturebook/files/patch-bb picturebook.new/files/patch-bb --- picturebook/files/patch-bb Thu Jan 1 09:00:00 1970 +++ picturebook.new/files/patch-bb Mon Jul 30 14:51:04 2001 @@ -0,0 +1,79 @@ +--- vaiobat.c Tue Dec 12 09:42:20 2000 ++++ vaiobat.c Wed Mar 21 20:16:59 2001 +@@ -4,18 +4,50 @@ + #include <unistd.h> + #include <fcntl.h> + #include <errno.h> ++#ifdef LINUX + #include <sys/io.h> ++#endif + #include <sys/mman.h> + #include <dirent.h> + #include <ctype.h> ++#ifdef LINUX + #include <malloc.h> ++#endif + #include <string.h> + #include <signal.h> ++#ifdef HAVE_GETOPT_H + #include <getopt.h> ++#endif ++#ifdef LINUX + #include <linux/pci.h> ++#endif + #include <sys/time.h> + + ++ ++#ifdef __FreeBSD__ ++#include <machine/cpufunc.h> ++static int deviofd=-1; ++static int iopl(int lvl) ++{ ++ if(lvl==0){ ++ if(deviofd!=-1){ ++ close(deviofd); ++ deviofd=-1; ++ } ++ return 0; ++ }else if(lvl==3){ ++ if(deviofd==-1){ ++ deviofd=open("/dev/io",0); ++ } ++ return deviofd; ++ } ++ return -1; ++} ++ ++#endif ++ ++ + #define DATA_REG 0x62 + #define CST_REG 0x66 + +@@ -25,20 +57,20 @@ + static void ecr_set(u8 addr, u8 value) + { + while (inb(CST_REG) & 3) usleep(1); +- outb(0x81, CST_REG); ++ outb(CST_REG, 0x81); + while (inb(CST_REG) & 2) usleep(1); +- outb(addr, DATA_REG); ++ outb(DATA_REG, addr); + while (inb(CST_REG) & 2) usleep(1); +- outb(value, DATA_REG); ++ outb(DATA_REG, value); + while (inb(CST_REG) & 2) usleep(1); + } + + static u8 ecr_get(u8 addr) + { + while (inb(CST_REG) & 3) usleep(1); +- outb(0x80, CST_REG); ++ outb(CST_REG, 0x80); + while (inb(CST_REG) & 2) usleep(1); +- outb(addr, DATA_REG); ++ outb(DATA_REG, addr); + while (inb(CST_REG) & 2) usleep(1); + return inb(DATA_REG); + } diff -ruN picturebook/pkg-descr picturebook.new/pkg-descr --- picturebook/pkg-descr Wed Apr 25 02:13:23 2001 +++ picturebook.new/pkg-descr Mon Jul 30 14:44:07 2001 @@ -1,2 +1,8 @@ Picturebook is an experimental utility for capturing from SONY VAIO camera. +This port includes following binaries + capture / capture utility for VAIO camera + setbrightness / LCD brightness control tool + (usage: setbrightness [0-255]) + vaiobat / get battery status + WWW: http://samba.org/picturebook/ diff -ruN picturebook/pkg-plist picturebook.new/pkg-plist --- picturebook/pkg-plist Wed Apr 25 02:13:23 2001 +++ picturebook.new/pkg-plist Mon Jul 30 14:54:08 2001 @@ -1,4 +1,6 @@ bin/capture +sbin/setbrightness +sbin/vaiobat share/doc/picturebook/README share/doc/picturebook/README.FreeBSD @dirrm share/doc/picturebook >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200108100730.f7A7Uqi05267>