This is a static, read-only archive of Wireshark Q&A. Older questions and answers from October 2017 and earlier can be found at osqa-ask.wireshark.org.
0

EtherCAT command enum invalid

asked Jun 02 '26

In some previous version, I can use filter such as ecat.cmd == BRD to find specific datagram of EtherCAT.
However in Version 4.6.6 or other recent versions, I can't do that and there is "BRD" cannot be found among the possible values for ecat.cmd. displaying at the bottom of the software.
I will appreciate it if support for doing that could be restored.

1 Answer

0

answered Jun 02 '26

fc06600d: EtherCAT: General improvements

         { &hf_ecat_cmd,
           { "Command", "ecat.cmd",
-             FT_UINT8, BASE_HEX, VALS(EcCmdShort), 0x0, NULL, HFILL }
+            FT_UINT8, BASE_HEX, VALS(EcCmdLong), 0x0, NULL, HFILL }
         },

Field was changed to use the long value strings:
ecat.cmd == "Broadcast Read"

The sub cmd fields still use short name:
ecat.sub1.cmd == BRD still supported but ecat.sub1.cmd == "BRD" preferred.

packet-ethercat-datagram.c:

static const value_string EcCmdLong[] =
{
   {     0, "No operation" },
   {     1, "Auto Increment Physical Read" },
   {     2, "Auto Increment Physical Write" },
   {     3, "Auto Increment Physical ReadWrite" },
   {     4, "Configured address Physical Read" },
   {     5, "Configured address Physical Write" },
   {     6, "Configured address Physical ReadWrite" },
   {     7, "Broadcast Read" },
   {     8, "Broadcast Write" },
   {     9, "Broadcast ReadWrite" },
   {    10, "Logical Read" },
   {    11, "Logical Write" },
   {    12, "Logical ReadWrite" },
   {    13, "Auto Increment Physical Read Multiple Write" },
   {    14, "Configured Address Physical Read Multiple Write" },
   {   255, "EXT" },
   {   0, NULL }
};

Comments

Thanks, I tried your method and it works.
However, writing the full name is still quite troublesome.
And sub* need to traverse to find each sub-datagrams.

User 1205 ( Jun 02 '26 )

Agreed. Not sure why the field change.
Couple options:
You could make a Display filter macro that checks all the sub cmds.
How can I make display filter conditions to the same datagram?

You could use Lua to add another field that would support filtering on the short name but makes the packet details tree messy with an extra custom protocol to hold the field.

User 2763 ( Jun 02 '26 )
"ecat_cmd_1" ecat.sub1.cmd == $1 or ecat.sub2.cmd == $1 or ecat.sub3.cmd == $1 or ecat.sub4.cmd == $1 or ecat.sub5.cmd == $1
"ecat_cmd_2" ecat.sub6.cmd == $1 or ecat.sub7.cmd == $1 or ecat.sub8.cmd == $1 or ecat.sub9.cmd == $1 or ecat.sub10.cmd == $1
"ecat_cmd" ${ecat_cmd_1;$1} or ${ecat_cmd_2;$1}

$ecat_cmd{"BRD"}

User 2763 ( Jun 02 '26 )

Thanks, using macro is an almost perfect method.

User 1205 ( Jun 02 '26 )
cc-by-sa Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.