Skip to content

Commit

Permalink
Merge pull request #151 from kevlar26/master
Browse files Browse the repository at this point in the history
Ensure USB device search succeeds if the matched device is at index 0.
  • Loading branch information
texane committed May 7, 2013
2 parents 3e0acd0 + 4e09a06 commit 992a9c2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/stlink-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,9 +757,9 @@ stlink_t* stlink_open_usb(const int verbose) {
if (desc.idProduct == USB_STLINK_PID) slu->protocoll = 1; break;
}

if (cnt==0){
WLOG("Couldn't find %s ST-Link/V2 devices\n",(devBus && devAddr)?"matched":"any");
goto on_error;
if (cnt < 0) {
WLOG ("Couldn't find %s ST-Link/V2 devices\n",(devBus && devAddr)?"matched":"any");
goto on_error;
} else {
if( libusb_open(list[cnt], &slu->usb_handle) !=0){
WLOG("Couldn't open ST-Link/V2 device %03d:%03d\n",libusb_get_bus_number(list[cnt]), libusb_get_device_address(list[cnt]));
Expand Down

0 comments on commit 992a9c2

Please sign in to comment.