From 86094f67bde4c807c7548be242f4c341e364665a Mon Sep 17 00:00:00 2001 From: jow Date: Thu, 24 Sep 2009 18:01:13 +0000 Subject: [PATCH] [packages] Add SerialOverIp, a tool to transport serial ports over UDP/IP git-svn-id: svn://svn.openwrt.org/openwrt/packages@17697 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- net/serialoverip/Makefile | 45 +++++++++++ .../patches/001-compile-fixes.patch | 76 +++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 net/serialoverip/Makefile create mode 100644 net/serialoverip/patches/001-compile-fixes.patch diff --git a/net/serialoverip/Makefile b/net/serialoverip/Makefile new file mode 100644 index 000000000..c1ed9fa29 --- /dev/null +++ b/net/serialoverip/Makefile @@ -0,0 +1,45 @@ +# +# Copyright (C) 2009 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=serialoverip +PKG_VERSION:=1.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME).tgz +PKG_SOURCE_URL:=@SF/serialoverip +PKG_MD5SUM:=0931cca65b8f9d32079fa3e55130ee1e + +include $(INCLUDE_DIR)/package.mk + +define Package/serialoverip + SECTION:=net + CATEGORY:=Network + TITLE:=SerialOverIP + URL:=http://sourceforge.net/projects/serialoverip/ +endef + +define Package/serialoverip/description + Tool for transport of serial interfaces over UDP/IP. + Usefull for accessing a distant serial device by a local program. +endef + +define Build/Configure +endef + +define Build/Compile + $(TARGET_CC) $(TARGET_CFLAGS) \ + -o $(PKG_BUILD_DIR)/serialoverip $(PKG_BUILD_DIR)/serialoverip.c +endef + +define Package/serialoverip/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/serialoverip $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,serialoverip)) diff --git a/net/serialoverip/patches/001-compile-fixes.patch b/net/serialoverip/patches/001-compile-fixes.patch new file mode 100644 index 000000000..f487e24ae --- /dev/null +++ b/net/serialoverip/patches/001-compile-fixes.patch @@ -0,0 +1,76 @@ +diff -ur serialoverip-1.0.orig/serialoverip.c serialoverip-1.0/serialoverip.c +--- serialoverip-1.0.orig/serialoverip.c 2009-09-24 19:32:40.000000000 +0200 ++++ serialoverip-1.0/serialoverip.c 2009-09-24 19:43:18.000000000 +0200 +@@ -34,6 +34,7 @@ + #include + #include + #include ++#include + + #define MAXMESG 2048 + +@@ -42,20 +43,19 @@ + int s[2],st[2]; + + void help(){ +- fprintf(stderr,"\ +-SerialOverIP version 1.0, Copyright (C) 2002 Stefan-Florin Nicola +-SerialOverIP comes with ABSOLUTELY NO WARRANTY. This is free software, and you +-are welcome to redistribute it under GNU General Public License. +- Usage: %s +- where and are one of the folowing: +- -s UDP server on IP:port +- -c UDP client for server IP:port +- -d sss-dps local serial device +- sss is speed (50,..,230400) +- d is data bits (5,6,7,8) +- p is parity type (N,E,O) +- s is stop bits (1,2) +-",pname); ++ fprintf(stderr, ++"SerialOverIP version 1.0, Copyright (C) 2002 Stefan-Florin Nicola \n" ++"SerialOverIP comes with ABSOLUTELY NO WARRANTY. This is free software, and you\n" ++"are welcome to redistribute it under GNU General Public License.\n" ++" Usage: %s \n" ++" where and are one of the folowing:\n" ++" -s UDP server on IP:port\n" ++" -c UDP client for server IP:port\n" ++" -d sss-dps local serial device\n" ++" sss is speed (50,..,230400)\n" ++" d is data bits (5,6,7,8)\n" ++" p is parity type (N,E,O)\n" ++" s is stop bits (1,2)\n", pname); + return; + } + +@@ -113,10 +113,9 @@ + + int main(int argc,char**argv){ + int i,n,w,clen[2],nonblock[2],speed,data,stopb; +- unsigned char c,buf[MAXMESG],*p,parity; ++ unsigned char buf[MAXMESG],*p,parity; + struct termios cfg; + struct sockaddr_in addr[4][4]; +- struct sigaction newact,oldact; + + pname=argv[0]; + if(argc!=7){ +@@ -156,7 +155,7 @@ + n=sscanf(argv[3*i+3],"%d-%d%c%d",&speed,&data,&parity,&stopb); + if(n<4){ + fprintf(stderr,"%s: invalid argument %1d from %s\n", +- pname,read+1,argv[3*i+3]); ++ pname,(int)(read+1),argv[3*i+3]); + return 3; + } + if(setserial(s[i],&cfg,speed,data,parity,stopb)<0){ +@@ -177,7 +176,7 @@ + if(st[i]&2)n=read(s[i],buf,MAXMESG); + else{ + n=recvfrom(s[i],buf,MAXMESG,nonblock[i]*MSG_DONTWAIT, +- (struct sockaddr*)&addr[i][st[i]],&clen[i]); ++ (struct sockaddr*)&addr[i][st[i]],(socklen_t *)&clen[i]); + nonblock[i]=1; + } + p=buf; +Only in serialoverip-1.0: serialoverip.new