+ if (serial) {
+ if (desc.iSerialNumber > 0) {
+ uint8_t devSerial[256];
+ err = libusb_get_string_descriptor_ascii(devh, desc.iSerialNumber, devSerial, sizeof(devSerial));
+ if (err < 0) {
+ fprintf(stderr, "Can't read serial-number: %s\n", usb_strerror(err));
+ libusb_close(devh);
+ libusb_free_device_list(list, 1);
+ return NULL;
+ }
+ if (strcmp((char*)devSerial, (char*)serial)) {
+ libusb_close(devh);
+ continue;
+ }
+ } else {
+ libusb_close(devh);
+ continue;
+ }
+ }
+