Import librs232.
Librs232 is a library which provides common interface to rs232 serial interface communication.
This commit is contained in:
parent
62df9da1ff
commit
376d25ce44
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=373861
8 changed files with 141 additions and 0 deletions
|
@ -80,6 +80,7 @@
|
|||
SUBDIR += libimobiledevice
|
||||
SUBDIR += libirman
|
||||
SUBDIR += libmodbus
|
||||
SUBDIR += librs232
|
||||
SUBDIR += libticables2
|
||||
SUBDIR += libticalcs2
|
||||
SUBDIR += libusbmuxd
|
||||
|
|
28
comms/librs232/Makefile
Normal file
28
comms/librs232/Makefile
Normal file
|
@ -0,0 +1,28 @@
|
|||
# $FreeBSD$
|
||||
|
||||
PORTNAME= librs232
|
||||
PORTVERSION= 20140105
|
||||
CATEGORIES= comms
|
||||
DISTNAME= RS-232
|
||||
MASTER_SITES= http://www.teuniz.net/RS-232/
|
||||
|
||||
MAINTAINER= kevlo@FreeBSD.org
|
||||
COMMENT= Simple serial library
|
||||
|
||||
LICENSE= GPLv2
|
||||
|
||||
WRKSRC= ${WRKDIR}
|
||||
|
||||
OPTIONS_DEFINE= DOCS
|
||||
|
||||
USES= uidfix
|
||||
USE_LDCONFIG= yes
|
||||
|
||||
post-extract:
|
||||
@${CP} ${FILESDIR}/${MAKEFILE} ${WRKSRC}
|
||||
|
||||
post-install:
|
||||
@${MKDIR} ${STAGEDIR}${DOCSDIR}
|
||||
${INSTALL_DATA} ${WRKSRC}/doc.txt ${STAGEDIR}${DOCSDIR}
|
||||
|
||||
.include <bsd.port.mk>
|
2
comms/librs232/distinfo
Normal file
2
comms/librs232/distinfo
Normal file
|
@ -0,0 +1,2 @@
|
|||
SHA256 (RS-232.tar.gz) = 6d0800639c1b72411591e02b99269509e9916ddfda8d9fc4f2e385d44916240e
|
||||
SIZE (RS-232.tar.gz) = 11777
|
18
comms/librs232/files/Makefile
Normal file
18
comms/librs232/files/Makefile
Normal file
|
@ -0,0 +1,18 @@
|
|||
# BSD Makefile for librs232
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
SRCS= rs232.c
|
||||
|
||||
# Includes
|
||||
INCS= rs232.h
|
||||
INCSDIR=${PREFIX}/include
|
||||
|
||||
# Libraries
|
||||
LIB= rs232
|
||||
SHLIB_MAJOR= 1
|
||||
LIBDIR= ${PREFIX}/lib
|
||||
NO_PROFILE= YES
|
||||
|
||||
.include <bsd.lib.mk>
|
71
comms/librs232/files/patch-rs232.c
Normal file
71
comms/librs232/files/patch-rs232.c
Normal file
|
@ -0,0 +1,71 @@
|
|||
--- rs232.c.orig 2014-10-05 15:21:14.000000000 +0800
|
||||
+++ rs232.c 2014-12-04 14:24:26.000000000 +0800
|
||||
@@ -38,19 +38,23 @@
|
||||
|
||||
|
||||
|
||||
-#ifdef __linux__ /* Linux */
|
||||
+#if defined(__linux__) || defined(__FreeBSD__)
|
||||
|
||||
|
||||
-int Cport[30],
|
||||
+int Cport[38],
|
||||
error;
|
||||
|
||||
struct termios new_port_settings,
|
||||
- old_port_settings[30];
|
||||
+ old_port_settings[38];
|
||||
|
||||
-char comports[30][16]={"/dev/ttyS0","/dev/ttyS1","/dev/ttyS2","/dev/ttyS3","/dev/ttyS4","/dev/ttyS5",
|
||||
- "/dev/ttyS6","/dev/ttyS7","/dev/ttyS8","/dev/ttyS9","/dev/ttyS10","/dev/ttyS11",
|
||||
- "/dev/ttyS12","/dev/ttyS13","/dev/ttyS14","/dev/ttyS15","/dev/ttyUSB0",
|
||||
- "/dev/ttyUSB1","/dev/ttyUSB2","/dev/ttyUSB3","/dev/ttyUSB4","/dev/ttyUSB5",
|
||||
+char comports[38][16]={"/dev/cuau0", "/dev/cuau1", "/dev/cuau2", "/dev/cuau3",
|
||||
+ "/dev/cuaU0", "/dev/cuaU1", "/dev/cuaU2", "/dev/cuaU3",
|
||||
+ "/dev/ttyS0","/dev/ttyS1","/dev/ttyS2","/dev/ttyS3",
|
||||
+ "/dev/ttyS4","/dev/ttyS5", "/dev/ttyS6","/dev/ttyS7",
|
||||
+ "/dev/ttyS8","/dev/ttyS9","/dev/ttyS10","/dev/ttyS11",
|
||||
+ "/dev/ttyS12","/dev/ttyS13","/dev/ttyS14","/dev/ttyS15",
|
||||
+ "/dev/ttyUSB0", "/dev/ttyUSB1","/dev/ttyUSB2",
|
||||
+ "/dev/ttyUSB3", "/dev/ttyUSB4","/dev/ttyUSB5",
|
||||
"/dev/ttyAMA0","/dev/ttyAMA1","/dev/ttyACM0","/dev/ttyACM1",
|
||||
"/dev/rfcomm0","/dev/rfcomm1","/dev/ircomm0","/dev/ircomm1"};
|
||||
|
||||
@@ -61,7 +65,7 @@
|
||||
int baudr,
|
||||
status;
|
||||
|
||||
- if((comport_number>29)||(comport_number<0))
|
||||
+ if((comport_number>37)||(comport_number<0))
|
||||
{
|
||||
printf("illegal comport number\n");
|
||||
return(1);
|
||||
@@ -107,28 +111,6 @@
|
||||
break;
|
||||
case 460800 : baudr = B460800;
|
||||
break;
|
||||
- case 500000 : baudr = B500000;
|
||||
- break;
|
||||
- case 576000 : baudr = B576000;
|
||||
- break;
|
||||
- case 921600 : baudr = B921600;
|
||||
- break;
|
||||
- case 1000000 : baudr = B1000000;
|
||||
- break;
|
||||
- case 1152000 : baudr = B1152000;
|
||||
- break;
|
||||
- case 1500000 : baudr = B1500000;
|
||||
- break;
|
||||
- case 2000000 : baudr = B2000000;
|
||||
- break;
|
||||
- case 2500000 : baudr = B2500000;
|
||||
- break;
|
||||
- case 3000000 : baudr = B3000000;
|
||||
- break;
|
||||
- case 3500000 : baudr = B3500000;
|
||||
- break;
|
||||
- case 4000000 : baudr = B4000000;
|
||||
- break;
|
||||
default : printf("invalid baudrate\n");
|
||||
return(1);
|
||||
break;
|
12
comms/librs232/files/patch-rs232.h
Normal file
12
comms/librs232/files/patch-rs232.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
--- rs232.h.orig 2014-12-04 14:17:08.000000000 +0800
|
||||
+++ rs232.h 2014-12-04 14:17:22.000000000 +0800
|
||||
@@ -45,8 +45,7 @@
|
||||
#include <string.h>
|
||||
|
||||
|
||||
-
|
||||
-#ifdef __linux__
|
||||
+#if defined(__linux__) || defined(__FreeBSD__)
|
||||
|
||||
#include <termios.h>
|
||||
#include <sys/ioctl.h>
|
4
comms/librs232/pkg-descr
Normal file
4
comms/librs232/pkg-descr
Normal file
|
@ -0,0 +1,4 @@
|
|||
Librs232 is a library which provides common interface to rs232 serial
|
||||
interface communication.
|
||||
|
||||
WWW: http://www.teuniz.net/RS-232/
|
5
comms/librs232/pkg-plist
Normal file
5
comms/librs232/pkg-plist
Normal file
|
@ -0,0 +1,5 @@
|
|||
include/rs232.h
|
||||
lib/librs232.a
|
||||
lib/librs232.so
|
||||
lib/librs232.so.1
|
||||
%%PORTDOCS%%%%DOCSDIR%%/doc.txt
|
Loading…
Reference in a new issue