+ devBus=atoi(device);
+ *c++=0;
+ devAddr=atoi(c);
+ ILOG("bus %03d dev %03d\n",devBus, devAddr);
+ }
+ while (cnt){
+ cnt--;
+ libusb_get_device_descriptor( list[cnt], &desc );
+ if (desc.idVendor!=USB_ST_VID) continue;
+ if (devBus && devAddr)
+ if ((libusb_get_bus_number(list[cnt])!=devBus) || (libusb_get_device_address(list[cnt])!=devAddr)) continue;
+ if (desc.idProduct == USB_STLINK_32L_PID) break;
+ 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;
+ } 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]));
+ goto on_error;
+ }