Date: Sat, 14 Oct 2006 15:26:28 +0200 (CEST) From: Tijl Coosemans <tijl@ulyssis.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/104409: [new port] comms/libticables2: TI calculator link cables lib Message-ID: <200610141326.k9EDQSKM001886@kalimero.kotnet.org> Resent-Message-ID: <200610141330.k9EDUNcM069531@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 104409 >Category: ports >Synopsis: [new port] comms/libticables2: TI calculator link cables lib >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sat Oct 14 13:30:23 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Tijl Coosemans >Release: FreeBSD 7.0-CURRENT i386 >Organization: >Environment: >Description: vesion 1.0.0 of libticables2. (the existing comms/libticables will eventually be removed.) >How-To-Repeat: >Fix: --- libticables2.shar begins here --- # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # libticables2 # libticables2/files # libticables2/files/patch-src-bsd-link_ser.c # libticables2/files/patch-src-bsd-link_gry.c # libticables2/files/patch-silver # libticables2/Makefile # libticables2/distinfo # libticables2/pkg-descr # libticables2/pkg-plist # echo c - libticables2 mkdir -p libticables2 > /dev/null 2>&1 echo c - libticables2/files mkdir -p libticables2/files > /dev/null 2>&1 echo x - libticables2/files/patch-src-bsd-link_ser.c sed 's/^X//' >libticables2/files/patch-src-bsd-link_ser.c << 'END-of-libticables2/files/patch-src-bsd-link_ser.c' X--- src/bsd/link_ser.c.orig Wed Oct 11 15:11:06 2006 X+++ src/bsd/link_ser.c Wed Oct 11 15:12:04 2006 X@@ -26,6 +26,7 @@ X #endif X X #include <stdio.h> X+#include <stdlib.h> X #include <string.h> X X #include "../ticables.h" X@@ -39,21 +40,23 @@ X X static int ser_prepare(CableHandle *h) X { X+ int ret; X+ X switch(h->port) X { X- case PORT_1: h->address = 0x3f8; h->device = strdup("/dev/cuaa0"); X+ case PORT_1: h->address = 0x3f8; h->device = strdup("/dev/cuad0"); X break; X- case PORT_2: h->address = 0x2f8; h->device = strdup("/dev/cuaa1"); X+ case PORT_2: h->address = 0x2f8; h->device = strdup("/dev/cuad1"); X break; X- case PORT_3: h->address = 0x3e8; h->device = strdup("/dev/cuaa2"); X+ case PORT_3: h->address = 0x3e8; h->device = strdup("/dev/cuad2"); X break; X- case PORT_4: h->address = 0x3e8; h->device = strdup("/dev/cuaa3"); X+ case PORT_4: h->address = 0x3e8; h->device = strdup("/dev/cuad3"); X break; X default: return ERR_ILLEGAL_ARG; X } X X // detect stuffs X- err = check_for_tty(h->device)); X+ ret = check_for_tty(h->device); X if(ret) X { X free(h->device); h->device = NULL; END-of-libticables2/files/patch-src-bsd-link_ser.c echo x - libticables2/files/patch-src-bsd-link_gry.c sed 's/^X//' >libticables2/files/patch-src-bsd-link_gry.c << 'END-of-libticables2/files/patch-src-bsd-link_gry.c' X--- src/bsd/link_gry.c.orig Wed Oct 11 15:19:24 2006 X+++ src/bsd/link_gry.c Wed Oct 11 16:26:38 2006 X@@ -51,10 +51,10 @@ X X switch(h->port) X { X- case PORT_1: h->address = 0x3f8; h->device = strdup("/dev/cuaa0"); break; X- case PORT_2: h->address = 0x2f8; h->device = strdup("/dev/cuaa1"); break; X- case PORT_3: h->address = 0x3e8; h->device = strdup("/dev/cuaa2"); break; X- case PORT_4: h->address = 0x3e8; h->device = strdup("/dev/cuaa3"); break; X+ case PORT_1: h->address = 0x3f8; h->device = strdup("/dev/cuad0"); break; X+ case PORT_2: h->address = 0x2f8; h->device = strdup("/dev/cuad1"); break; X+ case PORT_3: h->address = 0x3e8; h->device = strdup("/dev/cuad2"); break; X+ case PORT_4: h->address = 0x3e8; h->device = strdup("/dev/cuad3"); break; X default: return ERR_ILLEGAL_ARG; X } X h->priv2 = (struct termios *)calloc(1, sizeof(struct termios)); X@@ -93,9 +93,15 @@ X termset->c_cflag = CS8 | CLOCAL | CREAD; X termset->c_lflag = 0; X #endif X+ termset->c_cc[VMIN] = 0; X+ termset->c_cc[VTIME] = h->timeout; X X cfsetispeed(termset, B9600); X cfsetospeed(termset, B9600); X+ tcsetattr(dev_fd, TCSANOW, termset); X+ X+ if(tcflush(dev_fd, TCIOFLUSH) == -1) X+ return ERR_FLUSH_ERROR; X X return 0; X } X@@ -111,31 +117,18 @@ X X static int gry_reset(CableHandle *h) X { X- uint8_t unused[1024]; X- int n; X- X- /* Flush the input */ X- termset->c_cc[VMIN] = 0; X- termset->c_cc[VTIME] = 0; X- tcsetattr(dev_fd, TCSANOW, termset); X- do X- { X- n = read(dev_fd, (void *) unused, 1024); X- } while ((n != 0) && (n != -1)); X- X- /* and set/restore the timeout */ X- termset->c_cc[VTIME] = h->timeout; X- tcsetattr(dev_fd, TCSANOW, termset); X+ if(tcflush(dev_fd, TCIOFLUSH) == -1) X+ return ERR_FLUSH_ERROR; X X return 0; X } X X static int gry_put(CableHandle* h, uint8_t *data, uint32_t len) X { X- int err; X+ ssize_t ret; X X- err = write(dev_fd, (void *)data, len); X- switch (err) X+ ret = write(dev_fd, (void *)data, len); X+ switch (ret) X { X case -1: //error X return ERR_WRITE_ERROR; X@@ -150,19 +143,24 @@ X X static int gry_get(CableHandle* h, uint8_t *data, uint32_t len) X { X- int err; X+ ssize_t ret; X+ ssize_t i; X X tcdrain(dev_fd); // waits for all output written X X- err = read(dev_fd, (void *)data, len); X- switch (err) X+ for(i = 0; i < len; ) X { X- case -1: //error X- return ERR_READ_ERROR; X- break; X- case 0: // timeout X- return ERR_READ_TIMEOUT; X- break; X+ ret = read(dev_fd, (void *)(data+i), len - i); X+ switch (ret) X+ { X+ case -1: //error X+ return ERR_READ_ERROR; X+ break; X+ case 0: // timeout X+ return ERR_READ_TIMEOUT; X+ break; X+ } X+ i += ret; X } X X return 0; END-of-libticables2/files/patch-src-bsd-link_gry.c echo x - libticables2/files/patch-silver sed 's/^X//' >libticables2/files/patch-silver << 'END-of-libticables2/files/patch-silver' XIndex: src/ticables.c X=================================================================== X--- src/ticables.c (revision 2995) X+++ src/ticables.c (working copy) X@@ -33,6 +33,9 @@ X #ifdef __LINUX__ X #include <sys/utsname.h> X #endif X+#if defined(HAVE_LIBUSB) X+#include <usb.h> X+#endif X X #include "gettext.h" X #include "ticables.h" X@@ -140,6 +143,10 @@ X ticables_info("kernel: %s", buf.release); X } X #endif X+#if defined(HAVE_LIBUSB) X+ /* init the libusb */ X+ usb_init(); X+#endif X X return (++ticables_instance); X } XIndex: src/linux/link_slv.c X=================================================================== X--- src/linux/link_slv.c (revision 2995) X+++ src/linux/link_slv.c (working copy) X@@ -245,11 +245,11 @@ X han = usb_open(dev); X ret = usb_get_string_simple(han, dev->descriptor.iProduct, X string, sizeof(string)); X+ usb_close(han); X if (ret > 0) X return string; X else X return ""; X- usb_close(han); X } X X return string; X@@ -276,7 +276,7 @@ X if(dev->descriptor.idProduct == tigl_infos[i].pid) X { X ticables_info(" found <%s> on #%i, version <%x.%02x>", X- tigl_get_product(dev), j+1, X+ /*tigl_get_product(dev)*/ "", j+1, X dev->descriptor.bcdDevice >> 8, X dev->descriptor.bcdDevice & 0xff); X X@@ -296,9 +296,6 @@ X { X int ret = 0; X X- /* init the libusb */ X- usb_init(); X- X /* find all usb busses on the system */ X ret = usb_find_busses(); X if (ret < 0) X@@ -480,6 +477,7 @@ X X static int slv_reset(CableHandle *h) X { X+#if !defined(__BSD__) X /* Reset both endpoints */ X #ifdef SLV_RESET X TRYC(tigl_reset(uHdl)); X@@ -487,7 +485,7 @@ X TRYC(slv_close(h)); X TRYC(slv_open(h)); X #endif X- X+#endif X return 0; X } X END-of-libticables2/files/patch-silver echo x - libticables2/Makefile sed 's/^X//' >libticables2/Makefile << 'END-of-libticables2/Makefile' X# New ports collection makefile for: libticables2 X# Date created: 11 October 2006 X# Whom: Tijl Coosemans <tijl@ulyssis.org> X# X# $FreeBSD$ X# X XPORTNAME= libticables2 XPORTVERSION= 1.0.0 XCATEGORIES= comms XMASTER_SITES= ${MASTER_SITE_SOURCEFORGE} XMASTER_SITE_SUBDIR= gtktiemu XDISTNAME= ${PORTNAME}-20060925 X XMAINTAINER= tijl@ulyssis.org XCOMMENT= TI calculator link cables library X XLIB_DEPENDS= usb-0.1.8:${PORTSDIR}/devel/libusb X XWRKSRC= ${WRKDIR}/libticables X XUSE_AUTOTOOLS= libtool:15 XUSE_BZIP2= yes XUSE_GMAKE= yes XUSE_GNOME= glib20 gnomehack pkgconfig XUSE_LDCONFIG= yes X X.if !defined(WITHOUT_NLS) XUSE_GETTEXT= yes XPLIST_SUB= NLS="" X.else XCONFIGURE_ARGS= --disable-nls XPLIST_SUB= NLS="@comment " X.endif X XCONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include"\ X LDFLAGS="-L${LOCALBASE}/lib" X X.include <bsd.port.mk> END-of-libticables2/Makefile echo x - libticables2/distinfo sed 's/^X//' >libticables2/distinfo << 'END-of-libticables2/distinfo' XMD5 (libticables2-20060925.tar.bz2) = ced32aaebb4ef940f781d20919887a69 XSHA256 (libticables2-20060925.tar.bz2) = 065b8423f7b0f73f46bf8fddb218330bba51d4aabd7585ebb9199623015c58c7 XSIZE (libticables2-20060925.tar.bz2) = 507489 END-of-libticables2/distinfo echo x - libticables2/pkg-descr sed 's/^X//' >libticables2/pkg-descr << 'END-of-libticables2/pkg-descr' XThe ticables library is a library to handle the various TI calculator Xlink cables. X XWWW: http://tilp.info/ X X- Tijl Coosemans Xtijl@ulyssis.org END-of-libticables2/pkg-descr echo x - libticables2/pkg-plist sed 's/^X//' >libticables2/pkg-plist << 'END-of-libticables2/pkg-plist' Xinclude/tilp2/export1.h Xinclude/tilp2/stdints1.h Xinclude/tilp2/ticables.h Xinclude/tilp2/timeout.h Xlib/libticables2.a Xlib/libticables2.la Xlib/libticables2.so Xlib/libticables2.so.1 Xlibdata/pkgconfig/ticables2.pc X%%NLS%%share/locale/fr/LC_MESSAGES/libticables2.mo X@dirrmtry include/tilp2 END-of-libticables2/pkg-plist exit --- libticables2.shar ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200610141326.k9EDQSKM001886>