Initial AVS SoB code.

This commit is contained in:
Solomon Peachy 2013-08-25 08:19:52 -04:00
commit b2873df66d
3 changed files with 1171 additions and 0 deletions

47
Makefile Normal file
View File

@ -0,0 +1,47 @@
# Makefile
#
#--------------------------------------------------------------------------
#
# Copyright (C) 2006 AbsoluteValue Systems, Inc. All Rights Reserved.
#
# The contents of this file are subject to the licensing terms
# between AbsoluteValue Systems, Inc., and licensees of
# AbsoluteValue Systems linux-wlan(tm). You may not use this file
# except in compliance with the said License. When in doubt, do not
# distribute the contents of this file without permission from
# AbsoluteValue Sytems, Inc.
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# Any inquiries regarding this software may be directed to:
#
# AbsoluteValue Systems, Inc.
# info@linux-wlan.com
# http://www.linux-wlan.com
#--------------------------------------------------------------------------
CPPFLAGS= -Wall
all: sobredird serialstats
sobredird: redirector.o
$(CC) -o $@ $^
serialstats: serialstats.o
$(CC) -o $@ $^
%.o: %.c
$(CC) -c -Wall $(CFLAGS) $(CPPFLAGS) $< -o $@
install:
mkdir -p $(PREFIX)/bin
cp -f sobredird $(PREFIX)/bin
cp -f serialstats $(PREFIX)/bin
distclean: clean
clean:
rm -f core core.* *.o .*.o *.s *.a .depend tmp_make *~ sobredird serialstats

1072
redirector.c Normal file

File diff suppressed because it is too large Load Diff

52
serialstats.c Normal file
View File

@ -0,0 +1,52 @@
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <linux/serial.h>
int main(int argc, char **argv) {
int fd;
int i;
int rval = 0;
char *devname;
struct serial_icounter_struct stats;
if (argc != 2) {
fprintf(stderr, "usage: serialstats devicename\n");
rval = 1;
goto done;
}
devname = argv[1];
fd = open(devname, O_RDWR|O_NONBLOCK|O_NOCTTY);
if (fd <= 0) {
perror("couldn't open device");
rval = fd;
goto done;
}
i = ioctl(fd, TIOCGICOUNT, &stats);
if (i != 0) {
perror("couldn't issue ioctl");
rval = i;
goto done;
}
printf("cts=%d\ndsr=%d\nrng=%d\ndcd=%d\nrx=%d\ntx=%d\nframe=%d\noverrun=%d\nparity=%d\nbrk=%d\nbuf_overrun=%d\n",
stats.cts, stats.dsr, stats.rng, stats.dcd,
stats.rx, stats.tx,
stats.frame, stats.overrun, stats.parity, stats.brk,
stats.buf_overrun);
close(fd);
done:
return rval;
}