diff options
author | Jenna Fox <a@creativepony.com> | 2012-09-30 11:14:00 +1000 |
---|---|---|
committer | Jenna Fox <a@creativepony.com> | 2012-09-30 11:14:00 +1000 |
commit | b5632254e453044e12ab3770f3f53dae2069437a (patch) | |
tree | 92ae68c1536683c43ceb75c31231466f81e7470d /commandline | |
parent | 93ee4971efb6d74d1c19791567c06239e9630e1d (diff) | |
download | micronucleus-b5632254e453044e12ab3770f3f53dae2069437a.tar.gz micronucleus-b5632254e453044e12ab3770f3f53dae2069437a.tar.bz2 micronucleus-b5632254e453044e12ab3770f3f53dae2069437a.zip |
Added Mac OS X compatibility to Ihsan's cli upload program
Diffstat (limited to 'commandline')
-rw-r--r-- | commandline/Makefile | 5 | ||||
-rw-r--r-- | commandline/library/littleWire_util.c | 9 | ||||
-rw-r--r-- | commandline/library/littleWire_util.h | 6 | ||||
-rw-r--r-- | commandline/library/micronucleus_lib.h | 6 | ||||
-rw-r--r-- | commandline/library/opendevice.h | 7 |
5 files changed, 20 insertions, 13 deletions
diff --git a/commandline/Makefile b/commandline/Makefile index e05f7a6..3c5f255 100644 --- a/commandline/Makefile +++ b/commandline/Makefile @@ -10,6 +10,11 @@ ifeq ($(shell uname), Linux) USBLIBS = `libusb-config --libs` EXE_SUFFIX = OSFLAG = -D LINUX +else ifeq ($(shell uname), Darwin) + USBFLAGS = `libusb-config --cflags` + USBLIBS = `libusb-config --libs` + EXE_SUFFIX = + OSFLAG = -D MAC_OS else USBFLAGS = -I C:\MinGW\include USBLIBS = -L C:\MinGW\lib -lusb diff --git a/commandline/library/littleWire_util.c b/commandline/library/littleWire_util.c index d711302..940a68d 100644 --- a/commandline/library/littleWire_util.c +++ b/commandline/library/littleWire_util.c @@ -1,12 +1,13 @@ - #include <littleWire_util.h> /* Delay in miliseconds */ void delay(unsigned int duration) { - #ifdef LINUX - usleep(duration*1000); - #else + #if defined _WIN32 || defined _WIN64 + // use windows sleep api with milliseconds Sleep(duration); + #else + // use standard unix api with microseconds + usleep(duration*1000); #endif } diff --git a/commandline/library/littleWire_util.h b/commandline/library/littleWire_util.h index dac8623..27dc172 100644 --- a/commandline/library/littleWire_util.h +++ b/commandline/library/littleWire_util.h @@ -1,10 +1,10 @@ #ifndef LITTLEWIRE_UTIL_H #define LITTLEWIRE_UTIL_H -#ifdef LINUX - #include <unistd.h> +#if defined WIN + #include <windows.h> #else - #include <windows.h> + #include <unistd.h> #endif /* Delay in miliseconds */ diff --git a/commandline/library/micronucleus_lib.h b/commandline/library/micronucleus_lib.h index 8a004e4..b724a60 100644 --- a/commandline/library/micronucleus_lib.h +++ b/commandline/library/micronucleus_lib.h @@ -27,10 +27,10 @@ /******************************************************************************** * Header files ********************************************************************************/ -#if defined(LINUX) - #include <usb.h> // this is libusb, see http://libusb.sourceforge.net/ -#else +#if defined WIN #include <lusb0_usb.h> // this is libusb, see http://libusb.sourceforge.net/ +#else + #include <usb.h> // this is libusb, see http://libusb.sourceforge.net/ #endif #include "opendevice.h" // common code moved to separate module /*******************************************************************************/ diff --git a/commandline/library/opendevice.h b/commandline/library/opendevice.h index a23ed41..f687ccd 100644 --- a/commandline/library/opendevice.h +++ b/commandline/library/opendevice.h @@ -23,11 +23,12 @@ files according to the GNU General Public License (GPL) version 2 or 3. #ifndef __OPENDEVICE_H_INCLUDED__ #define __OPENDEVICE_H_INCLUDED__ -#if defined(LINUX) - #include <usb.h> // this is libusb, see http://libusb.sourceforge.net/ +#if defined WIN + #include <lusb0_usb.h> // this is libusb, see http://libusb.sourceforge.net/ #else - #include <lusb0_usb.h> // this is libusb, see http://libusb.sourceforge.net/ + #include <usb.h> // this is libusb, see http://libusb.sourceforge.net/ #endif + #include <stdio.h> int usbGetStringAscii(usb_dev_handle *dev, int index, char *buf, int buflen); |