From 8098ec878ffe97fd299d2563c732938edfe48d54 Mon Sep 17 00:00:00 2001 From: Nikola Zivkovic Date: Wed, 22 Feb 2023 17:02:45 +0100 Subject: [PATCH] Return the "file not found" error for ecx_FOEread() through wkc The "file not found" error is the most significant error that can be returned from the above function as it can affect and guide the work flow, so it makes sense to have it returned in some way. Since the same error has already been processed and returned in the ecx_FOEwrite() function, there is no reason not to process it and return it in the ecx_FOEread() function in the exact same way. --- soem/ethercatfoe.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/soem/ethercatfoe.c b/soem/ethercatfoe.c index 573cfc0c..fbf0218c 100644 --- a/soem/ethercatfoe.c +++ b/soem/ethercatfoe.c @@ -163,7 +163,15 @@ int ecx_FOEread(ecx_contextt *context, uint16 slave, char *filename, uint32 pass if(aFOEp->OpCode == ECT_FOE_ERROR) { /* FoE error */ - wkc = -EC_ERR_TYPE_FOE_ERROR; + if (aFOEp->ErrorCode == 0x8001) + { + wkc = -EC_ERR_TYPE_FOE_FILE_NOTFOUND; + } + else + { + wkc = -EC_ERR_TYPE_FOE_ERROR; + } + break; } else {