Skip to content

Commit

Permalink
emulator: Create separate BR/EDR, BR/EDR/LE and LE vhci types
Browse files Browse the repository at this point in the history
  • Loading branch information
Johan Hedberg committed Jan 31, 2013
1 parent 1ffa263 commit 946e51c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 11 additions & 1 deletion emulator/vhci.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
#include "btdev.h"
#include "vhci.h"

#define uninitialized_var(x) x = x

struct vhci {
enum vhci_type type;
int fd;
Expand Down Expand Up @@ -83,9 +85,17 @@ static void vhci_read_callback(int fd, uint32_t events, void *user_data)
struct vhci *vhci_open(enum vhci_type type)
{
struct vhci *vhci;
enum btdev_type uninitialized_var(btdev_type);

switch (type) {
case VHCI_TYPE_BREDRLE:
btdev_type = BTDEV_TYPE_BREDRLE;
break;
case VHCI_TYPE_BREDR:
btdev_type = BTDEV_TYPE_BREDR;
break;
case VHCI_TYPE_LE:
btdev_type = BTDEV_TYPE_LE;
break;
case VHCI_TYPE_AMP:
return NULL;
Expand All @@ -104,7 +114,7 @@ struct vhci *vhci_open(enum vhci_type type)
return NULL;
}

vhci->btdev = btdev_create(BTDEV_TYPE_BREDR, 0x23);
vhci->btdev = btdev_create(btdev_type, 0x23);
if (!vhci->btdev) {
close(vhci->fd);
free(vhci);
Expand Down
2 changes: 2 additions & 0 deletions emulator/vhci.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
#include <stdint.h>

enum vhci_type {
VHCI_TYPE_BREDRLE,
VHCI_TYPE_BREDR,
VHCI_TYPE_LE,
VHCI_TYPE_AMP,
};

Expand Down

0 comments on commit 946e51c

Please sign in to comment.