X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=bt-host.c;h=49205bf288cf2441b1a78486c1593c8c576c1967;hb=16f4e8fa737b58b7b0461b33581e43ac06991110;hp=33b2761f21a92fb021a12e379ec47b8fe1fcddd0;hpb=ca96c316c0a10d7c673063f1bacb7d2c816cf38e;p=qemu.git diff --git a/bt-host.c b/bt-host.c index 33b2761f2..49205bf28 100644 --- a/bt-host.c +++ b/bt-host.c @@ -18,10 +18,8 @@ */ #include "qemu-common.h" -#include "qemu-char.h" -#include "sysemu.h" -#include "net.h" -#include "bt-host.h" +#include "sysemu/bt.h" +#include "qemu/main-loop.h" #ifndef _WIN32 # include @@ -50,19 +48,19 @@ static void bt_host_send(struct HCIInfo *hci, struct bt_host_hci_s *s = (struct bt_host_hci_s *) hci; uint8_t pkt = type; struct iovec iv[2]; - int ret; iv[0].iov_base = (void *)&pkt; iv[0].iov_len = 1; iv[1].iov_base = (void *) data; iv[1].iov_len = len; - while ((ret = writev(s->fd, iv, 2)) < 0) + while (writev(s->fd, iv, 2) < 0) { if (errno != EAGAIN && errno != EINTR) { fprintf(stderr, "qemu: error %i writing bluetooth packet.\n", errno); return; } + } } static void bt_host_cmd(struct HCIInfo *hci, const uint8_t *data, int len) @@ -131,6 +129,7 @@ static void bt_host_read(void *opaque) pktlen = MIN(pkt[2] + 3, s->len); s->len -= pktlen; pkt += pktlen; + break; default: bad_pkt: @@ -172,13 +171,13 @@ struct HCIInfo *bt_host_hci(const char *id) hci_filter_all_ptypes(&flt); hci_filter_all_events(&flt); - if (setsockopt(fd, SOL_HCI, HCI_FILTER, &flt, sizeof(flt)) < 0) { + if (qemu_setsockopt(fd, SOL_HCI, HCI_FILTER, &flt, sizeof(flt)) < 0) { fprintf(stderr, "qemu: Can't set HCI filter on socket (%i)\n", errno); return 0; } # endif - s = qemu_mallocz(sizeof(struct bt_host_hci_s)); + s = g_malloc0(sizeof(struct bt_host_hci_s)); s->fd = fd; s->hci.cmd_send = bt_host_cmd; s->hci.sco_send = bt_host_sco;