From 43c1b24f4631ebdd764e424c1da5a2dbed2759dc Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 2 Sep 2013 10:31:22 -0700 Subject: [PATCH] emulator: Filter for valid packet types from /dev/vhci --- emulator/vhci.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/emulator/vhci.c b/emulator/vhci.c index 106a8e214..1d198e46c 100644 --- a/emulator/vhci.c +++ b/emulator/vhci.c @@ -34,6 +34,7 @@ #include #include "monitor/mainloop.h" +#include "monitor/bt.h" #include "btdev.h" #include "vhci.h" @@ -76,10 +77,16 @@ static void vhci_read_callback(int fd, uint32_t events, void *user_data) return; len = read(vhci->fd, buf, sizeof(buf)); - if (len < 0) + if (len < 1) return; - btdev_receive_h4(vhci->btdev, buf, len); + switch (buf[0]) { + case BT_H4_CMD_PKT: + case BT_H4_ACL_PKT: + case BT_H4_SCO_PKT: + btdev_receive_h4(vhci->btdev, buf, len); + break; + } } struct vhci *vhci_open(enum vhci_type type) -- 2.47.3