@@ -9,6 +9,27 @@
#include <linux/netdevice.h>
+typedef u8 lora_eui[8];
+
+#define PRIxLORAEUI "%02x%02x%02x%02x%02x%02x%02x%02x"
+#define PRIXLORAEUI "%02X%02X%02X%02X%02X%02X%02X%02X"
+#define LORA_EUI(x) x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7]
+
+static inline int lora_strtoeui(const char *str, lora_eui *val)
+{
+ char buf[3];
+ int i, ret;
+
+ for (i = 0; i < 8; i++) {
+ strncpy(buf, str + i * 2, 2);
+ buf[2] = 0;
+ ret = kstrtou8(buf, 16, &(*val)[i]);
+ if (ret)
+ return ret;
+ }
+ return 0;
+}
+
struct net_device *alloc_loradev(int sizeof_priv);
void free_loradev(struct net_device *dev);
int register_loradev(struct net_device *dev);
These will be used by the RN2483 and other LoRaWAN capable modules. Signed-off-by: Andreas Färber <afaerber@suse.de> --- include/linux/lora/dev.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) -- 2.16.4