Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.

Commit

Permalink
Fix --usb-dump when reinit_usb() is called
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshilliard committed Feb 10, 2017
1 parent 2e54afb commit 33db3a4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cgminer.c
Original file line number Diff line number Diff line change
Expand Up @@ -9621,9 +9621,11 @@ static void reinit_usb(void)

applog(LOG_DEBUG, "Reinitialising libusb");
libusb_exit(NULL);
cgusb_uninitialize();
err = libusb_init(NULL);
if (err)
quit(1, "Reinit of libusb failed err %d:%s", err, libusb_error_name(err));
cgusb_check_init();
usb_reinit = false;
}

Expand Down
7 changes: 6 additions & 1 deletion usbutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1484,7 +1484,12 @@ void usb_all(int level)
libusb_free_device_list(list, 1);
}

static void cgusb_check_init()
void cgusb_uninitialize()
{
stats_initialised = false;
}

void cgusb_check_init()
{
mutex_lock(&cgusb_lock);

Expand Down
2 changes: 2 additions & 0 deletions usbutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,8 @@ struct cgpu_info;
bool async_usb_transfers(void);
void cancel_usb_transfers(void);
void usb_all(int level);
void cgusb_check_init();
void cgusb_uninitialize();
void usb_list(void);
const char *usb_cmdname(enum usb_cmds cmd);
void usb_applog(struct cgpu_info *cgpu, enum usb_cmds cmd, char *msg, int amount, int err);
Expand Down

0 comments on commit 33db3a4

Please sign in to comment.