ChuckMash / ESPythoNOW

A python library for sending, receiving, and monitoring ESP-NOW messages
MIT License
44 stars 6 forks source link

Fixed issue n3: no member "get_if_raw_hwaddr" #4

Open TechTheGuy opened 1 month ago

TechTheGuy commented 1 month ago

Here's the pull request I was referring to in issue n3: The code sends the packets (I checked with Wireshark). The problem is that my esp8266 doesn't receive them for some reason... I don't know what to think... I mean, the code at least runs now. Thanks

ChuckMash commented 3 weeks ago

Can you check with scapy version 2.5.0? This yields an error for me

raise Scapy_Exception("Unsupported address family (%i) for interface [%s]" % (addrfamily, iff))  # noqa: E501
scapy.error.Scapy_Exception: Unsupported address family (803) for interface [*interface*]
ChuckMash commented 3 weeks ago

Ah, The issue for me with this is after my interface is put into monitor mode, the previous error occurs. If I skip prep.sh then it works correctly, but then scapy cannot do what we need it to do.

I suggest the following try except for the time being.

  def hw_mac_as_str(self, interface):
    try:
      return scapy.get_if_hwaddr(interface).upper()
    except:
      return ("%02X:" * 6)[:-1] % tuple(scapy.orb(x) for x in scapy.get_if_raw_hwaddr(self.l2_socket.iface)[1])

If that works for you, please update the PR with this and I will approve it.