#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <jtag/drivers/jtag_usb_common.h>
+
+#include <string.h>
+
+#include <helper/log.h>
+#include <jtag/adapter.h>
#include "libusb_helper.h"
-#include "log.h"
/*
* comment from libusb:
}
dev_bus = libusb_get_bus_number(device);
- return jtag_usb_location_equal(dev_bus, port_path, path_len);
+ return adapter_usb_location_equal(dev_bus, port_path, path_len);
}
#else /* HAVE_LIBUSB_GET_PORT_NUMBERS */
static bool jtag_libusb_location_equal(struct libusb_device *device)
char *alternate_serial = adapter_get_alternate_serial(device, dev_desc);
/* check possible failures */
- if (alternate_serial == NULL)
+ if (!alternate_serial)
return false;
/* then compare and free the alternate serial */
if (!jtag_libusb_match_ids(&dev_desc, vids, pids))
continue;
- if (jtag_usb_get_location() && !jtag_libusb_location_equal(devs[idx]))
+ if (adapter_usb_get_location() && !jtag_libusb_location_equal(devs[idx]))
continue;
err_code = libusb_open(devs[idx], &libusb_handle);
}
/* Device must be open to use libusb_get_string_descriptor_ascii. */
- if (serial != NULL &&
+ if (serial &&
!jtag_libusb_match_serial(libusb_handle, &dev_desc, serial, adapter_get_alternate_serial)) {
serial_mismatch = true;
libusb_close(libusb_handle);
return retval;
retval = libusb_get_config_descriptor(udev, configuration, &config);
- if (retval != 0 || config == NULL)
+ if (retval != 0 || !config)
return retval;
/* Only change the configuration if it is not already set to the