Loading core/jni/android_bluetooth_HeadsetBase.cpp +15 −15 Original line number Diff line number Diff line Loading @@ -96,10 +96,11 @@ static int send_line(int fd, const char* line) { return 0; } static int is_ascii(char *line) { static void mask_eighth_bit(char *line) { for (;;line++) { if (*line == 0) return 1; if (*line >> 7) return 0; if (0 == *line) return; *line &= 0x7F; } } Loading Loading @@ -164,16 +165,15 @@ again: *bufit = NULL; // Simple validation. Must be all ASCII. // (we sometimes send non-ASCII UTF-8 in address book, but should // never receive non-ASCII UTF-8). // This was added because of the BMW 2005 E46 which sends binary junk. if (is_ascii(buf)) { IF_LOGV() LOG(LOG_VERBOSE, "Bluetooth AT recv", "%s", buf); } else { LOGW("Ignoring invalid AT command: %s", buf); buf[0] = NULL; } // According to ITU V.250 section 5.1, IA5 7 bit chars are used, // the eighth bit or higher bits are ignored if they exists // We mask out only eighth bit, no higher bit, since we do char // string here, not wide char. // We added this processing due to 2 real world problems. // 1 BMW 2005 E46 which sends binary junk // 2 Audi 2010 A3, dial command use 0xAD (soft-hyphen) as number // formater, which was rejected by the AT handler mask_eighth_bit(buf); return buf; } Loading Loading
core/jni/android_bluetooth_HeadsetBase.cpp +15 −15 Original line number Diff line number Diff line Loading @@ -96,10 +96,11 @@ static int send_line(int fd, const char* line) { return 0; } static int is_ascii(char *line) { static void mask_eighth_bit(char *line) { for (;;line++) { if (*line == 0) return 1; if (*line >> 7) return 0; if (0 == *line) return; *line &= 0x7F; } } Loading Loading @@ -164,16 +165,15 @@ again: *bufit = NULL; // Simple validation. Must be all ASCII. // (we sometimes send non-ASCII UTF-8 in address book, but should // never receive non-ASCII UTF-8). // This was added because of the BMW 2005 E46 which sends binary junk. if (is_ascii(buf)) { IF_LOGV() LOG(LOG_VERBOSE, "Bluetooth AT recv", "%s", buf); } else { LOGW("Ignoring invalid AT command: %s", buf); buf[0] = NULL; } // According to ITU V.250 section 5.1, IA5 7 bit chars are used, // the eighth bit or higher bits are ignored if they exists // We mask out only eighth bit, no higher bit, since we do char // string here, not wide char. // We added this processing due to 2 real world problems. // 1 BMW 2005 E46 which sends binary junk // 2 Audi 2010 A3, dial command use 0xAD (soft-hyphen) as number // formater, which was rejected by the AT handler mask_eighth_bit(buf); return buf; } Loading