Skip to content

Commit

Permalink
Examples: show avaialable adapters if not specified
Browse files Browse the repository at this point in the history
  • Loading branch information
mheden committed Sep 8, 2021
1 parent 4b81d40 commit 38f61fd
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/linux/eepromtool/eepromtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,8 @@ int main(int argc, char *argv[])
}
else
{
ec_adaptert * adapter = NULL;

printf("Usage: eepromtool ifname slave OPTION fname|alias\n");
printf("ifname = eth0 for example\n");
printf("slave = slave number in EtherCAT order 1..n\n");
Expand All @@ -465,6 +467,15 @@ int main(int argc, char *argv[])
printf(" -ri read EEPROM, output Intel Hex format\n");
printf(" -w write EEPROM, input binary format\n");
printf(" -wi write EEPROM, input Intel Hex format\n");

printf ("\nAvailable adapters:\n");
adapter = ec_find_adapters ();
while (adapter != NULL)
{
printf (" - %s (%s)\n", adapter->name, adapter->desc);
adapter = adapter->next;
}
ec_free_adapters(adapter);
}

printf("End program\n");
Expand Down
10 changes: 10 additions & 0 deletions test/linux/simple_test/simple_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,17 @@ int main(int argc, char *argv[])
}
else
{
ec_adaptert * adapter = NULL;
printf("Usage: simple_test ifname1\nifname = eth0 for example\n");

printf ("\nAvailable adapters:\n");
adapter = ec_find_adapters ();
while (adapter != NULL)
{
printf (" - %s (%s)\n", adapter->name, adapter->desc);
adapter = adapter->next;
}
ec_free_adapters(adapter);
}

printf("End program\n");
Expand Down
1 change: 1 addition & 0 deletions test/linux/slaveinfo/slaveinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ int main(int argc, char *argv[])
printf ("Description : %s, Device to use for wpcap: %s\n", adapter->desc,adapter->name);
adapter = adapter->next;
}
ec_free_adapters(adapter);
}

printf("End program\n");
Expand Down
10 changes: 10 additions & 0 deletions test/simple_ng/simple_ng.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,18 @@ main(int argc, char *argv[])
Fieldbus fieldbus;

if (argc != 2) {
ec_adaptert * adapter = NULL;
printf("Usage: simple_ng IFNAME1\n"
"IFNAME1 is the NIC interface name, e.g. 'eth0'\n");

printf("\nAvailable adapters:\n");
adapter = ec_find_adapters();
while (adapter != NULL)
{
printf(" - %s (%s)\n", adapter->name, adapter->desc);
adapter = adapter->next;
}
ec_free_adapters(adapter);
return 1;
}

Expand Down

0 comments on commit 38f61fd

Please sign in to comment.