summaryrefslogtreecommitdiff
path: root/src/jtag
diff options
context:
space:
mode:
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-06-12 01:41:00 +0000
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-06-12 01:41:00 +0000
commitf5e4511701c0c5cc24278a5c8ab9bf81b2538b6a (patch)
tree6ceaeae37008aa3bd26205b4fd114b216263122e /src/jtag
parenta9d5119825aef1cbca3d9f6931cedafbfc7bcaed (diff)
downloadopenocd+libswd-f5e4511701c0c5cc24278a5c8ab9bf81b2538b6a.tar.gz
openocd+libswd-f5e4511701c0c5cc24278a5c8ab9bf81b2538b6a.tar.bz2
openocd+libswd-f5e4511701c0c5cc24278a5c8ab9bf81b2538b6a.tar.xz
openocd+libswd-f5e4511701c0c5cc24278a5c8ab9bf81b2538b6a.zip
Improve vsllink command argument handling:
- Bug fix: Always clear high bit of USB bulk out endpoint. - Use parse_ulong helpers to ensure numeric strings are parsed properly. git-svn-id: svn://svn.berlios.de/openocd/trunk@2217 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/jtag')
-rw-r--r--src/jtag/vsllink.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/jtag/vsllink.c b/src/jtag/vsllink.c
index 8e2a9ca2..8e0ef666 100644
--- a/src/jtag/vsllink.c
+++ b/src/jtag/vsllink.c
@@ -1407,9 +1407,7 @@ static int vsllink_handle_usb_vid_command(struct command_context_s *cmd_ctx, cha
return ERROR_OK;
}
- vsllink_usb_vid = strtol(args[0], NULL, 0);
-
- return ERROR_OK;
+ return parse_u16(args[0], &vsllink_usb_vid);
}
static int vsllink_handle_usb_pid_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
@@ -1419,10 +1417,7 @@ static int vsllink_handle_usb_pid_command(struct command_context_s *cmd_ctx, cha
LOG_ERROR("parameter error, should be one parameter for PID");
return ERROR_OK;
}
-
- vsllink_usb_pid = strtol(args[0], NULL, 0);
-
- return ERROR_OK;
+ return parse_u16(args[0], &vsllink_usb_pid);
}
static int vsllink_handle_usb_bulkin_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
@@ -1433,9 +1428,11 @@ static int vsllink_handle_usb_bulkin_command(struct command_context_s *cmd_ctx,
return ERROR_OK;
}
- vsllink_usb_bulkin = strtol(args[0], NULL, 0) | 0x80;
+ int retval = parse_u8(args[0], &vsllink_usb_bulkin);
+ if (ERROR_OK == retval)
+ vsllink_usb_bulkin |= 0x80;
- return ERROR_OK;
+ return retval;
}
static int vsllink_handle_usb_bulkout_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
@@ -1446,9 +1443,11 @@ static int vsllink_handle_usb_bulkout_command(struct command_context_s *cmd_ctx,
return ERROR_OK;
}
- vsllink_usb_bulkout = strtol(args[0], NULL, 0);
+ int retval = parse_u8(args[0], &vsllink_usb_bulkout);
+ if (ERROR_OK == retval)
+ vsllink_usb_bulkout &= ~0x80;
- return ERROR_OK;
+ return retval;
}
static int vsllink_handle_usb_interface_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
@@ -1459,9 +1458,7 @@ static int vsllink_handle_usb_interface_command(struct command_context_s *cmd_ct
return ERROR_OK;
}
- vsllink_usb_interface = strtol(args[0], NULL, 0);
-
- return ERROR_OK;
+ return parse_u8(args[0], &vsllink_usb_interface);
}
/***************************************************************************/