<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
span.EmailStyle18
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle19
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle20
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:#1F497D;}
span.EmailStyle21
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle22
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle23
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:#1F497D;}
span.EmailStyle24
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle26
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-NZ link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>It will print the error on stderr (which will include the error code from the slave if the slave itself reports an error, which isn’t shown in your examples below). Otherwise no, there isn’t any way to get anything more detailed when using the command-line tool; you’d have to use the internal ioctl directly if you wanted the specific error. (Though again, none of the examples below are an ioctl error, they’re erroring out before it gets to that point.)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'> </span><span style='mso-fareast-language:EN-US'><o:p></o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US>From:</span></b><span lang=EN-US> Lingjie_Kong@amat.com [mailto:Lingjie_Kong@amat.com] <br><b>Sent:</b> Tuesday, 19 September 2017 05:15<br><b>To:</b> Gavin Lambert <gavin.lambert@compacsort.com>; etherlab-dev@etherlab.org<br><b>Subject:</b> RE: foe_write result<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Hi Gavin,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>I think I did make a mistake in my original test and what you said does work! <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>I did three tests as below. The first test is without in the specified folder, the second test is with file in the specified folder, and the third test is with amplifier turned off. The first test result is 1, the second is 0, and the third is 1. What you said works.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><img width=526 height=548 style='width:5.4791in;height:5.7083in' id="Picture_x0020_2" src="cid:image002.png@01D33136.6FFB46D0"><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>One more follow up question that I might have is that when file transfer works, the result is 0. Otherwise, the result is 1. Therefore, I am just wondering that is there some more detailed information that I can log to see what actually cause the failure of the transfer.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><div><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;color:#7B7B7B'>Best regards,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;color:#7B7B7B'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;color:#7B7B7B'>Lingjie (Kimi) Kong<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;color:#7B7B7B'>Software Engineer – Servo Control Engineering || Common Solution Group || Applied Materials<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;color:#7B7B7B'><a href="mailto:lingjie_kong@amat.com">lingjie_kong@amat.com</a> || Office: (408)563-4400 || Cell: (858)242-9076</span><span lang=EN-US style='color:gray'><br><br></span><span lang=EN-US style='font-size:10.0pt;color:gray'>The content of this message is Applied Materials Confidential. If you are not the intended recipient and have received this message in error, any use or distribution is prohibited. Please notify me immediately by reply e-mail and delete this message from your computer system. Thank you. </span><span lang=EN-US style='color:gray'><br><br></span><span lang=EN-US style='font-size:10.0pt;color:gray'>** Save a tree. Please don't print this e-mail unless needed.</span><span lang=EN-US style='color:#1F497D'><o:p></o:p></span></p></div><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US>From:</span></b><span lang=EN-US> Gavin Lambert [<a href="mailto:gavinl@compacsort.com">mailto:gavinl@compacsort.com</a>] <br><b>Sent:</b> Thursday, September 14, 2017 6:02 PM<br><b>To:</b> Lingjie Kong --TR <<a href="mailto:Lingjie_Kong@amat.com">Lingjie_Kong@amat.com</a>>; <a href="mailto:etherlab-dev@etherlab.org">etherlab-dev@etherlab.org</a><br><b>Subject:</b> RE: foe_write result<o:p></o:p></span></p></div></div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>That’s odd, it definitely should be returning exit code 1 on any error according to the code. Are you sure you’re testing it correctly?<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>But no, it does check whether the slave reports successfully receiving the file or not and will return 1 in case of error on that end as well. (Depending on the slave, this may or may not also indicate whether it was successfully saved to the slave’s internal memory or not.)<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>There is no documentation on the ioctls other than the source itself; they’re an internal interface mostly intended to be used only by the command line tool and userspace library. You will need to look at the source of the tool for inspiration if you want to use them directly. It’s safer and easier to use the tool commands if that suits your usage requirements however; they just provide less detail for programmatic use.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'> </span><span style='mso-fareast-language:EN-US'><o:p></o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US>From:</span></b><span lang=EN-US> <a href="mailto:Lingjie_Kong@amat.com">Lingjie_Kong@amat.com</a> [<a href="mailto:Lingjie_Kong@amat.com">mailto:Lingjie_Kong@amat.com</a>] <br><b>Sent:</b> Friday, 15 September 2017 12:07<br><b>To:</b> Gavin Lambert <<a href="mailto:gavin.lambert@compacsort.com">gavin.lambert@compacsort.com</a>>; <a href="mailto:etherlab-dev@etherlab.org">etherlab-dev@etherlab.org</a><br><b>Subject:</b> RE: foe_write result<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Hi Gavin,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Thanks for your advices and I really appreciated. I still get several questions that I want to double check with you.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>First, I assume the error on return non-zero exit code in case of error only check whether the linux command is executed successfully or not. It does not actually get the status of the slave to see whether it received the file successfully. <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>For example, I am trying to send a file in a folder over ethercat while leave the folder empty by issuing the command<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:maroon'>ethercat -m0 foe_write -p0 /var/ftp/gather/Drive_configuration.ccd<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>it shows that Failed to open ‘/var/ftp/gather/Drive_configuration.ccd’ in stderr. However, the exit code is still 0 which means no error. <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Second, is there a specific document on how to use ioctl to send file over FoE in detail because I am not exactly sure on where to start on the source code.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><div><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;color:#7B7B7B'>Best regards,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;color:#7B7B7B'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;color:#7B7B7B'>Lingjie (Kimi) Kong<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;color:#7B7B7B'>Software Engineer – Servo Control Engineering || Common Solution Group || Applied Materials<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;color:#7B7B7B'><a href="mailto:lingjie_kong@amat.com">lingjie_kong@amat.com</a> || Office: (408)563-4400 || Cell: (858)242-9076</span><span lang=EN-US style='color:gray'><br><br></span><span lang=EN-US style='font-size:10.0pt;color:gray'>The content of this message is Applied Materials Confidential. If you are not the intended recipient and have received this message in error, any use or distribution is prohibited. Please notify me immediately by reply e-mail and delete this message from your computer system. Thank you. </span><span lang=EN-US style='color:gray'><br><br></span><span lang=EN-US style='font-size:10.0pt;color:gray'>** Save a tree. Please don't print this e-mail unless needed.</span><span lang=EN-US style='color:#1F497D'><o:p></o:p></span></p></div><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US>From:</span></b><span lang=EN-US> Gavin Lambert [<a href="mailto:gavinl@compacsort.com">mailto:gavinl@compacsort.com</a>] <br><b>Sent:</b> Thursday, September 14, 2017 3:52 PM<br><b>To:</b> Lingjie Kong --TR <<a href="mailto:Lingjie_Kong@amat.com">Lingjie_Kong@amat.com</a>>; <a href="mailto:etherlab-dev@etherlab.org">etherlab-dev@etherlab.org</a><br><b>Subject:</b> RE: foe_write result<o:p></o:p></span></p></div></div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>The “foe_write” ethercat command will print an error on stderr and return a non-zero exit code in case of error. It’s intended to be used interactively by whoever is commissioning the system, although it can be used in a script.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>Alternatively if you want to call it programmatically you could use the equivalent master ioctl call directly, which provides the specific FoE error code.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>The unofficial patchset also adds some additional ecrt.h APIs that you can call for FoE, although these require more “plumbing” to use.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'> </span><span style='mso-fareast-language:EN-US'><o:p></o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US>From:</span></b><span lang=EN-US> <a href="mailto:Lingjie_Kong@amat.com">Lingjie_Kong@amat.com</a><br><b>Sent:</b> Friday, 15 September 2017 10:25<br><b>To:</b> <a href="mailto:etherlab-dev@etherlab.org">etherlab-dev@etherlab.org</a><br><b>Subject:</b> [etherlab-dev] foe_write result<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-US>Hi,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>I am working on file over ethercat (FOE) to send motor driver’s configuration file. From the ethercat 1.5.2 document, it looks like I can use foe_write to send the file. However, I am just wondering that what I can check to see whether the file transfer is successfully or not. <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;color:#7B7B7B'>Best regards,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;color:#7B7B7B'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;color:#7B7B7B'>Lingjie (Kimi) Kong<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;color:#7B7B7B'>Software Engineer – Servo Control Engineering || Common Solution Group || Applied Materials<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;color:#7B7B7B'><a href="mailto:lingjie_kong@amat.com">lingjie_kong@amat.com</a> || Office: (408)563-4400</span><span lang=EN-US style='font-size:12.0pt;font-family:"Times New Roman",serif'><o:p></o:p></span></p></div><p class=MsoNormal><span lang=EN-US style='font-size:12.0pt;font-family:"Times New Roman",serif'><o:p> </o:p></span></p><div class=MsoNormal align=center style='text-align:center'><span lang=EN-US style='font-size:12.0pt;font-family:"Times New Roman",serif'><hr size=2 width="100%" align=center></span></div><p class=MsoNormal><span lang=EN-US style='font-size:12.0pt;font-family:"Times New Roman",serif'><o:p> </o:p></span></p></div><p class=MsoNormal><span lang=EN-US style='font-size:12.0pt;font-family:"Times New Roman",serif'><o:p> </o:p></span></p><div class=MsoNormal align=center style='text-align:center'><span lang=EN-US style='font-size:12.0pt;font-family:"Times New Roman",serif'><hr size=2 width="100%" align=center></span></div><p class=MsoNormal><span lang=EN-US style='font-size:12.0pt;font-family:"Times New Roman",serif'><o:p> </o:p></span></p></div></div></body></html>