From 2b8685b63f5b73573b2a11c80b8426536d3e82da Mon Sep 17 00:00:00 2001 From: Lwazi Dube Date: Fri, 30 Nov 2018 06:28:36 -0600 Subject: [PATCH] wireless/bluetooth/btsak/btsak_main.c: Fix address parsing --- nshlib/nsh_slcd.c | 8 ++++++-- wireless/bluetooth/btsak/btsak_main.c | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/nshlib/nsh_slcd.c b/nshlib/nsh_slcd.c index eb0e9de69..342365fe1 100644 --- a/nshlib/nsh_slcd.c +++ b/nshlib/nsh_slcd.c @@ -137,7 +137,9 @@ int nsh_consolemain(int argc, char *argv[]) DEBUGASSERT(pstate); - /* Execute the one-time start-up script. Any output will go to /dev/console. */ + /* Execute the one-time start-up script. Any output will go to + * /dev/console. + */ #ifdef CONFIG_NSH_ROMFSETC (void)nsh_initscript(&pstate->cn_vtbl); @@ -149,7 +151,9 @@ int nsh_consolemain(int argc, char *argv[]) (void)boardctl(BOARDIOC_FINALINIT, 0); #endif - /* Try to associate /dev/console as stdin because otherwise /dev/slcd0 will be it */ + /* Try to associate /dev/console as stdin because otherwise /dev/slcd0 + * will be it + */ ret = nsh_clone_console(pstate); diff --git a/wireless/bluetooth/btsak/btsak_main.c b/wireless/bluetooth/btsak/btsak_main.c index 6b4f8567c..9d7ac7070 100644 --- a/wireless/bluetooth/btsak/btsak_main.c +++ b/wireless/bluetooth/btsak/btsak_main.c @@ -530,7 +530,7 @@ int btsak_str2addr(FAR const char *str, FAR uint8_t *addr) for (i = 0; i < 6; i++) { ch = (char)*src++; - nibble = btsak_char2nibble(ch) << 4; + nibble = btsak_char2nibble(ch); if (nibble < 0) { return nibble; @@ -545,8 +545,8 @@ int btsak_str2addr(FAR const char *str, FAR uint8_t *addr) return nibble; } - hex |= (uint8_t)nibble; - *addr++ = hex; + hex |= (uint8_t)nibble; + addr[5 - i] = hex; if (i < 5) {