Skip to content

Commit

Permalink
Fix issue on OSX (and other platforms) where stm32flash only works if…
Browse files Browse the repository at this point in the history
… the serial device name starts with /dev/tty, as on OSX some serial devices start with /dev/cu. Also corrected mistake about .a file in stm32 parsers folder, and hopefully removed the .a file from source control
  • Loading branch information
synergie7 committed Jul 8, 2015
1 parent 7217137 commit 176db5f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -6,4 +6,4 @@ other/maple-bootloader/cscope.out
other/maple-bootloader/build
other/maple-bootloader/*~
*.o
tools/src/stm32flash/src/parsers/parsers.a
tools/src/stm32flash_serial/src/parsers/parsers.a
Binary file modified tools/macosx/stm32flash/stm32flash
Binary file not shown.
Binary file removed tools/src/stm32flash_serial/src/parsers/parsers.a
Binary file not shown.
20 changes: 18 additions & 2 deletions tools/src/stm32flash_serial/src/serial_posix.c
Expand Up @@ -198,18 +198,34 @@ static port_err_t serial_setup(serial_t *h, const serial_baud_t baud,
return PORT_ERR_OK;
}

/*
* Roger clark.
* This function is no longer used. But has just been commented out in case it needs
* to be reinstated in the future
static int startswith(const char *haystack, const char *needle) {
return strncmp(haystack, needle, strlen(needle)) == 0;
}
*/

static int is_tty(const char *path) {
char resolved[PATH_MAX];

if(!realpath(path, resolved)) return 0;



/*
* Roger Clark
* Commented out this check, because on OSX some devices are /dev/cu
* and some users use symbolic links to devices, hence the name may not even start
* with /dev
if(startswith(resolved, "/dev/tty")) return 1;

return 0;
*/

return 1;
}

static port_err_t serial_posix_open(struct port_interface *port,
Expand Down

0 comments on commit 176db5f

Please sign in to comment.