8.7. Linux SockRaw - emllSockRaw
emllSockRaw is part of EC-Monitor for Linux. emllSockRaw uses the native network adapter, e.g. eth0, eth1, etc . The network adapter must be exclusively used for EtherCAT and cannot be used for LAN (local area network) at the same time. Because the native Linux driver for the network adapter type is typically not fully real-time capable, it cannot be used for real time applications. If possible, an acontis Real-time Ethernet Driver, e.g. emllIntelGbe, should be used instead. emllSockRaw does not need the atemsys driver.
Note
Root privileges are required. A cycle time of 4 ms or higher may be needed.
- To run the application without root privileges, set the Linux capability ‘cap_net_raw’ to the application.
sudo setcap 'cap_net_raw+pe' ./EcMasterDemo- To run python scripts without root privileges, create a python environment and set the Linux capability ‘cap_net_raw’ to the python interpreter.
cd Bin/Linux python3 -m venv --copies PyEnv/ source PyEnv/bin/activate sudo setcap 'cap_net_raw+pe' PyEnv/bin/python3
The parameters to emllSockRaw are setup-specific. The function CreateLinkParmsFromCmdLineSockRaw() in EcSelectLinkLayer.cpp demonstrates how to initialize the parameters.
-
struct EC_T_LINK_PARMS_SOCKRAW
Public Members
-
EC_T_LINK_PARMS linkParms
Common link parameters. Signature must be set to EC_LINK_PARMS_SIGNATURE_SOCKRAW
-
EC_T_CHAR szAdapterName[EC_SOCKRAW_ADAPTER_NAME_SIZE]
Native ETH device name, e.g. “eth0” (zero terminated)
-
EC_T_BOOL bDisableForceBroadcast
Don’t change target MAC address to FF:FF:FF:FF:FF:FF
-
EC_T_BOOL bReplacePaddingWithNopCmd
Prevent adding Ethernet padding to work-around EtherCAT corruption bugs from native Linux driver(s).
-
EC_T_BOOL bUsePacketMmapRx
Use PACKET_MMAP PACKET_RX_RING for receive
-
EC_T_BOOL bSetCoalescingParms
Set Coalescing parameters to enhance the link layer performance
-
EC_T_BOOL bSetPromiscuousMode
Enable promiscuous mode at network adapter
-
EC_T_LINK_PARMS linkParms