From 803f7ce17ed6780b49fbcaad46ab26ae1121788f Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 13 Jan 2014 19:37:54 -0800 Subject: [PATCH] shared: Introduce flag for detecting HCI stream based sources --- src/shared/hci.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/shared/hci.c b/src/shared/hci.c index 1e4b58fa2..be636de75 100644 --- a/src/shared/hci.c +++ b/src/shared/hci.c @@ -58,6 +58,7 @@ struct hci_filter { struct bt_hci { int ref_count; struct io *io; + bool is_stream; bool writer_active; uint8_t num_cmds; unsigned int next_cmd_id; @@ -266,6 +267,9 @@ static bool io_read_callback(struct io *io, void *user_data) if (fd < 0) return false; + if (hci->is_stream) + return false; + len = read(fd, buf, sizeof(buf)); if (len < 0) return false; @@ -299,6 +303,7 @@ struct bt_hci *bt_hci_new(int fd) return NULL; } + hci->is_stream = true; hci->writer_active = false; hci->num_cmds = 1; hci->next_cmd_id = 1; @@ -378,6 +383,8 @@ struct bt_hci *bt_hci_new_user_channel(uint16_t index) return NULL; } + hci->is_stream = false; + bt_hci_set_close_on_unref(hci, true); return hci; @@ -409,6 +416,8 @@ struct bt_hci *bt_hci_new_raw_device(uint16_t index) return NULL; } + hci->is_stream = false; + bt_hci_set_close_on_unref(hci, true); return hci; -- 2.47.3