aboutsummaryrefslogtreecommitdiff
path: root/comms/libticables2
diff options
context:
space:
mode:
authorAlejandro Pulver <alepulver@FreeBSD.org>2006-10-31 18:07:47 +0000
committerAlejandro Pulver <alepulver@FreeBSD.org>2006-10-31 18:07:47 +0000
commitb93e3ea2386c552616fc6c2f2c54afad03f116de (patch)
treefb381ea8998388dc2e6c7c9abae11848bcaa9293 /comms/libticables2
parentd5a3fc65be0d1d0d321482e7f3f77cba273faed1 (diff)
downloadports-b93e3ea2386c552616fc6c2f2c54afad03f116de.tar.gz
ports-b93e3ea2386c552616fc6c2f2c54afad03f116de.zip
Notes
Diffstat (limited to 'comms/libticables2')
-rw-r--r--comms/libticables2/Makefile47
-rw-r--r--comms/libticables2/distinfo3
-rw-r--r--comms/libticables2/files/patch-silver78
-rw-r--r--comms/libticables2/files/patch-src-bsd-link_gry.c104
-rw-r--r--comms/libticables2/files/patch-src-bsd-link_ser.c39
-rw-r--r--comms/libticables2/pkg-descr7
-rw-r--r--comms/libticables2/pkg-plist11
7 files changed, 289 insertions, 0 deletions
diff --git a/comms/libticables2/Makefile b/comms/libticables2/Makefile
new file mode 100644
index 000000000000..92844656f322
--- /dev/null
+++ b/comms/libticables2/Makefile
@@ -0,0 +1,47 @@
+# New ports collection makefile for: libticables2
+# Date created: 11 October 2006
+# Whom: Tijl Coosemans <tijl@ulyssis.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= libticables2
+PORTVERSION= 1.0.0
+CATEGORIES= comms
+MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
+MASTER_SITE_SUBDIR= gtktiemu
+DISTNAME= ${PORTNAME}-20060925
+
+MAINTAINER= tijl@ulyssis.org
+COMMENT= TI calculator link cables library
+
+LIB_DEPENDS= usb-0.1.8:${PORTSDIR}/devel/libusb
+
+WRKSRC= ${WRKDIR}/libticables
+
+USE_AUTOTOOLS= libtool:15
+USE_BZIP2= yes
+USE_GMAKE= yes
+USE_GNOME= glib20 gnomehack pkgconfig
+USE_LDCONFIG= yes
+
+.if !defined(WITHOUT_NLS)
+USE_GETTEXT= yes
+PLIST_SUB= NLS=""
+.else
+CONFIGURE_ARGS= --disable-nls
+PLIST_SUB= NLS="@comment "
+.endif
+
+CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include"\
+ LDFLAGS="-L${LOCALBASE}/lib"
+
+.include <bsd.port.pre.mk>
+
+.if ${OSVERSION} < 500000
+post-patch:
+ @${REINPLACE_CMD} -e 's|<stdint\.h>|<inttypes.h>|' \
+ ${WRKSRC}/src/linux/ioports.c
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/comms/libticables2/distinfo b/comms/libticables2/distinfo
new file mode 100644
index 000000000000..1e3c3afcecf6
--- /dev/null
+++ b/comms/libticables2/distinfo
@@ -0,0 +1,3 @@
+MD5 (libticables2-20060925.tar.bz2) = ced32aaebb4ef940f781d20919887a69
+SHA256 (libticables2-20060925.tar.bz2) = 065b8423f7b0f73f46bf8fddb218330bba51d4aabd7585ebb9199623015c58c7
+SIZE (libticables2-20060925.tar.bz2) = 507489
diff --git a/comms/libticables2/files/patch-silver b/comms/libticables2/files/patch-silver
new file mode 100644
index 000000000000..7c71e3dcc6a5
--- /dev/null
+++ b/comms/libticables2/files/patch-silver
@@ -0,0 +1,78 @@
+Index: src/ticables.c
+===================================================================
+--- src/ticables.c (revision 2995)
++++ src/ticables.c (working copy)
+@@ -33,6 +33,9 @@
+ #ifdef __LINUX__
+ #include <sys/utsname.h>
+ #endif
++#if defined(HAVE_LIBUSB)
++#include <usb.h>
++#endif
+
+ #include "gettext.h"
+ #include "ticables.h"
+@@ -140,6 +143,10 @@
+ ticables_info("kernel: %s", buf.release);
+ }
+ #endif
++#if defined(HAVE_LIBUSB)
++ /* init the libusb */
++ usb_init();
++#endif
+
+ return (++ticables_instance);
+ }
+Index: src/linux/link_slv.c
+===================================================================
+--- src/linux/link_slv.c (revision 2995)
++++ src/linux/link_slv.c (working copy)
+@@ -245,11 +245,11 @@
+ han = usb_open(dev);
+ ret = usb_get_string_simple(han, dev->descriptor.iProduct,
+ string, sizeof(string));
++ usb_close(han);
+ if (ret > 0)
+ return string;
+ else
+ return "";
+- usb_close(han);
+ }
+
+ return string;
+@@ -276,7 +276,7 @@
+ if(dev->descriptor.idProduct == tigl_infos[i].pid)
+ {
+ ticables_info(" found <%s> on #%i, version <%x.%02x>",
+- tigl_get_product(dev), j+1,
++ /*tigl_get_product(dev)*/ "", j+1,
+ dev->descriptor.bcdDevice >> 8,
+ dev->descriptor.bcdDevice & 0xff);
+
+@@ -296,9 +296,6 @@
+ {
+ int ret = 0;
+
+- /* init the libusb */
+- usb_init();
+-
+ /* find all usb busses on the system */
+ ret = usb_find_busses();
+ if (ret < 0)
+@@ -480,6 +477,7 @@
+
+ static int slv_reset(CableHandle *h)
+ {
++#if !defined(__BSD__)
+ /* Reset both endpoints */
+ #ifdef SLV_RESET
+ TRYC(tigl_reset(uHdl));
+@@ -487,7 +485,7 @@
+ TRYC(slv_close(h));
+ TRYC(slv_open(h));
+ #endif
+-
++#endif
+ return 0;
+ }
+
diff --git a/comms/libticables2/files/patch-src-bsd-link_gry.c b/comms/libticables2/files/patch-src-bsd-link_gry.c
new file mode 100644
index 000000000000..de67b3114e68
--- /dev/null
+++ b/comms/libticables2/files/patch-src-bsd-link_gry.c
@@ -0,0 +1,104 @@
+--- src/bsd/link_gry.c.orig Wed Oct 11 15:19:24 2006
++++ src/bsd/link_gry.c Wed Oct 11 16:26:38 2006
+@@ -51,10 +51,10 @@
+
+ switch(h->port)
+ {
+- case PORT_1: h->address = 0x3f8; h->device = strdup("/dev/cuaa0"); break;
+- case PORT_2: h->address = 0x2f8; h->device = strdup("/dev/cuaa1"); break;
+- case PORT_3: h->address = 0x3e8; h->device = strdup("/dev/cuaa2"); break;
+- case PORT_4: h->address = 0x3e8; h->device = strdup("/dev/cuaa3"); break;
++ case PORT_1: h->address = 0x3f8; h->device = strdup("/dev/cuad0"); break;
++ case PORT_2: h->address = 0x2f8; h->device = strdup("/dev/cuad1"); break;
++ case PORT_3: h->address = 0x3e8; h->device = strdup("/dev/cuad2"); break;
++ case PORT_4: h->address = 0x3e8; h->device = strdup("/dev/cuad3"); break;
+ default: return ERR_ILLEGAL_ARG;
+ }
+ h->priv2 = (struct termios *)calloc(1, sizeof(struct termios));
+@@ -93,9 +93,15 @@
+ termset->c_cflag = CS8 | CLOCAL | CREAD;
+ termset->c_lflag = 0;
+ #endif
++ termset->c_cc[VMIN] = 0;
++ termset->c_cc[VTIME] = h->timeout;
+
+ cfsetispeed(termset, B9600);
+ cfsetospeed(termset, B9600);
++ tcsetattr(dev_fd, TCSANOW, termset);
++
++ if(tcflush(dev_fd, TCIOFLUSH) == -1)
++ return ERR_FLUSH_ERROR;
+
+ return 0;
+ }
+@@ -111,31 +117,18 @@
+
+ static int gry_reset(CableHandle *h)
+ {
+- uint8_t unused[1024];
+- int n;
+-
+- /* Flush the input */
+- termset->c_cc[VMIN] = 0;
+- termset->c_cc[VTIME] = 0;
+- tcsetattr(dev_fd, TCSANOW, termset);
+- do
+- {
+- n = read(dev_fd, (void *) unused, 1024);
+- } while ((n != 0) && (n != -1));
+-
+- /* and set/restore the timeout */
+- termset->c_cc[VTIME] = h->timeout;
+- tcsetattr(dev_fd, TCSANOW, termset);
++ if(tcflush(dev_fd, TCIOFLUSH) == -1)
++ return ERR_FLUSH_ERROR;
+
+ return 0;
+ }
+
+ static int gry_put(CableHandle* h, uint8_t *data, uint32_t len)
+ {
+- int err;
++ ssize_t ret;
+
+- err = write(dev_fd, (void *)data, len);
+- switch (err)
++ ret = write(dev_fd, (void *)data, len);
++ switch (ret)
+ {
+ case -1: //error
+ return ERR_WRITE_ERROR;
+@@ -150,19 +143,24 @@
+
+ static int gry_get(CableHandle* h, uint8_t *data, uint32_t len)
+ {
+- int err;
++ ssize_t ret;
++ ssize_t i;
+
+ tcdrain(dev_fd); // waits for all output written
+
+- err = read(dev_fd, (void *)data, len);
+- switch (err)
++ for(i = 0; i < len; )
+ {
+- case -1: //error
+- return ERR_READ_ERROR;
+- break;
+- case 0: // timeout
+- return ERR_READ_TIMEOUT;
+- break;
++ ret = read(dev_fd, (void *)(data+i), len - i);
++ switch (ret)
++ {
++ case -1: //error
++ return ERR_READ_ERROR;
++ break;
++ case 0: // timeout
++ return ERR_READ_TIMEOUT;
++ break;
++ }
++ i += ret;
+ }
+
+ return 0;
diff --git a/comms/libticables2/files/patch-src-bsd-link_ser.c b/comms/libticables2/files/patch-src-bsd-link_ser.c
new file mode 100644
index 000000000000..bfbaa28902a3
--- /dev/null
+++ b/comms/libticables2/files/patch-src-bsd-link_ser.c
@@ -0,0 +1,39 @@
+--- src/bsd/link_ser.c.orig Wed Oct 11 15:11:06 2006
++++ src/bsd/link_ser.c Wed Oct 11 15:12:04 2006
+@@ -26,6 +26,7 @@
+ #endif
+
+ #include <stdio.h>
++#include <stdlib.h>
+ #include <string.h>
+
+ #include "../ticables.h"
+@@ -39,21 +40,23 @@
+
+ static int ser_prepare(CableHandle *h)
+ {
++ int ret;
++
+ switch(h->port)
+ {
+- case PORT_1: h->address = 0x3f8; h->device = strdup("/dev/cuaa0");
++ case PORT_1: h->address = 0x3f8; h->device = strdup("/dev/cuad0");
+ break;
+- case PORT_2: h->address = 0x2f8; h->device = strdup("/dev/cuaa1");
++ case PORT_2: h->address = 0x2f8; h->device = strdup("/dev/cuad1");
+ break;
+- case PORT_3: h->address = 0x3e8; h->device = strdup("/dev/cuaa2");
++ case PORT_3: h->address = 0x3e8; h->device = strdup("/dev/cuad2");
+ break;
+- case PORT_4: h->address = 0x3e8; h->device = strdup("/dev/cuaa3");
++ case PORT_4: h->address = 0x3e8; h->device = strdup("/dev/cuad3");
+ break;
+ default: return ERR_ILLEGAL_ARG;
+ }
+
+ // detect stuffs
+- err = check_for_tty(h->device));
++ ret = check_for_tty(h->device);
+ if(ret)
+ {
+ free(h->device); h->device = NULL;
diff --git a/comms/libticables2/pkg-descr b/comms/libticables2/pkg-descr
new file mode 100644
index 000000000000..c98778c8eb01
--- /dev/null
+++ b/comms/libticables2/pkg-descr
@@ -0,0 +1,7 @@
+The ticables library is a library to handle the various TI calculator
+link cables.
+
+WWW: http://tilp.info/
+
+- Tijl Coosemans
+tijl@ulyssis.org
diff --git a/comms/libticables2/pkg-plist b/comms/libticables2/pkg-plist
new file mode 100644
index 000000000000..54448fda9a3a
--- /dev/null
+++ b/comms/libticables2/pkg-plist
@@ -0,0 +1,11 @@
+include/tilp2/export1.h
+include/tilp2/stdints1.h
+include/tilp2/ticables.h
+include/tilp2/timeout.h
+lib/libticables2.a
+lib/libticables2.la
+lib/libticables2.so
+lib/libticables2.so.1
+libdata/pkgconfig/ticables2.pc
+%%NLS%%share/locale/fr/LC_MESSAGES/libticables2.mo
+@dirrmtry include/tilp2