Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davidbuzz/2741be7a5e5c61fe2b0745a4065cc07d to your computer and use it in GitHub Desktop.
Save davidbuzz/2741be7a5e5c61fe2b0745a4065cc07d to your computer and use it in GitHub Desktop.
From 8f72fb6025973d11205d3d87b26705c2065a8a78 Mon Sep 17 00:00:00 2001
From: Buzz <davidbuzz@gmail.com>
Date: Thu, 8 Jun 2017 12:48:02 +1000
Subject: [PATCH] make tridges code build/run on osx.
---
web_server/functions.c | 2 +-
web_server/linux/util_linux.c | 9 +++++++--
web_server/linux/util_linux.h | 2 +-
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/web_server/functions.c b/web_server/functions.c
index 421faf9..38e05f5 100644
--- a/web_server/functions.c
+++ b/web_server/functions.c
@@ -320,7 +320,7 @@ static void mavlink_message_send(struct template_state *tmpl, const char *name,
static void reboot_companion(struct template_state *tmpl, const char *name, const char *value, int argc, char **argv)
{
console_printf("rebooting ...\n");
- reboot();
+ __reboot();
}
extern void snx_nvram_bootup_upgrade(void);
diff --git a/web_server/linux/util_linux.c b/web_server/linux/util_linux.c
index 1f3bc87..4f3e4b1 100644
--- a/web_server/linux/util_linux.c
+++ b/web_server/linux/util_linux.c
@@ -65,9 +65,14 @@ bool toggle_recording(void)
return false;
}
-void reboot(void)
+void __reboot(void)
{
- printf("reboot not implemented\n");
+ #if __APPLE__
+ printf("reboot OSX implemented, but disabled for now.\n");
+ //reboot(0);
+ #else
+ printf("reboot not implemented\n");
+ #endif
}
diff --git a/web_server/linux/util_linux.h b/web_server/linux/util_linux.h
index ed656e6..35577d1 100644
--- a/web_server/linux/util_linux.h
+++ b/web_server/linux/util_linux.h
@@ -20,8 +20,8 @@ uint32_t get_time_boot_ms();
void mdelay(uint32_t ms);
bool toggle_recording(void);
-void reboot(void);
+void __reboot(void); // __ so we don't call the os version of this by mistake.
char *print_vprintf(void *ctx, const char *fmt, va_list ap);
void *print_printf(void *ctx, const char *fmt, ...);
--
2.8.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment