Examples: show avaialable adapters if not specified

This commit is contained in:
Mikael Heden 2021-09-08 09:41:30 +02:00
parent 4b81d4099d
commit 38f61fdad0
4 changed files with 32 additions and 0 deletions

View File

@ -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");
@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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;
}