Merge "New HSUM (Headless System User Mode) build for cf phone" into tm-qpr-dev
diff --git a/guest/commands/bt_vhci_forwarder/main.cpp b/guest/commands/bt_vhci_forwarder/main.cpp
index 2f1aab2..d1bb588 100644
--- a/guest/commands/bt_vhci_forwarder/main.cpp
+++ b/guest/commands/bt_vhci_forwarder/main.cpp
@@ -128,6 +128,9 @@
send(vhci_fd, HCI_ISODATA_PKT, raw_iso.data(), raw_iso.size());
},
[]() { LOG(INFO) << "HCI socket device disconnected"; });
+
+ bool before_first_command = true;
+
while (true) {
int ret = TEMP_FAILURE_RETRY(poll(fds, 2, -1));
if (ret < 0) {
@@ -141,6 +144,7 @@
if (c < 0) {
PLOG(ERROR) << "vhci to virtio-console failed";
}
+ before_first_command = false;
}
if (fds[1].revents & POLLHUP) {
LOG(ERROR) << "PollHUP";
@@ -148,6 +152,16 @@
continue;
}
if (fds[1].revents & (POLLIN | POLLERR)) {
+ if (before_first_command) {
+ // Drop any data left in the virtio-console from a previous reset.
+ ssize_t bytes = TEMP_FAILURE_RETRY(read(virtio_fd, buf, kBufferSize));
+ if (bytes < 0) {
+ LOG(ERROR) << "virtio_fd ready, but read failed " << strerror(errno);
+ } else {
+ LOG(INFO) << "Discarding " << bytes << " bytes from virtio_fd.";
+ }
+ continue;
+ }
// 'virtio-console to vhci' depends on H4Packetizer because vhci expects
// full packet, but the data from virtio-console could be partial.
h4.OnDataReady(virtio_fd);
diff --git a/shared/BoardConfig.mk b/shared/BoardConfig.mk
index b59b39c..721e272 100644
--- a/shared/BoardConfig.mk
+++ b/shared/BoardConfig.mk
@@ -23,7 +23,9 @@
include build/make/target/board/BoardConfigMainlineCommon.mk
TARGET_NO_BOOTLOADER := $(__TARGET_NO_BOOTLOADER)
+ifndef TARGET_BOOTLOADER_BOARD_NAME
TARGET_BOOTLOADER_BOARD_NAME := cutf
+endif
BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE := $(TARGET_RO_FILE_SYSTEM_TYPE)