Now that adapter serial is handled independently from the adapter
drivers, move inside jtag_libusb_open() the call to
adapter_get_required_serial(), so every adapter that uses libusb
will automagically get USB serial support.
Extend the documentation to list the adapters involved.
Change-Id: I75b3482d38f8ed3418329f3106c5e8b689fd460b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6663
Tested-by: jenkins
15 files changed:
Specifies the @var{serial_string} of the adapter to use.
If this command is not specified, serial strings are not checked.
Only the following adapter drivers use the serial string from this command:
Specifies the @var{serial_string} of the adapter to use.
If this command is not specified, serial strings are not checked.
Only the following adapter drivers use the serial string from this command:
-cmsis_dap, ft232r, ftdi, hla, jlink, kitprog, presto, st-link, vsllink, xds110.
+aice (aice_usb), arm-jtag-ew, cmsis_dap, ft232r, ftdi, hla (stlink, ti-icdi), jlink, kitprog, opendus,
+openjtag, osbdm, presto, rlink, st-link, usb_blaster (ublast2), usbprog, vsllink, xds110.
@end deffn
@section Interface Drivers
@end deffn
@section Interface Drivers
const uint16_t pids[] = { param->pid, 0 };
struct libusb_device_handle *devh;
const uint16_t pids[] = { param->pid, 0 };
struct libusb_device_handle *devh;
- if (jtag_libusb_open(vids, pids, NULL, &devh, NULL) != ERROR_OK)
+ if (jtag_libusb_open(vids, pids, &devh, NULL) != ERROR_OK)
return ERROR_FAIL;
/* BE ***VERY CAREFUL*** ABOUT MAKING CHANGES IN THIS
return ERROR_FAIL;
/* BE ***VERY CAREFUL*** ABOUT MAKING CHANGES IN THIS
/* reopen jlink after usb_reset
* on win32 this may take a second or two to re-enumerate */
int retval;
/* reopen jlink after usb_reset
* on win32 this may take a second or two to re-enumerate */
int retval;
- while ((retval = jtag_libusb_open(vids, pids, NULL, &devh, NULL)) != ERROR_OK) {
+ while ((retval = jtag_libusb_open(vids, pids, &devh, NULL)) != ERROR_OK) {
usleep(1000);
timeout--;
if (!timeout)
usleep(1000);
timeout--;
if (!timeout)
const uint16_t pids[] = { USB_PID, 0 };
struct libusb_device_handle *dev;
const uint16_t pids[] = { USB_PID, 0 };
struct libusb_device_handle *dev;
- if (jtag_libusb_open(vids, pids, NULL, &dev, NULL) != ERROR_OK)
+ if (jtag_libusb_open(vids, pids, &dev, NULL) != ERROR_OK)
return NULL;
struct armjtagew *result = malloc(sizeof(struct armjtagew));
return NULL;
struct armjtagew *result = malloc(sizeof(struct armjtagew));
{
uint16_t avids[] = {ft232r_vid, 0};
uint16_t apids[] = {ft232r_pid, 0};
{
uint16_t avids[] = {ft232r_vid, 0};
uint16_t apids[] = {ft232r_pid, 0};
- const char *ft232r_serial_desc = adapter_get_required_serial();
- if (jtag_libusb_open(avids, apids, ft232r_serial_desc, &adapter, NULL)) {
+ if (jtag_libusb_open(avids, apids, &adapter, NULL)) {
+ const char *ft232r_serial_desc = adapter_get_required_serial();
LOG_ERROR("ft232r not found: vid=%04x, pid=%04x, serial=%s\n",
ft232r_vid, ft232r_pid, (!ft232r_serial_desc) ? "[any]" : ft232r_serial_desc);
return ERROR_JTAG_INIT_FAILED;
LOG_ERROR("ft232r not found: vid=%04x, pid=%04x, serial=%s\n",
ft232r_vid, ft232r_pid, (!ft232r_serial_desc) ? "[any]" : ft232r_serial_desc);
return ERROR_JTAG_INIT_FAILED;
-#include <jtag/adapter.h>
#include <jtag/interface.h>
#include <jtag/swd.h>
#include <jtag/commands.h>
#include <jtag/interface.h>
#include <jtag/swd.h>
#include <jtag/commands.h>
const uint16_t vids[] = { VID, 0 };
const uint16_t pids[] = { PID, 0 };
const uint16_t vids[] = { VID, 0 };
const uint16_t pids[] = { PID, 0 };
- if (jtag_libusb_open(vids, pids, adapter_get_required_serial(),
- &kitprog_handle->usb_handle, NULL) != ERROR_OK) {
+ if (jtag_libusb_open(vids, pids, &kitprog_handle->usb_handle, NULL) != ERROR_OK) {
LOG_ERROR("Failed to open or find the device");
return ERROR_FAIL;
}
LOG_ERROR("Failed to open or find the device");
return ERROR_FAIL;
}
}
int jtag_libusb_open(const uint16_t vids[], const uint16_t pids[],
}
int jtag_libusb_open(const uint16_t vids[], const uint16_t pids[],
struct libusb_device_handle **out,
adapter_get_alternate_serial_fn adapter_get_alternate_serial)
{
struct libusb_device_handle **out,
adapter_get_alternate_serial_fn adapter_get_alternate_serial)
{
int retval = ERROR_FAIL;
bool serial_mismatch = false;
struct libusb_device_handle *libusb_handle = NULL;
int retval = ERROR_FAIL;
bool serial_mismatch = false;
struct libusb_device_handle *libusb_handle = NULL;
+ const char *serial = adapter_get_required_serial();
if (libusb_init(&jtag_libusb_context) < 0)
return ERROR_FAIL;
if (libusb_init(&jtag_libusb_context) < 0)
return ERROR_FAIL;
struct libusb_device_descriptor *dev_desc);
int jtag_libusb_open(const uint16_t vids[], const uint16_t pids[],
struct libusb_device_descriptor *dev_desc);
int jtag_libusb_open(const uint16_t vids[], const uint16_t pids[],
struct libusb_device_handle **out,
adapter_get_alternate_serial_fn adapter_get_alternate_serial);
void jtag_libusb_close(struct libusb_device_handle *dev);
struct libusb_device_handle **out,
adapter_get_alternate_serial_fn adapter_get_alternate_serial);
void jtag_libusb_close(struct libusb_device_handle *dev);
struct opendous_jtag *result;
struct libusb_device_handle *devh;
struct opendous_jtag *result;
struct libusb_device_handle *devh;
- if (jtag_libusb_open(opendous_probe->VID, opendous_probe->PID, NULL, &devh, NULL) != ERROR_OK)
+ if (jtag_libusb_open(opendous_probe->VID, opendous_probe->PID, &devh, NULL) != ERROR_OK)
return NULL;
jtag_libusb_set_configuration(devh, 0);
return NULL;
jtag_libusb_set_configuration(devh, 0);
- ret = jtag_libusb_open(cy7c65215_vids, cy7c65215_pids, NULL, &usbh, NULL);
+ ret = jtag_libusb_open(cy7c65215_vids, cy7c65215_pids, &usbh, NULL);
if (ret != ERROR_OK) {
LOG_ERROR("unable to open cy7c65215 device");
goto err;
if (ret != ERROR_OK) {
LOG_ERROR("unable to open cy7c65215 device");
goto err;
static int osbdm_open(struct osbdm *osbdm)
{
(void)memset(osbdm, 0, sizeof(*osbdm));
static int osbdm_open(struct osbdm *osbdm)
{
(void)memset(osbdm, 0, sizeof(*osbdm));
- if (jtag_libusb_open(osbdm_vid, osbdm_pid, NULL, &osbdm->devh, NULL) != ERROR_OK)
+ if (jtag_libusb_open(osbdm_vid, osbdm_pid, &osbdm->devh, NULL) != ERROR_OK)
return ERROR_FAIL;
if (libusb_claim_interface(osbdm->devh, 0) != ERROR_OK)
return ERROR_FAIL;
if (libusb_claim_interface(osbdm->devh, 0) != ERROR_OK)
const uint16_t vids[] = { USB_IDVENDOR, 0 };
const uint16_t pids[] = { USB_IDPRODUCT, 0 };
const uint16_t vids[] = { USB_IDVENDOR, 0 };
const uint16_t pids[] = { USB_IDPRODUCT, 0 };
- if (jtag_libusb_open(vids, pids, NULL, &hdev, NULL) != ERROR_OK)
+ if (jtag_libusb_open(vids, pids, &hdev, NULL) != ERROR_OK)
return ERROR_FAIL;
struct libusb_device_descriptor descriptor;
return ERROR_FAIL;
struct libusb_device_descriptor descriptor;
in order to become operational.
*/
do {
in order to become operational.
*/
do {
- if (jtag_libusb_open(param->vid, param->pid, adapter_get_required_serial(),
+ if (jtag_libusb_open(param->vid, param->pid,
&h->usb_backend_priv.fd, stlink_usb_get_alternate_serial) != ERROR_OK) {
LOG_ERROR("open failed");
return ERROR_FAIL;
&h->usb_backend_priv.fd, stlink_usb_get_alternate_serial) != ERROR_OK) {
LOG_ERROR("open failed");
return ERROR_FAIL;
/* TI (Stellaris) ICDI provides its serial number in the USB descriptor;
no need to provide a callback here. */
/* TI (Stellaris) ICDI provides its serial number in the USB descriptor;
no need to provide a callback here. */
- jtag_libusb_open(param->vid, param->pid, adapter_get_required_serial(), &h->usb_dev, NULL);
+ jtag_libusb_open(param->vid, param->pid, &h->usb_dev, NULL);
if (!h->usb_dev) {
LOG_ERROR("open failed");
if (!h->usb_dev) {
LOG_ERROR("open failed");
bool renumeration = false;
int ret;
bool renumeration = false;
int ret;
- if (jtag_libusb_open(vids, pids, NULL, &temp, NULL) == ERROR_OK) {
+ if (jtag_libusb_open(vids, pids, &temp, NULL) == ERROR_OK) {
LOG_INFO("Altera USB-Blaster II (uninitialized) found");
LOG_INFO("Loading firmware...");
ret = load_usb_blaster_firmware(temp, low);
LOG_INFO("Altera USB-Blaster II (uninitialized) found");
LOG_INFO("Loading firmware...");
ret = load_usb_blaster_firmware(temp, low);
const uint16_t pids_renum[] = { low->ublast_pid, 0 };
if (renumeration == false) {
const uint16_t pids_renum[] = { low->ublast_pid, 0 };
if (renumeration == false) {
- if (jtag_libusb_open(vids_renum, pids_renum, NULL,
- &low->libusb_dev, NULL) != ERROR_OK) {
+ if (jtag_libusb_open(vids_renum, pids_renum, &low->libusb_dev, NULL) != ERROR_OK) {
LOG_ERROR("Altera USB-Blaster II not found");
return ERROR_FAIL;
}
} else {
int retry = 10;
LOG_ERROR("Altera USB-Blaster II not found");
return ERROR_FAIL;
}
} else {
int retry = 10;
- while (jtag_libusb_open(vids_renum, pids_renum, NULL,
- &low->libusb_dev, NULL) != ERROR_OK && retry--) {
+ while (jtag_libusb_open(vids_renum, pids_renum, &low->libusb_dev, NULL) != ERROR_OK && retry--) {
usleep(1000000);
LOG_INFO("Waiting for reenumerate...");
}
usleep(1000000);
LOG_INFO("Waiting for reenumerate...");
}
const uint16_t pids[] = { PID, 0 };
struct libusb_device_handle *dev;
const uint16_t pids[] = { PID, 0 };
struct libusb_device_handle *dev;
- if (jtag_libusb_open(vids, pids, NULL, &dev, NULL) != ERROR_OK)
+ if (jtag_libusb_open(vids, pids, &dev, NULL) != ERROR_OK)
return NULL;
struct usbprog_jtag *tmp = malloc(sizeof(struct usbprog_jtag));
return NULL;
struct usbprog_jtag *tmp = malloc(sizeof(struct usbprog_jtag));
Linking to existing account procedure
If you already have an account and want to add another login method
you
MUST first sign in with your existing account and
then change URL to read
https://review.openocd.org/login/?link
to get to this page again but this time it'll work for linking. Thank you.
SSH host keys fingerprints
1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=.. |
|+o.. . |
|*.o . . |
|+B . . . |
|Bo. = o S |
|Oo.+ + = |
|oB=.* = . o |
| =+=.+ + E |
|. .=o . o |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)