Merge pull request #552 from OpenEtherCATsociety/show-adapters

Examples: show avaialable adapters if not specified
This commit is contained in:
nakarlsson 2021-09-10 08:59:18 +02:00 committed by GitHub
commit 354466a534
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;
}