Simplify dfu routines for windows.

This commit is contained in:
Serge Vakulenko 2018-09-08 14:34:52 -07:00
parent 480c612650
commit 50115606fb
2 changed files with 10 additions and 5 deletions

View File

@ -16,6 +16,11 @@ ifeq (/usr/bin/i686-w64-mingw32-gcc,$(wildcard /usr/bin/i686-w64-mingw32-gcc))
CC = i686-w64-mingw32-gcc CC = i686-w64-mingw32-gcc
endif endif
# Compiling Windows binary from Mac OS
ifeq (/usr/local/bin/i686-w64-mingw32-gcc,$(wildcard /usr/local/bin/i686-w64-mingw32-gcc))
CC = i686-w64-mingw32-gcc
endif
all: dmrconfig.exe all: dmrconfig.exe
dmrconfig.exe: $(OBJS) dmrconfig.exe: $(OBJS)

View File

@ -86,7 +86,7 @@ typedef struct {
static HANDLE dev; static HANDLE dev;
static status_t status; static status_t status;
static int dev_request(int request, int value, int index) static int dev_request(int request, int value)
{ {
CNTRPIPE_RQ rq; CNTRPIPE_RQ rq;
DWORD nbytes = 0; DWORD nbytes = 0;
@ -95,7 +95,7 @@ static int dev_request(int request, int value, int index)
rq.Direction = VENDOR_DIRECTION_OUT; rq.Direction = VENDOR_DIRECTION_OUT;
rq.Request = request; rq.Request = request;
rq.Value = value; rq.Value = value;
rq.Index = index; rq.Index = 0;
rq.Length = 0; rq.Length = 0;
if (!DeviceIoControl(dev, PU_VENDOR_REQUEST, &rq, sizeof(rq), if (!DeviceIoControl(dev, PU_VENDOR_REQUEST, &rq, sizeof(rq),
@ -154,7 +154,7 @@ static int detach(int timeout)
if (trace_flag) { if (trace_flag) {
printf("--- Send DETACH\n"); printf("--- Send DETACH\n");
} }
int error = dev_request(REQUEST_DETACH, timeout, 0); int error = dev_request(REQUEST_DETACH, timeout);
return error; return error;
} }
@ -177,7 +177,7 @@ static int clear_status()
if (trace_flag) { if (trace_flag) {
printf("--- Send CLRSTATUS\n"); printf("--- Send CLRSTATUS\n");
} }
int error = dev_request(REQUEST_CLRSTATUS, 0, 0); int error = dev_request(REQUEST_CLRSTATUS, 0);
return error; return error;
} }
@ -203,7 +203,7 @@ static int dfu_abort()
if (trace_flag) { if (trace_flag) {
printf("--- Send ABORT\n"); printf("--- Send ABORT\n");
} }
int error = dev_request(REQUEST_ABORT, 0, 0); int error = dev_request(REQUEST_ABORT, 0);
return error; return error;
} }