input/null: Add a null module that discards all data.
This is useful for testing purposes.
This commit is contained in:
parent
1af7497d67
commit
2003be8cec
|
@ -77,7 +77,8 @@ libsigrok_la_SOURCES += \
|
||||||
src/input/raw_analog.c \
|
src/input/raw_analog.c \
|
||||||
src/input/trace32_ad.c \
|
src/input/trace32_ad.c \
|
||||||
src/input/vcd.c \
|
src/input/vcd.c \
|
||||||
src/input/wav.c
|
src/input/wav.c \
|
||||||
|
src/input/null.c
|
||||||
|
|
||||||
# Output modules
|
# Output modules
|
||||||
libsigrok_la_SOURCES += \
|
libsigrok_la_SOURCES += \
|
||||||
|
|
|
@ -66,6 +66,7 @@ extern SR_PRIV struct sr_input_module input_trace32_ad;
|
||||||
extern SR_PRIV struct sr_input_module input_vcd;
|
extern SR_PRIV struct sr_input_module input_vcd;
|
||||||
extern SR_PRIV struct sr_input_module input_wav;
|
extern SR_PRIV struct sr_input_module input_wav;
|
||||||
extern SR_PRIV struct sr_input_module input_raw_analog;
|
extern SR_PRIV struct sr_input_module input_raw_analog;
|
||||||
|
extern SR_PRIV struct sr_input_module input_null;
|
||||||
/* @endcond */
|
/* @endcond */
|
||||||
|
|
||||||
static const struct sr_input_module *input_module_list[] = {
|
static const struct sr_input_module *input_module_list[] = {
|
||||||
|
@ -76,6 +77,7 @@ static const struct sr_input_module *input_module_list[] = {
|
||||||
&input_vcd,
|
&input_vcd,
|
||||||
&input_wav,
|
&input_wav,
|
||||||
&input_raw_analog,
|
&input_raw_analog,
|
||||||
|
&input_null,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the libsigrok project.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2018 Uwe Hermann <uwe@hermann-uwe.de>
|
||||||
|
*
|
||||||
|
* 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
#include <libsigrok/libsigrok.h>
|
||||||
|
#include "libsigrok-internal.h"
|
||||||
|
|
||||||
|
#define LOG_PREFIX "input/null"
|
||||||
|
|
||||||
|
static int init(struct sr_input *in, GHashTable *options)
|
||||||
|
{
|
||||||
|
(void)in;
|
||||||
|
(void)options;
|
||||||
|
|
||||||
|
return SR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int receive(struct sr_input *in, GString *buf)
|
||||||
|
{
|
||||||
|
(void)in;
|
||||||
|
(void)buf;
|
||||||
|
|
||||||
|
return SR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int end(struct sr_input *in)
|
||||||
|
{
|
||||||
|
(void)in;
|
||||||
|
|
||||||
|
return SR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
SR_PRIV struct sr_input_module input_null = {
|
||||||
|
.id = "null",
|
||||||
|
.name = "Null",
|
||||||
|
.desc = "Null input (discards all input)",
|
||||||
|
.exts = NULL,
|
||||||
|
.options = NULL,
|
||||||
|
.init = init,
|
||||||
|
.receive = receive,
|
||||||
|
.end = end,
|
||||||
|
.reset = NULL,
|
||||||
|
};
|
Loading…
Reference in New Issue