From d1abb34b44faa4ff0c56b3ff770067afb5ce8e25 Mon Sep 17 00:00:00 2001 From: "yanggang.yang" Date: Fri, 21 Apr 2023 11:05:42 +0800 Subject: [PATCH] Bluetooth AIDL: SetTerminalRaw on fd Call SetTerminalRaw on the fd that was opened, since mFD has not been set. If SetTerminalRaw fails, log it but continue, since some platforms do not need this call. Bug: 279870989 Test: start Bluetooth on a device that doesn't need SetTerminalRaw (cherry picked from https://android-review.googlesource.com/q/commit:eb744bc14c0d1e64c4291b3f869d6055db36b0f3) Merged-In: I97c92c407b7c80442a0ba0812a630525219670a0 Change-Id: I97c92c407b7c80442a0ba0812a630525219670a0 --- bluetooth/aidl/default/BluetoothHci.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bluetooth/aidl/default/BluetoothHci.cpp b/bluetooth/aidl/default/BluetoothHci.cpp index d4e4b34c6e..ac2eabc86d 100644 --- a/bluetooth/aidl/default/BluetoothHci.cpp +++ b/bluetooth/aidl/default/BluetoothHci.cpp @@ -117,11 +117,9 @@ int BluetoothHci::getFdFromDevPath() { strerror(errno)); return fd; } - if (int ret = SetTerminalRaw(mFd) < 0) { - ALOGE("Could not make %s a raw terminal %d(%s)", mDevPath.c_str(), ret, + if (int ret = SetTerminalRaw(fd) < 0) { + ALOGI("Could not make %s a raw terminal %d(%s)", mDevPath.c_str(), ret, strerror(errno)); - ::close(fd); - return -1; } return fd; }