-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename sub-project dirs to their correct name.
- Loading branch information
0 parents
commit 43e5747
Showing
11 changed files
with
2,384 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sigrok-cli |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
## | ||
## This file is part of the sigrok project. | ||
## | ||
## Copyright (C) 2010 Bert Vermeulen <[email protected]> | ||
## | ||
## This program is free software: you can redistribute it and/or modify | ||
## it under the terms of the GNU General Public License as published by | ||
## the Free Software Foundation, either version 3 of the License, or | ||
## (at your option) any later version. | ||
## | ||
## This program is distributed in the hope that it will be useful, | ||
## but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
## GNU General Public License for more details. | ||
## | ||
## You should have received a copy of the GNU General Public License | ||
## along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
## | ||
|
||
SUBDIRS = doc | ||
|
||
bin_PROGRAMS = sigrok-cli | ||
|
||
sigrok_cli_SOURCES = sigrok-cli.c sigrok-cli.h parsers.c anykey.c | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* This file is part of the sigrok project. | ||
* | ||
* Copyright (C) 2011 Bert Vermeulen <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <stdio.h> | ||
#ifdef _WIN32 | ||
#include <windows.h> | ||
#else | ||
#include <termios.h> | ||
#endif | ||
#include <unistd.h> | ||
#include <string.h> | ||
#include <glib.h> | ||
#include <sigrok.h> | ||
#include "sigrok-cli.h" | ||
|
||
#ifdef _WIN32 | ||
HANDLE stdin_handle; | ||
DWORD stdin_mode; | ||
#else | ||
struct termios term_orig; | ||
#endif | ||
|
||
static int received_anykey(int fd, int revents, void *user_data) | ||
{ | ||
/* Avoid compiler warnings. */ | ||
(void)fd; | ||
(void)revents; | ||
(void)user_data; | ||
|
||
sr_session_stop(); | ||
|
||
return TRUE; | ||
} | ||
|
||
/* Turn off buffering on stdin. */ | ||
void add_anykey(void) | ||
{ | ||
#ifdef _WIN32 | ||
stdin_handle = GetStdHandle(STD_INPUT_HANDLE); | ||
|
||
if (!GetConsoleMode(stdin_handle, &stdin_mode)) { | ||
/* TODO: Error handling. */ | ||
} | ||
|
||
SetConsoleMode(stdin_handle, 0); | ||
#else | ||
struct termios term; | ||
|
||
tcgetattr(STDIN_FILENO, &term); | ||
memcpy(&term_orig, &term, sizeof(struct termios)); | ||
term.c_lflag &= ~(ECHO | ICANON | ISIG); | ||
tcsetattr(STDIN_FILENO, TCSADRAIN, &term); | ||
#endif | ||
|
||
sr_session_source_add(STDIN_FILENO, G_IO_IN, -1, received_anykey, NULL); | ||
|
||
printf("Press any key to stop acquisition.\n"); | ||
} | ||
|
||
/* Restore stdin attributes. */ | ||
void clear_anykey(void) | ||
{ | ||
#ifdef _WIN32 | ||
SetConsoleMode(stdin_handle, stdin_mode); | ||
#else | ||
tcflush(STDIN_FILENO, TCIFLUSH); | ||
tcsetattr(STDIN_FILENO, TCSANOW, &term_orig); | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/sh | ||
## | ||
## This file is part of the sigrok project. | ||
## | ||
## Copyright (C) 2010 Bert Vermeulen <[email protected]> | ||
## | ||
## This program is free software: you can redistribute it and/or modify | ||
## it under the terms of the GNU General Public License as published by | ||
## the Free Software Foundation, either version 3 of the License, or | ||
## (at your option) any later version. | ||
## | ||
## This program is distributed in the hope that it will be useful, | ||
## but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
## GNU General Public License for more details. | ||
## | ||
## You should have received a copy of the GNU General Public License | ||
## along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
## | ||
|
||
OS=`uname` | ||
|
||
LIBTOOLIZE=libtoolize | ||
ACLOCAL_DIR= | ||
|
||
if [ "x$OS" = "xDarwin" ]; then | ||
LIBTOOLIZE=glibtoolize | ||
|
||
if [ -d /sw/share/aclocal ]; then | ||
# fink installs aclocal macros here | ||
ACLOCAL_DIR="-I /sw/share/aclocal" | ||
elif [ -d /opt/local/share/aclocal ]; then | ||
# Macports installs aclocal macros here | ||
ACLOCAL_DIR="-I /opt/local/share/aclocal" | ||
elif [ -d /usr/share/aclocal ]; then | ||
# Xcode installs aclocal macros here | ||
ACLOCAL_DIR="-I /usr/share/aclocal" | ||
fi | ||
|
||
elif [ "x$OS" = "xMINGW32_NT-5.1" ]; then | ||
ACLOCAL_DIR="-I /usr/local/share/aclocal" | ||
fi | ||
|
||
echo "Generating build system..." | ||
${LIBTOOLIZE} --install --copy --quiet || exit 1 | ||
aclocal ${ACLOCAL_DIR} || exit 1 | ||
autoheader || exit 1 | ||
automake --add-missing --copy --foreign || exit 1 | ||
autoconf || exit 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
## | ||
## This file is part of the sigrok project. | ||
## | ||
## Copyright (C) 2010 Bert Vermeulen <[email protected]> | ||
## | ||
## This program is free software: you can redistribute it and/or modify | ||
## it under the terms of the GNU General Public License as published by | ||
## the Free Software Foundation, either version 3 of the License, or | ||
## (at your option) any later version. | ||
## | ||
## This program is distributed in the hope that it will be useful, | ||
## but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
## GNU General Public License for more details. | ||
## | ||
## You should have received a copy of the GNU General Public License | ||
## along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
## | ||
|
||
AC_PREREQ(2.61) | ||
|
||
AC_INIT([sigrok-cli], [0.1], [[email protected]], | ||
[sigrok-cli], [http://www.sigrok.org]) | ||
|
||
AC_CONFIG_SRCDIR([sigrok-cli.c]) | ||
|
||
AC_CONFIG_HEADERS([config.h]) | ||
AC_CONFIG_MACRO_DIR([m4]) | ||
|
||
AM_INIT_AUTOMAKE([-Wall -Werror foreign std-options]) | ||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) | ||
|
||
AH_TOP([#ifndef SGIROK_CLI_CONFIG_H | ||
#define SIGROK_CLI_CONFIG_H /* To stop multiple inclusions. */]) | ||
AH_BOTTOM([#endif /* SIGROK_CLI_CONFIG_H */]) | ||
|
||
CFLAGS="-g -Wall -Wextra" | ||
|
||
# Checks for programs. | ||
AC_PROG_CC | ||
AC_PROG_CPP | ||
AC_PROG_INSTALL | ||
AC_PROG_LN_S | ||
|
||
# Initialize libtool. | ||
LT_INIT | ||
|
||
# Initialize pkg-config. | ||
# We require at least 0.22, as "Requires.private" behaviour changed there. | ||
PKG_PROG_PKG_CONFIG([0.22]) | ||
|
||
# Checks for libraries. | ||
|
||
PKG_CHECK_MODULES([libsigrok], [libsigrok], | ||
[CFLAGS="$CFLAGS $libsigrok_CFLAGS"; | ||
LIBS="$LIBS $libsigrok_LIBS"]) | ||
|
||
PKG_CHECK_MODULES([libsigrokdecode], [libsigrokdecode], | ||
[CFLAGS="$CFLAGS $libsigrokdecode_CFLAGS"; | ||
LIBS="$LIBS $libsigrokdecode_LIBS"]) | ||
|
||
# Checks for header files. | ||
# These are already checked: inttypes.h stdint.h stdlib.h string.h unistd.h. | ||
AC_CHECK_HEADERS([sys/time.h termios.h]) | ||
|
||
# Checks for typedefs, structures, and compiler characteristics. | ||
AC_C_INLINE | ||
AC_TYPE_INT8_T | ||
AC_TYPE_INT16_T | ||
AC_TYPE_INT32_T | ||
AC_TYPE_INT64_T | ||
AC_TYPE_UINT8_T | ||
AC_TYPE_UINT16_T | ||
AC_TYPE_UINT32_T | ||
AC_TYPE_UINT64_T | ||
AC_TYPE_SIZE_T | ||
|
||
# Checks for library functions. | ||
AC_CHECK_FUNCS([strcasecmp strchr strerror strstr strtol]) | ||
|
||
AC_SUBST(MAKEFLAGS, '--no-print-directory') | ||
AC_SUBST(AM_LIBTOOLFLAGS, '--silent') | ||
|
||
AC_CONFIG_FILES([Makefile | ||
doc/Makefile]) | ||
|
||
AC_OUTPUT | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
## | ||
## This file is part of the sigrok project. | ||
## | ||
## Copyright (C) 2010 Uwe Hermann <[email protected]> | ||
## | ||
## This program is free software; you can redistribute it and/or modify | ||
## it under the terms of the GNU General Public License as published by | ||
## the Free Software Foundation; either version 2 of the License, or | ||
## (at your option) any later version. | ||
## | ||
## This program is distributed in the hope that it will be useful, | ||
## but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
## GNU General Public License for more details. | ||
## | ||
## You should have received a copy of the GNU General Public License | ||
## along with this program; if not, write to the Free Software | ||
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
## | ||
|
||
dist_man_MANS = sigrok-cli.1 | ||
|
Oops, something went wrong.