summaryrefslogtreecommitdiff
path: root/emulator/vhci.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2013-09-02 10:31:22 -0700
committerMarcel Holtmann <marcel@holtmann.org>2013-09-02 10:31:22 -0700
commit43c1b24f4631ebdd764e424c1da5a2dbed2759dc (patch)
tree1fbfa0cd0288575b0b448b8b92fabcca65088e30 /emulator/vhci.c
parent361f5d4b6bc40e41c6ca4aca11dcd91bafbb4f3a (diff)
downloadbluez-43c1b24f4631ebdd764e424c1da5a2dbed2759dc.tar.gz
emulator: Filter for valid packet types from /dev/vhci
Diffstat (limited to 'emulator/vhci.c')
-rw-r--r--emulator/vhci.c11
1 files 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 <string.h>
#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)