Description
I try to connect a Raspberry via iWLAN to my PLC using p-net. When using eth0, everything works fine, but when using wlan0 p-net won't establish a connection. I debugged the problem and found that p-net is indirectly calling ethtool to determine the connection type, which only supports cable based connections.
Specifically, the call stack is
- pnal_eth_get_status
- pf_pdport_update_eth_status
- bg_worker_task
In pnal_eth_get_status (pnal.c), we finally hafe the condition
if(ioctl(control_socket, SIOCETHTOOL, &ifr) >= 0)
{..}
which evaluates to false when ifr.ifr_name is "wlan0" and causes the problem.
When I (just out of curiousity) hard-coded the following else-statement
if(ioctl(control_socket, SIOCETHTOOL, &ifr) >= 0)
{..}
else
{
status->is_autonegotiation_enabled = true;
status->is_autonegotiation_supported = true;
status->operational_mau_type = PNAL_ETH_MAU_COPPER_100BaseTX_FULL_DUPLEX;
status->autonegotiation_advertised_capabilities = PNAL_ETH_AUTONEG_CAP_UNKNOWN;
ret = 0;
}
p-net runs without problems and I can establish the connection to the PLC via iWLAN. Using PNAL_ETH_MAU_RADIO
instead however not works, since this results in p-net believing my network speed is too low. Specifically, in pf_cmdev.c,
if(pf_cmdev_check_pvdev(net) == 0)
{..}
evaluates to false.
Is there a way to add iWLAN support to p-net? From the outside, the problem seems to only/mainly be the call to ethtool which doesn't support WLAN network interfaces (and maybe pf_cmdev_check_pvdev
ranking PNAL_ETH_MAU_RADIO
to be slower than PNAL_ETH_MAU_COPPER_100BaseTX_FULL_DUPLEX
)? Or do you know a way to trick ethtool to believe that wlan0 is cable based?
Thanks a lot!
Moritz