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