This is an automated email from Gerrit. Jörg Fischer (tur...@gmx.de) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/2521
-- gerrit commit 48172f5df1d42a62c40dd478c103251439c931d2 Author: Joerg Fischer <tur...@gmx.de> Date: Sat Jan 31 00:04:45 2015 +0100 J-Link serial number config option Add serial option to jlink config commands, handy when there is more than one adapter connected. To select adapter 0123456 for OpenOCD, use jlink serial 0123456 Change-Id: Ib29ce3f0c4975e1169211721a4531bf4db61f1ee Signed-off-by: Joerg Fischer <tur...@gmx.de> diff --git a/src/jtag/drivers/jlink.c b/src/jtag/drivers/jlink.c index ca57ae8..e8afc38 100644 --- a/src/jtag/drivers/jlink.c +++ b/src/jtag/drivers/jlink.c @@ -264,6 +264,8 @@ static struct jlink *jlink_handle; static uint16_t vids[] = { 0x1366, 0x1366, 0x1366, 0x1366, 0x1366, 0 }; static uint16_t pids[] = { 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0 }; +static char *jlink_serial; + static uint32_t jlink_caps; static uint32_t jlink_hw_type; @@ -1008,6 +1010,19 @@ COMMAND_HANDLER(jlink_pid_command) return ERROR_OK; } +COMMAND_HANDLER(jlink_serial_command) +{ + if (CMD_ARGC != 1) { + LOG_ERROR("Need exactly one argument to jlink_serial"); + return ERROR_FAIL; + } + if (jlink_serial) + free(jlink_serial); + jlink_serial = strdup(CMD_ARGV[0]); + + return ERROR_OK; +} + COMMAND_HANDLER(jlink_handle_jlink_info_command) { if (jlink_get_version_info() == ERROR_OK) { @@ -1324,6 +1339,12 @@ static const struct command_registration jlink_subcommand_handlers[] = { .mode = COMMAND_CONFIG, .help = "set the pid of the interface we want to use", }, + { + .name = "serial", + .handler = &jlink_serial_command, + .mode = COMMAND_CONFIG, + .help = "set the serial number of the J-Link adapter we want to use" + }, COMMAND_REGISTRATION_DONE }; @@ -1733,7 +1754,7 @@ static void jlink_swd_queue_cmd(struct adiv5_dap *dap, uint8_t cmd, uint32_t *ds static struct jlink *jlink_usb_open() { struct jtag_libusb_device_handle *devh; - if (jtag_libusb_open(vids, pids, NULL, &devh) != ERROR_OK) + if (jtag_libusb_open(vids, pids, jlink_serial, &devh) != ERROR_OK) return NULL; /* BE ***VERY CAREFUL*** ABOUT MAKING CHANGES IN THIS @@ -1765,7 +1786,7 @@ static struct jlink *jlink_usb_open() /* 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)) != ERROR_OK) { + while ((retval = jtag_libusb_open(vids, pids, jlink_serial, &devh)) != ERROR_OK) { usleep(1000); timeout--; if (!timeout) -- ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ OpenOCD-devel mailing list OpenOCD-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openocd-devel