Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
xyan264 committed Sep 16, 2021
2 parents ebbd3b1 + 223b78a commit 2c4e2cf
Show file tree
Hide file tree
Showing 17 changed files with 2,599 additions and 39 deletions.
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ override CPPFLAGS+=@CPPFLAGS@
override CPPFLAGS+=-I. -Iinc -I$(OBJDIR) -DCOMPLETE_ENV=\"SWITCHTEC_COMPLETE\"
override CFLAGS+=-g -Wall -Wno-initializer-overrides @CFLAGS@
DEPFLAGS= -MT $@ -MMD -MP -MF $(OBJDIR)/$*.d
LDLIBS=@LIBS@
LDLIBS=@LIBS@ -lm
override LDFLAGS+=@LDFLAGS@

LIB_SRCS=$(wildcard lib/*.c) $(wildcard lib/platform/*.c)
Expand Down
2 changes: 1 addition & 1 deletion cli/argconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -1102,7 +1102,7 @@ void argconfig_register_help_func(argconfig_help_func * f)

int argconfig_parse_comma_range(const char *str, int *res, int max_nums)
{
char buf[strlen(str)];
char buf[strlen(str) + 1];
char *tok;
const char *delims = " ,";
int start, end;
Expand Down
13 changes: 9 additions & 4 deletions cli/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ enum switchtec_fw_type check_and_print_fw_image(int img_fd,

#define UART_HELP_TEXT " * a UART path (/dev/ttyUSB0)\n"

#define DEVICE_OPTION_BASIC(extra_text, handler) \
#define DEVICE_OPTION_BASIC(extra_text, handler, type) \
{ \
"device", .cfg_type=CFG_CUSTOM, .value_addr=&cfg.dev, \
.argument_type=required_positional, \
.argument_type=(type), \
.custom_handler=handler, \
.complete="/dev/switchtec*", \
.env="SWITCHTEC_DEV", \
Expand All @@ -69,9 +69,11 @@ enum switchtec_fw_type check_and_print_fw_image(int img_fd,
extra_text \
}

#define DEVICE_OPTION_MFG DEVICE_OPTION_BASIC(, mfg_handler)
#define DEVICE_OPTION_MFG DEVICE_OPTION_BASIC(, mfg_handler, \
required_positional)

#define DEVICE_OPTION DEVICE_OPTION_BASIC(UART_HELP_TEXT, switchtec_handler), \
#define __DEVICE_OPTION(type) \
DEVICE_OPTION_BASIC(UART_HELP_TEXT, switchtec_handler, (type)), \
{ \
"pax", 'x', .cfg_type=CFG_CUSTOM, \
.value_addr=&cfg.dev, \
Expand All @@ -82,4 +84,7 @@ enum switchtec_fw_type check_and_print_fw_image(int img_fd,
"Switchtec PAX devices" \
}

#define DEVICE_OPTION __DEVICE_OPTION(required_positional)
#define DEVICE_OPTION_OPTIONAL __DEVICE_OPTION(optional_positional)

#endif
Loading

0 comments on commit 2c4e2cf

Please sign in to comment.