Commit 29de8b16 authored by Claes Sjofors's avatar Claes Sjofors

profinet_viewer bugfix in configured devices

parent 830d3494
...@@ -80,7 +80,7 @@ void PnViewer::update_devices() ...@@ -80,7 +80,7 @@ void PnViewer::update_devices()
pnet->fetch_devices(dev_vect); pnet->fetch_devices(dev_vect);
conf_vect.clear(); conf_vect.clear();
sts = fetch_config(dev_vect); sts = fetch_config(conf_vect);
if (EVEN(sts)) if (EVEN(sts))
printf("Error reading configuration file\n"); printf("Error reading configuration file\n");
...@@ -168,8 +168,8 @@ int PnViewer::fetch_config(std::vector<PnDevice>& vect) ...@@ -168,8 +168,8 @@ int PnViewer::fetch_config(std::vector<PnDevice>& vect)
strncpy(pndevice.devname, elemv[1], sizeof(pndevice.devname)); strncpy(pndevice.devname, elemv[1], sizeof(pndevice.devname));
sts = sscanf(elemv[2], "%hhu.%hhu.%hhu.%hhu", &pndevice.ipaddress[0], sts = sscanf(elemv[2], "%hhu.%hhu.%hhu.%hhu", &pndevice.ipaddress[3],
&pndevice.ipaddress[1], &pndevice.ipaddress[2], &pndevice.ipaddress[3]); &pndevice.ipaddress[2], &pndevice.ipaddress[1], &pndevice.ipaddress[0]);
if (sts != 4) { if (sts != 4) {
printf("Not a valid IP address: %s\n", elemv[2]); printf("Not a valid IP address: %s\n", elemv[2]);
pndevice.ipaddress[0] = 0; pndevice.ipaddress[0] = 0;
...@@ -179,9 +179,9 @@ int PnViewer::fetch_config(std::vector<PnDevice>& vect) ...@@ -179,9 +179,9 @@ int PnViewer::fetch_config(std::vector<PnDevice>& vect)
} }
sts = sscanf(elemv[3], "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", sts = sscanf(elemv[3], "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
&pndevice.macaddress[0], &pndevice.macaddress[1], &pndevice.macaddress[5], &pndevice.macaddress[4],
&pndevice.macaddress[2], &pndevice.macaddress[3], &pndevice.macaddress[3], &pndevice.macaddress[2],
&pndevice.macaddress[4], &pndevice.macaddress[5]); &pndevice.macaddress[1], &pndevice.macaddress[0]);
if (sts != 6) { if (sts != 6) {
printf("Not a valid MAC address: %s\n", elemv[3]); printf("Not a valid MAC address: %s\n", elemv[3]);
pndevice.macaddress[0] = 0; pndevice.macaddress[0] = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment