From c84f2ab57997e6596d9cd8b2794cd231b71eb75e Mon Sep 17 00:00:00 2001 From: Daniel Beer Date: Thu, 13 May 2010 16:45:38 +1200 Subject: [PATCH] Modifications to compile on Cygwin. --- .gitignore | 1 + Makefile | 4 +++- rf2500.c | 4 ++-- util.c | 10 +++------- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 9f0e61c..dede4b8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .*.swp *.o mspdebug +mspdebug.exe diff --git a/Makefile b/Makefile index 11b79a7..108c375 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,8 @@ READLINE_CFLAGS = -DUSE_READLINE READLINE_LIBS = -lreadline endif +MSPDEBUG_CFLAGS = -O1 -Wall -Wno-char-subscripts -ggdb + all: mspdebug clean: @@ -45,4 +47,4 @@ mspdebug: main.o fet.o rf2500.o dis.o uif.o ihex.o elf32.o stab.o util.o \ $(CC) $(LDFLAGS) -o $@ $^ -lusb $(READLINE_LIBS) .c.o: - $(CC) $(CFLAGS) $(READLINE_CFLAGS) -O1 -Wall -ggdb -o $@ -c $*.c + $(CC) $(CFLAGS) $(READLINE_CFLAGS) $(MSPDEBUG_CFLAGS) -o $@ -c $*.c diff --git a/rf2500.c b/rf2500.c index e805463..39bf94a 100644 --- a/rf2500.c +++ b/rf2500.c @@ -65,7 +65,7 @@ static int open_interface(struct rf2500_transport *tr, return -1; } -#ifndef __APPLE__ +#if !(defined(__APPLE__) || defined(WIN32)) if (usb_detach_kernel_driver_np(tr->handle, tr->int_number) < 0) perror("rf2500: warning: can't " "detach kernel driver"); @@ -124,7 +124,7 @@ static int usbtr_send(transport_t tr_base, const uint8_t *data, int len) debug_hexdump("USB transfer out", pbuf, txlen); #endif if (usb_bulk_write(tr->handle, USB_FET_OUT_EP, - (const char *)pbuf, txlen, 10000) < 0) { + (char *)pbuf, txlen, 10000) < 0) { perror("rf2500: can't send data"); return -1; } diff --git a/util.c b/util.c index 1c0a1df..0ed1d01 100644 --- a/util.c +++ b/util.c @@ -40,12 +40,7 @@ static void sigint_handler(int signum) void ctrlc_init(void) { - const static struct sigaction siga = { - .sa_handler = sigint_handler, - .sa_flags = 0 - }; - - sigaction(SIGINT, &siga, NULL); + signal(SIGINT, sigint_handler); } void ctrlc_reset(void) @@ -111,7 +106,8 @@ int open_serial(const char *device, int rate) tcgetattr(fd, &attr); cfmakeraw(&attr); - cfsetspeed(&attr, rate); + cfsetispeed(&attr, rate); + cfsetospeed(&attr, rate); if (tcsetattr(fd, TCSAFLUSH, &attr) < 0) return -1;