Skip to content

Commit

Permalink
Merge pull request #2230 from unknown10777/patch-1
Browse files Browse the repository at this point in the history
Renamed bool to follow guideline, and a typo
  • Loading branch information
iceman1001 authored Jan 3, 2024
2 parents 50a252c + 6a8f685 commit bc2a906
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions client/src/cmdusart.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ static int CmdUsartConfig(const char *Cmd) {
}

// module command not universal so specific commands needed if anyone DIY'd their own Blueshark.
bool isBluetoothExtensionHC04 = false;
bool isBluetoothExtensionHC05Blueshark = false;
bool BT_EXTENSION_HC04 = false;
bool BT_EXTENSION_HC05_BLUESHARK = false;

static int usart_bt_testcomm(uint32_t baudrate, uint8_t parity) {
int ret = set_usart_config(baudrate, parity);
Expand All @@ -175,13 +175,13 @@ static int usart_bt_testcomm(uint32_t baudrate, uint8_t parity) {

// if it fully match HC-04's attribute
if (str_startswith((char *)data, "www.hc01.com V2.5, 2022-04-26")) {
isBluetoothExtensionHC04 = true;
BT_EXTENSION_HC04 = true;
PrintAndLogEx(INFO, "Bluetooth module identified as HC-04.");
}

// if it fully match Blueshark HC-05's attribute
if (str_startswith((char *)data, "hc01.comV2.0")) {
isBluetoothExtensionHC05Blueshark = true;
BT_EXTENSION_HC05_BLUESHARK = true;
PrintAndLogEx(INFO, "Bluetooth module identified as Blueshark HC-05.");
}
return PM3_SUCCESS;
Expand Down Expand Up @@ -265,7 +265,7 @@ static int CmdUsartBtFactory(const char *Cmd) {
size_t len = 0;
memset(data, 0, sizeof(data));

if (isBluetoothExtensionHC04 == true) {
if (BT_EXTENSION_HC04 == true) {
string = "AT+NAME=PM3_RDV4.0";
} else {
string = "AT+NAMEPM3_RDV4.0";
Expand Down Expand Up @@ -311,7 +311,7 @@ static int CmdUsartBtFactory(const char *Cmd) {
memset(data, 0, sizeof(data));
len = 0;

if (isBluetoothExtensionHC04 == true) {
if (BT_EXTENSION_HC04 == true) {
string = "AT+PIN=1234";
} else {
string = "AT+PIN1234";
Expand All @@ -322,7 +322,7 @@ static int CmdUsartBtFactory(const char *Cmd) {
ret = usart_txrx((uint8_t *)string, strlen(string), data, &len, 1000);
if (ret == PM3_SUCCESS) {
PrintAndLogEx(SUCCESS, "RX (%3zu):%.*s", len, (int)len, data);
if (strstr((char *)data, "OK") != NULL) {
if (strstr((char *)data, "OK")) {
PrintAndLogEx(SUCCESS, "PIN set to " _GREEN_("1234"));
} else {
PrintAndLogEx(WARNING, "Unexpected response to AT+PIN: " _YELLOW_("%.*s"), (int)len, data);
Expand All @@ -334,7 +334,7 @@ static int CmdUsartBtFactory(const char *Cmd) {

msleep(500);

if (isBluetoothExtensionHC04 != true) {
if (BT_EXTENSION_HC04 != true) {
// parity must be changed before baudrate
if (parity != USART_PARITY) {
memset(data, 0, sizeof(data));
Expand Down

0 comments on commit bc2a906

Please sign in to comment.