Revision 2e9b08e5
b/bt-host.c | ||
---|---|---|
24 | 24 |
#include "sysemu.h" |
25 | 25 |
#include "net.h" |
26 | 26 |
|
27 |
#include <errno.h> |
|
28 |
#include <sys/ioctl.h> |
|
29 |
#include <sys/uio.h> |
|
30 |
#ifdef CONFIG_BLUEZ |
|
31 |
# include <bluetooth/bluetooth.h> |
|
32 |
# include <bluetooth/hci.h> |
|
33 |
# include <bluetooth/hci_lib.h> |
|
34 |
#else |
|
35 |
# include "hw/bt.h" |
|
36 |
# define HCI_MAX_FRAME_SIZE 1028 |
|
37 |
#endif |
|
27 |
#ifndef _WIN32 |
|
28 |
# include <errno.h> |
|
29 |
# include <sys/ioctl.h> |
|
30 |
# include <sys/uio.h> |
|
31 |
# ifdef CONFIG_BLUEZ |
|
32 |
# include <bluetooth/bluetooth.h> |
|
33 |
# include <bluetooth/hci.h> |
|
34 |
# include <bluetooth/hci_lib.h> |
|
35 |
# else |
|
36 |
# include "hw/bt.h" |
|
37 |
# define HCI_MAX_FRAME_SIZE 1028 |
|
38 |
# endif |
|
38 | 39 |
|
39 | 40 |
struct bt_host_hci_s { |
40 | 41 |
struct HCIInfo hci; |
... | ... | |
154 | 155 |
{ |
155 | 156 |
struct bt_host_hci_s *s; |
156 | 157 |
int fd = -1; |
157 |
#ifdef CONFIG_BLUEZ |
|
158 |
# ifdef CONFIG_BLUEZ
|
|
158 | 159 |
int dev_id = hci_devid(id); |
159 | 160 |
struct hci_filter flt; |
160 | 161 |
|
... | ... | |
166 | 167 |
fd = hci_open_dev(dev_id); |
167 | 168 |
|
168 | 169 |
/* XXX: can we ensure nobody else has the device opened? */ |
169 |
#endif |
|
170 |
# endif
|
|
170 | 171 |
|
171 | 172 |
if (fd < 0) { |
172 | 173 |
fprintf(stderr, "qemu: Can't open `%s': %s (%i)\n", |
... | ... | |
174 | 175 |
return 0; |
175 | 176 |
} |
176 | 177 |
|
177 |
#ifdef CONFIG_BLUEZ |
|
178 |
# ifdef CONFIG_BLUEZ
|
|
178 | 179 |
hci_filter_clear(&flt); |
179 | 180 |
hci_filter_all_ptypes(&flt); |
180 | 181 |
hci_filter_all_events(&flt); |
... | ... | |
183 | 184 |
fprintf(stderr, "qemu: Can't set HCI filter on socket (%i)\n", errno); |
184 | 185 |
return 0; |
185 | 186 |
} |
186 |
#endif |
|
187 |
# endif
|
|
187 | 188 |
|
188 | 189 |
s = qemu_mallocz(sizeof(struct bt_host_hci_s)); |
189 | 190 |
s->fd = fd; |
... | ... | |
196 | 197 |
|
197 | 198 |
return &s->hci; |
198 | 199 |
} |
200 |
#else |
|
201 |
struct HCIInfo *bt_host_hci(const char *id) |
|
202 |
{ |
|
203 |
fprintf(stderr, "qemu: bluetooth passthrough not supported (yet)\n", errno); |
|
204 |
|
|
205 |
return 0; |
|
206 |
} |
|
207 |
#endif |
b/bt-vhci.c | ||
---|---|---|
25 | 25 |
#include "net.h" |
26 | 26 |
#include "hw/bt.h" |
27 | 27 |
|
28 |
#include <sys/uio.h> |
|
29 |
|
|
30 |
#define VHCI_DEV "/dev/vhci" |
|
28 |
#define VHCI_DEV "/dev/vhci" |
|
31 | 29 |
#define VHCI_UDEV "/dev/hci_vhci" |
32 | 30 |
|
33 | 31 |
struct bt_vhci_s { |
Also available in: Unified diff