Improved the loop structure to determine the macaddress via /sys.