Skip to content

Commit

Permalink
Enabled debugging; initialized usb and corrected to use managed Malloc
Browse files Browse the repository at this point in the history
  • Loading branch information
zerkerX committed Mar 9, 2019
1 parent 2c0c108 commit abfe73e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions anago/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ SQUIRREL = /usr/include/squirrel3

KAZZO = ../unagi_kazzo/firmware
VPATH = ..
#CFLAGS = -g -O0
CFLAGS = -O2
CFLAGS = -g -O0
#CFLAGS = -O2
#CFLAGS += -Wall -Werror -I.. -I$(LIBUSB)/include -I$(SQUIRREL)/include -I$(KAZZO) -DDEBUG=1 -DANAGO=1
CFLAGS += -Wall -Werror -I.. -I$(KAZZO) -I$(SQUIRREL) -DDEBUG=1 -DANAGO=1
#LDFLAG = -L. -L$(LIBUSB)/lib/gcc -L$(SQUIRREL)/lib
Expand Down
9 changes: 6 additions & 3 deletions reader_kazzo.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ static usb_dev_handle *device_open(void)
vid = (rawVid[1] << 8) | rawVid[0];
pid = (rawPid[1] << 8) | rawPid[0];

if(usbOpenDevice(&handle, vid, vendor, pid, product, NULL, NULL, NULL) == 0){
usb_init();
int open_result = usbOpenDevice(&handle, vid, vendor, pid, product, NULL, NULL, NULL);
if(open_result == USBOPEN_SUCCESS){
return handle;
}
fprintf(stderr, "Could not find USB device \"%s\" with vid=0x%x pid=0x%x\n", product, vid, pid);
fprintf(stderr, "Could not find USB device \"%s\" with vid=0x%x pid=0x%x; code: %d\n",
product, vid, pid, open_result);
return NULL;
}

Expand Down Expand Up @@ -96,7 +99,7 @@ bits. To prevent losting bits, mask data xor 0xa5;
static void device_write(usb_dev_handle *handle, enum request w,
enum index index, long address, long length, const uint8_t *data)
{
uint8_t *d = malloc(length);
uint8_t *d = Malloc(length);
int i;
memcpy(d, data, length);
for(i = 0; i < length; i++){
Expand Down

0 comments on commit abfe73e

Please sign in to comment.