From 94e4b301259840e1d43966367e0fefc3bb468021 Mon Sep 17 00:00:00 2001 From: geeksville Date: Sun, 6 Sep 2020 16:07:32 -0700 Subject: [PATCH] add crude sim getmacaddr --- src/portduino/PortduinoGlue.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/portduino/PortduinoGlue.cpp b/src/portduino/PortduinoGlue.cpp index 8ef3263fb..690af6071 100644 --- a/src/portduino/PortduinoGlue.cpp +++ b/src/portduino/PortduinoGlue.cpp @@ -4,9 +4,21 @@ // FIXME - move getMacAddr/setBluetoothEnable into a HALPlatform class +uint32_t hwId; // fixme move into portduino + void getMacAddr(uint8_t *dmac) { - notImplemented("getMacAddr"); + if (!hwId) { + notImplemented("getMacAddr"); + hwId = random(); + } + + dmac[0] = 0x80; + dmac[1] = 0; + dmac[2] = 0; + dmac[3] = hwId >> 16; + dmac[4] = hwId >> 8; + dmac[5] = hwId & 0xff; } void setBluetoothEnable(bool on)