Added Mac OSX support for the bootloaderhost utility (not tested)
authorMichael McMaster <michael@codesrc.com>
Sun, 27 Oct 2013 11:35:25 +0000 (21:35 +1000)
committerMichael McMaster <michael@codesrc.com>
Sun, 27 Oct 2013 11:35:25 +0000 (21:35 +1000)
software/bootloaderhost/Makefile
software/bootloaderhost/main.c

index 8f5d66f..8c09067 100644 (file)
@@ -6,6 +6,7 @@ CYAPI = \
        cybootloaderutils/cybtldr_command.c \
        cybootloaderutils/cybtldr_parse.c \
 
+CFLAGS += -Wall -Wno-pointer-sign
 
 UNAME_S := $(shell uname -s)
 ifeq ($(UNAME_S),Linux)
@@ -15,11 +16,12 @@ endif
 ifeq ($(UNAME_S),Darwin)
        # Should match OSX
        HID_C = hidapi/mac/hid.c
+       LDFLAGS += -framework IOKit -framework CoreFoundation
 endif
 
 
 bootloaderhost: main.c $(HID_C) $(CYAPI)
-       $(CC) $(CFLAGS) -g -I cybootloaderutils -I hidapi/hidapi $^ $(LDFLAGS) -o $@
+       $(CC) $(CFLAGS) -I cybootloaderutils -I hidapi/hidapi $^ $(LDFLAGS) -o $@
 
 clean:
        rm bootloaderhost
index fdeb4af..c42f41f 100644 (file)
@@ -110,10 +110,10 @@ int main(int argc, char* argv[])
                switch (c)
                {
                case 'v':
-                       sscanf(optarg, "%x", &vendorId);
+                       sscanf(optarg, "%hx", &vendorId);
                        break;
                case 'p':
-                       sscanf(optarg, "%x", &productId);
+                       sscanf(optarg, "%hx", &productId);
                        break;
                case '?':
                        usage();