Add a command to specify the serial string and pass it to the find helper.
Actual matching was already supported for both serial and product but was
using hard coded string indices. Instead use the indices from the device
descriptor.
Change-Id: I17c7538e5ad301ef41eace1ee70a202adab23bb4
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1816
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
+COMMAND_HANDLER(vsllink_handle_usb_serial_command)
+{
+ if (CMD_ARGC > 1)
+ return ERROR_COMMAND_SYNTAX_ERROR;
+
+ free(versaloon_interface.usb_setting.serialstring);
+
+ if (CMD_ARGC == 1)
+ versaloon_interface.usb_setting.serialstring = strdup(CMD_ARGV[0]);
+ else
+ versaloon_interface.usb_setting.serialstring = NULL;
+
+ return ERROR_OK;
+}
+
COMMAND_HANDLER(vsllink_handle_usb_bulkin_command)
{
if (CMD_ARGC != 1)
COMMAND_HANDLER(vsllink_handle_usb_bulkin_command)
{
if (CMD_ARGC != 1)
-static usb_dev_handle *find_usb_device(uint16_t VID, uint16_t PID,
- uint8_t interface, int8_t serialindex, char *serialstring,
- int8_t productindex, char *productstring)
+static usb_dev_handle *find_usb_device(uint16_t VID, uint16_t PID, uint8_t interface,
+ char *serialstring, char *productstring)
{
usb_dev_handle *dev_handle = NULL;
struct usb_bus *busses;
{
usb_dev_handle *dev_handle = NULL;
struct usb_bus *busses;
}
/* check description string */
}
/* check description string */
- if (((productstring != NULL) && (productindex >= 0)
- && !usb_check_string(dev_handle, productindex,
- productstring, NULL, 0))
- || ((serialstring != NULL) && (serialindex >= 0)
- && !usb_check_string(dev_handle, serialindex,
- serialstring, NULL, 0))) {
+ if ((productstring != NULL && !usb_check_string(dev_handle,
+ dev->descriptor.iProduct, productstring, NULL, 0))
+ || (serialstring != NULL && !usb_check_string(dev_handle,
+ dev->descriptor.iSerialNumber, serialstring, NULL, 0))) {
usb_close(dev_handle);
dev_handle = NULL;
continue;
usb_close(dev_handle);
dev_handle = NULL;
continue;
dev = find_usb_device(versaloon_interface.usb_setting.vid,
versaloon_interface.usb_setting.pid,
versaloon_interface.usb_setting.interface,
dev = find_usb_device(versaloon_interface.usb_setting.vid,
versaloon_interface.usb_setting.pid,
versaloon_interface.usb_setting.interface,
- 0, NULL, 2, "Versaloon");
+ versaloon_interface.usb_setting.serialstring, "Versaloon");
if (NULL == dev)
return NULL;
if (NULL == dev)
return NULL;
.handler = &vsllink_handle_usb_pid_command,
.mode = COMMAND_CONFIG,
},
.handler = &vsllink_handle_usb_pid_command,
.mode = COMMAND_CONFIG,
},
+ {
+ .name = "vsllink_usb_serial",
+ .handler = &vsllink_handle_usb_serial_command,
+ .mode = COMMAND_CONFIG,
+ },
{
.name = "vsllink_usb_bulkin",
.handler = &vsllink_handle_usb_bulkin_command,
{
.name = "vsllink_usb_bulkin",
.handler = &vsllink_handle_usb_bulkin_command,
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)