pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/sysutils/i810switch Utility to switch on and off the l...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/4a880a5410ed
branches:  trunk
changeset: 522138:4a880a5410ed
user:      christos <christos%pkgsrc.org@localhost>
date:      Mon Dec 04 04:42:03 2006 +0000

description:
Utility to switch on and off the lcd and external crt for intel 8xx graphics
chips.

diffstat:

 sysutils/i810switch/DESCR            |    2 +
 sysutils/i810switch/Makefile         |   16 ++
 sysutils/i810switch/PLIST            |    5 +
 sysutils/i810switch/distinfo         |    8 +
 sysutils/i810switch/patches/patch-aa |   40 ++++++
 sysutils/i810switch/patches/patch-ab |   24 ++++
 sysutils/i810switch/patches/patch-ac |  207 +++++++++++++++++++++++++++++++++++
 7 files changed, 302 insertions(+), 0 deletions(-)

diffs (truncated from 330 to 300 lines):

diff -r fad8e2b3a84a -r 4a880a5410ed sysutils/i810switch/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/i810switch/DESCR Mon Dec 04 04:42:03 2006 +0000
@@ -0,0 +1,2 @@
+Control the External CRT and LCD display on 810/855/865/915 Intel
+graphics chips.
diff -r fad8e2b3a84a -r 4a880a5410ed sysutils/i810switch/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/i810switch/Makefile      Mon Dec 04 04:42:03 2006 +0000
@@ -0,0 +1,16 @@
+# $NetBSD: Makefile,v 1.1 2006/12/04 04:42:03 christos Exp $
+#
+
+DISTNAME=      i810switch-0.6.5
+CATEGORIES=    sysutils
+MASTER_SITES=  http://www16.plala.or.jp/mano-a-mano/i810switch/
+
+MAINTAINER=    christos%NetBSD.org@localhost
+HOMEPAGE=      http://www16.plala.or.jp/mano-a-mano/i810switch/
+COMMENT=       Switch LCD/CRT 855/865/915 Intel chips
+
+ONLY_FOR_PLATFORM=     NetBSD-*-i386 NetBSD-*-x86_64 Linux-*-i386
+
+.include "../../mk/bsd.prefs.mk"
+
+.include "../../mk/bsd.pkg.mk"
diff -r fad8e2b3a84a -r 4a880a5410ed sysutils/i810switch/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/i810switch/PLIST Mon Dec 04 04:42:03 2006 +0000
@@ -0,0 +1,5 @@
+@comment $NetBSD: PLIST,v 1.1 2006/12/04 04:42:03 christos Exp $
+sbin/i810switch
+sbin/i810rotate
+man/man1/i810switch.1
+man/man1/i810rotate.1
diff -r fad8e2b3a84a -r 4a880a5410ed sysutils/i810switch/distinfo
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/i810switch/distinfo      Mon Dec 04 04:42:03 2006 +0000
@@ -0,0 +1,8 @@
+$NetBSD: distinfo,v 1.1 2006/12/04 04:42:03 christos Exp $
+
+SHA1 (i810switch-0.6.5.tar.gz) = 437adeb38f6530b5e68810fc5ee65fb5adaafd97
+RMD160 (i810switch-0.6.5.tar.gz) = 4acaea0c7c4197cdff30885a51f65cda3d3a6df9
+Size (i810switch-0.6.5.tar.gz) = 24287 bytes
+SHA1 (patch-aa) = b4c7d7ab390e62d44ad08d9d15ce21748e6c46b8
+SHA1 (patch-ab) = 2f1635cc81e409043a6cd63d0609983428564f68
+SHA1 (patch-ac) = 7fab3fadeaabb34372a63b8bd0b7f10492a7fffe
diff -r fad8e2b3a84a -r 4a880a5410ed sysutils/i810switch/patches/patch-aa
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/i810switch/patches/patch-aa      Mon Dec 04 04:42:03 2006 +0000
@@ -0,0 +1,40 @@
+$NetBSD: patch-aa,v 1.1 2006/12/04 04:42:03 christos Exp $
+--- Makefile.orig      2003-12-31 09:51:40.000000000 -0500
++++ Makefile   2006-12-03 23:40:16.000000000 -0500
+@@ -1,7 +1,4 @@
+-OBJECTS       = i810switch.o
+-
+-%.o: %.c
+-      $(CC) $(CFLAGS) -c -o $@ $<
++OBJECTS       = i810switch.o getline.o
+ 
+ all: i810switch
+ 
+@@ -9,16 +6,19 @@
+       $(CC) $(CFLAGS) -o $@ $(OBJECTS)
+ 
+ install: i810switch
+-      install -d $(DESTDIR)/usr/bin
+-      install -d $(DESTDIR)/usr/share/man/man1
+-      install i810switch i810rotate $(DESTDIR)/usr/bin
+-      install i810switch.1.gz i810rotate.1.gz $(DESTDIR)/usr/share/man/man1
++      install -d $(PREFIX)/bin
++      install -d $(PREFIX)/man/man1
++      install i810switch $(PREFIX)/sbin
++      ln $(PREFIX)/sbin/i810switch $(PREFIX)/sbin/i810rotate
++      install i810switch.1.gz i810rotate.1.gz $(PREFIX)/man/man1
++      gunzip $(PREFIX)/man/man1/i810switch.1.gz
++      gunzip $(PREFIX)/man/man1/i810rotate.1.gz
+ 
+ uninstall:
+-      rm -f $(DESTDIR)/usr/bin/i810switch
+-      rm -f $(DESTDIR)/usr/bin/i810rotate
+-      rm -f $(DESTDIR)/usr/share/man/man1/i810switch.1.gz
+-      rm -f $(DESTDIR)/usr/share/man/man1/i810rotate.1.gz
++      rm -f $(PREFIX)/usr/bin/i810switch
++      rm -f $(PREFIX)/usr/bin/i810rotate
++      rm -f $(PREFIX)/usr/share/man/man1/i810switch.1.gz
++      rm -f $(PREFIX)/usr/share/man/man1/i810rotate.1.gz
+ 
+ clean:
+       @rm -f $(OBJECTS) i810switch
diff -r fad8e2b3a84a -r 4a880a5410ed sysutils/i810switch/patches/patch-ab
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/i810switch/patches/patch-ab      Mon Dec 04 04:42:03 2006 +0000
@@ -0,0 +1,24 @@
+$NetBSD: patch-ab,v 1.1 2006/12/04 04:42:03 christos Exp $
+--- getline.c  1969-12-31 19:00:00.000000000 -0500
++++ getline.c  2006-12-03 23:16:23.000000000 -0500
+@@ -0,0 +1,20 @@
++#include <stdio.h>
++#ifdef __NetBSD__
++int
++getline(char **buf, size_t *len, FILE *fp)
++{
++      static char *b;
++      if (b)
++              free(b);
++      for (;;) {
++              if ((*buf = fparseln(fp, len, NULL, NULL, 0)) == NULL)
++                      return 0;
++              if (*len == 0) {
++                      free(*buf);
++                      continue;
++              }
++              b = *buf;
++              return *len;
++      }
++}
++#endif
diff -r fad8e2b3a84a -r 4a880a5410ed sysutils/i810switch/patches/patch-ac
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/i810switch/patches/patch-ac      Mon Dec 04 04:42:03 2006 +0000
@@ -0,0 +1,207 @@
+$NetBSD: patch-ac,v 1.1 2006/12/04 04:42:03 christos Exp $
+--- i810switch.c       2005-06-12 00:36:36.000000000 -0400
++++ i810switch.c       2006-12-03 23:12:44.000000000 -0500
+@@ -1,3 +1,4 @@
++#include <assert.h>
+ #include <stdarg.h>
+ #include <stdlib.h>
+ #include <fcntl.h>
+@@ -9,7 +10,11 @@
+ #include <errno.h>
+ 
+ #define VERSION "0.6.5beta"
++#ifdef __NetBSD__
++#define CMD_LSPCI "pcictl /dev/pci0"
++#else
+ #define CMD_LSPCI "lspci"
++#endif
+ 
+ static const char *Opt_lcd = NULL;
+ static const char *Opt_crt = NULL;
+@@ -49,19 +54,31 @@
+ 
+ 
+ /* PCI IDs */
+-#define I810STR                       "8086:7121"
+-#define I810ESTR              "8086:7123"
+-#define I810_DC100STR_1               "8086:7125"
+-#define I810_DC100STR_2               "8086:1102"
+-#define I810_IGSTR            "8086:1112"
+-#define I810_CFCSTR           "8086:1132"
+-#define I830STR                       "8086:3577"
+-#define I845STR                       "8086:2562"
+-#define I855STR                       "8086:3582"
+-//#define I865STR                     "8086:2572"
+-#define I915STR                       "8086:2592"
+-#define MEMSTR                        "Memory at"
++static const struct {
++      char *id;
++      int type;
++} i8xx[] = {
++/* I810STR */         { "7121", I810 },
++/* I810ESTR */                { "7123", I810 },
++/* I810_DC100STR_1 */ { "7125", I810 },
++/* I810_DC100STR_2 */ { "1102", I810 },
++/* I810_IGSTR */      { "1112", I810 },
++/* I810_CFCSTR */     { "1132", I810 },
++/* I830STR */         { "3577", I830 },
++/* I845STR */         { "2562", I855 },
++/* I855STR */         { "3582", I855 },
++/* I865STR            { "2572", I865 }, */
++/* I915STR */         { "2592", I915 },
++                      { NULL, 0 },
++};
++
++#ifdef __NetBSD__
++#define NONPRSTR              "32-bit nonprefetchable memory"
++#define MEMSTR                        "base:"
++#else
+ #define NONPRSTR              "32-bit, non-prefetchable"
++#define MEMSTR                        "Memory at"
++#endif
+ 
+ /* I810 registers */
+ #define I810_HVSYNC           0x05000 
+@@ -247,43 +264,25 @@
+ {
+       int i;
+       char *p;
++      char buf[10];
+ 
+       while (getline(buff_ptr, len_ptr, pci_f) > 0) {
+-              i = (p = strstr(*buff_ptr, I810STR)) != NULL ||
+-                      (p = strstr(*buff_ptr, I810ESTR)) != NULL ||
+-                      (p = strstr(*buff_ptr, I810_DC100STR_1)) != NULL ||
+-                      (p = strstr(*buff_ptr, I810_DC100STR_2)) != NULL ||
+-                      (p = strstr(*buff_ptr, I810_IGSTR)) != NULL ||
+-                      (p = strstr(*buff_ptr, I810_CFCSTR)) != NULL;
+-              if (i)
+-              {
+-                      *chiptype = I810;
+-                      return p;
+-              }
+-
+-              i = (p = strstr(*buff_ptr, I830STR)) != NULL ||
+-#if defined (I865STR)
+-                      (p = strstr(*buff_ptr, I865STR)) != NULL ||
+-#endif /*defined (I865STR)*/
+-                      (p = strstr(*buff_ptr, I845STR)) != NULL;
+-              if (i)
+-              {
+-                      *chiptype = I830;
+-                      return p;
+-              }
+-
+-              i = (p = strstr(*buff_ptr, I855STR)) != NULL;
+-              if (i)
+-              {
+-                      *chiptype = I855;
+-                      return p;
+-              }
+-
+-              i = (p = strstr(*buff_ptr, I915STR)) != NULL;
+-              if (i)
+-              {
+-                      *chiptype = I915;
++              for (i = 0; i8xx[i].id != NULL; i++) {
++#ifdef __NetBSD__
++                      snprintf(buf, sizeof(buf), "%s8086", i8xx[i].id);
++#else
++                      snprintf(buf, sizeof(buf), "8086:%s", i8xx[i].id);
++#endif
++                      if ((p = strstr(*buff_ptr, buf)) != NULL)
++                              break;
++              }
++              if (i8xx[i].id) {
++                      *chiptype = i8xx[i].type;
++#ifdef __NetBSD__
++                      return *buff_ptr;
++#else
+                       return p;
++#endif
+               }
+       }
+       return NULL;
+@@ -293,12 +292,16 @@
+ {
+       char *p;
+ 
+-      while (getline(buff_ptr, len_ptr, pci_f) > 0)
++      while (getline(buff_ptr, len_ptr, pci_f) > 0) {
+               if (strstr(*buff_ptr, NONPRSTR) != NULL) {
++#ifdef __NetBSD__
++                      assert(getline(buff_ptr, len_ptr, pci_f) > 0);
++#endif
+                       p = strstr(*buff_ptr, MEMSTR);
+                       if (p != NULL)
+                               return strtoul(p+sizeof(MEMSTR), NULL, 16);
+               }
++      }
+       return 0;
+ }
+ 
+@@ -319,7 +322,11 @@
+       int i, crt = -1, lcd = -1, probe = 0, err = 0, count = 0, chiptype, len = 0;
+       FILE *pci_f;
+       char *buff = NULL;
++#ifdef __NetBSD__
++      char lspcistr[] = CMD_LSPCI " dump -d %d -f %d";
++#else
+       char lspcistr[] = CMD_LSPCI " -v -d xxxx:xxxx";
++#endif
+       char *chip;
+ 
+       putenv("PATH=/sbin:/usr/sbin:/bin:/usr/bin");
+@@ -357,7 +364,11 @@
+               }
+       }
+ 
+-      pci_f = popen(CMD_LSPCI " -n", "r");
++      pci_f = popen(CMD_LSPCI 
++#ifdef __NetBSD__
++                      " list"
++#endif
++                      " -n", "r");
+       if (!pci_f) {
+               fprintf(stderr, "Something is wrong with lspci.\n");
+               exit(1);
+@@ -369,6 +380,19 @@
+       }
+       pclose(pci_f);
+ 
++#ifdef __NetBSD__
++      {
++              char cmd[100];
++              int dev = -1, fun = -1;
++              sscanf(chip, "000:%d:%d:", &dev, &fun);
++              if (dev == -1 || fun == -1) {



Home | Main Index | Thread Index | Old Index