]> git.sur5r.net Git - openocd/commitdiff
buspirate: Serial port was not correctly closed.
authorMichal Demin <michaldemin@gmail.com>
Fri, 22 Oct 2010 19:06:31 +0000 (21:06 +0200)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Mon, 25 Oct 2010 06:01:44 +0000 (08:01 +0200)
Signed-off-by: Michal Demin <michaldemin@gmail.com>
src/jtag/drivers/buspirate.c

index e5f8fb630fc46bd6a2cf258ab7a9170d2b5f8d6c..85b76edfafad34e2b4c0d5f550115756d5504193 100644 (file)
@@ -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)