* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "sigrok-cli.h"
-#include "config.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
+#include "sigrok-cli.h"
+#include "config.h"
-#define BUFSIZE 16384
+#define BUFSIZE (16 * 1024)
static void load_input_file_module(void)
{
if (!in)
g_critical("Error: no input module found for this file.");
}
- sr_session_new(&session);
+ sr_session_new(sr_ctx, &session);
sr_session_datafeed_callback_add(session, &datafeed_in, NULL);
got_sdi = FALSE;
- while(TRUE) {
+ while (TRUE) {
g_string_truncate(buf, 0);
len = read(fd, buf->str, BUFSIZE);
if (len < 0)
break;
sdi = sr_input_dev_inst_get(in);
- if(!got_sdi && sdi) {
+ if (!got_sdi && sdi) {
/* First time we got a valid sdi. */
if (select_channels(sdi) != SR_OK)
return;
}
got_sdi = TRUE;
}
-
}
sr_input_end(in);
sr_input_free(in);
/* Input from stdin is never a session file. */
load_input_file_module();
} else {
- if ((ret = sr_session_load(opt_input_file, &session)) == SR_OK) {
+ if ((ret = sr_session_load(sr_ctx, opt_input_file,
+ &session)) == SR_OK) {
/* sigrok session file */
ret = sr_session_dev_list(session, &devices);
if (ret != SR_OK || !devices || !devices->data) {