summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Demin <michaldemin@gmail.com>2010-10-22 21:06:31 +0200
committerØyvind Harboe <oyvind.harboe@zylin.com>2010-10-25 08:01:44 +0200
commitd4de14dafe43f264b9490b543b9cd50a1345fe9e (patch)
treeece7fd6a5b887e671d80af3e02c7bad41a7ce5ee
parented44447e3dfe69084b9960b844c326746681e539 (diff)
downloadopenocd+libswd-d4de14dafe43f264b9490b543b9cd50a1345fe9e.tar.gz
openocd+libswd-d4de14dafe43f264b9490b543b9cd50a1345fe9e.tar.bz2
openocd+libswd-d4de14dafe43f264b9490b543b9cd50a1345fe9e.tar.xz
openocd+libswd-d4de14dafe43f264b9490b543b9cd50a1345fe9e.zip
buspirate: Serial port was not correctly closed.
Signed-off-by: Michal Demin <michaldemin@gmail.com>
-rw-r--r--src/jtag/drivers/buspirate.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/jtag/drivers/buspirate.c b/src/jtag/drivers/buspirate.c
index e5f8fb63..85b76edf 100644
--- a/src/jtag/drivers/buspirate.c
+++ b/src/jtag/drivers/buspirate.c
@@ -111,6 +111,7 @@ static void buspirate_jtag_get_adcs(int);
static int buspirate_serial_setspeed(int fd, speed_t speed);
static int buspirate_serial_write(int fd, char *buf, int size);
static int buspirate_serial_read(int fd, char *buf, int size);
+static void buspirate_serial_close(int fd);
static void buspirate_print_buffer(char *buf, int size);
static int buspirate_speed(int speed)
@@ -247,6 +248,9 @@ static int buspirate_quit(void)
buspirate_jtag_set_speed(buspirate_fd, SERIAL_NORMAL);
buspirate_jtag_reset(buspirate_fd);
+
+ buspirate_serial_close(buspirate_fd);
+
if (buspirate_port) {
free(buspirate_port);
buspirate_port = NULL;
@@ -941,6 +945,11 @@ static int buspirate_serial_read(int fd, char *buf, int size)
return len;
}
+static void buspirate_serial_close(int fd)
+{
+ close(fd);
+}
+
#define LINE_SIZE 81
#define BYTES_PER_LINE 16
static void buspirate_print_buffer(char *buf, int size)