canfdtest: use can0 per default

pull/488/head
Marc Kleine-Budde 2023-12-19 14:25:33 +01:00
parent 2b07d15264
commit 046b9d3b8f
1 changed files with 7 additions and 4 deletions

View File

@ -65,7 +65,7 @@ static void print_usage(char *prg)
{
fprintf(stderr,
"%s - Full-duplex test program (DUT and host part).\n"
"Usage: %s [options] <can-interface>\n"
"Usage: %s [options] [<can-interface>]\n"
"\n"
"Options:\n"
" -b (enable CAN FD Bit Rate Switch)\n"
@ -86,6 +86,8 @@ static void print_usage(char *prg)
"<can-interface> are sent back incrementing the CAN id and\n"
"all data bytes. The program can be aborted with ^C.\n"
"\n"
"Using 'can0' as default CAN-interface.\n"
"\n"
"Examples:\n"
"\ton DUT:\n"
"%s -v can0\n"
@ -428,7 +430,7 @@ out_free_tx_frames:
int main(int argc, char *argv[])
{
struct sockaddr_can addr;
char *intf_name;
char *intf_name = "can0";
int family = PF_CAN, type = SOCK_RAW, proto = CAN_RAW;
int echo_gen = 0;
int opt, err;
@ -519,9 +521,10 @@ int main(int argc, char *argv[])
can_id_ping = normalize_canid(can_id_ping);
can_id_pong = normalize_canid(can_id_pong);
if ((argc - optind) != 1)
print_usage(basename(argv[0]));
if ((argc - optind) == 1)
intf_name = argv[optind];
else if ((argc - optind))
print_usage(basename(argv[0]));
printf("interface = %s, family = %d, type = %d, proto = %d\n",
intf_name, family, type, proto);