*/
#include "qemu/osdep.h"
+#include "qemu/error-report.h"
#include "qemu-common.h"
#include "sysemu/bt.h"
#include "hw/bt.h"
static void bt_dummy_lmp_connection_complete(struct bt_link_s *link)
{
if (link->slave->reject_reason)
- fprintf(stderr, "%s: stray LMP_not_accepted received, fixme\n",
- __func__);
+ error_report("%s: stray LMP_not_accepted received, fixme", __func__);
else
- fprintf(stderr, "%s: stray LMP_accepted received, fixme\n",
- __func__);
+ error_report("%s: stray LMP_accepted received, fixme", __func__);
exit(-1);
}
static void bt_dummy_lmp_disconnect_master(struct bt_link_s *link)
{
- fprintf(stderr, "%s: stray LMP_detach received, fixme\n", __func__);
+ error_report("%s: stray LMP_detach received, fixme", __func__);
exit(-1);
}
static void bt_dummy_lmp_acl_resp(struct bt_link_s *link,
const uint8_t *data, int start, int len)
{
- fprintf(stderr, "%s: stray ACL response PDU, fixme\n", __func__);
+ error_report("%s: stray ACL response PDU, fixme", __func__);
exit(-1);
}
while (*p && *p != dev)
p = &(*p)->next;
if (*p != dev) {
- fprintf(stderr, "%s: bad bt device \"%s\"\n", __func__,
- dev->lmp_name ?: "(null)");
+ error_report("%s: bad bt device \"%s\"", __func__,
+ dev->lmp_name ?: "(null)");
exit(-1);
}
*/
#include "qemu/osdep.h"
+#include "qemu/error-report.h"
#include "qemu-common.h"
#include "chardev/char-serial.h"
#include "qemu/timer.h"
if (off < FIFO_LEN) {
if (off + len > FIFO_LEN && (s->out_size = off + len) > FIFO_LEN * 2) {
- fprintf(stderr, "%s: can't alloc %i bytes\n", __func__, len);
+ error_report("%s: can't alloc %i bytes", __func__, len);
exit(-1);
}
return s->outfifo + off;
}
if (s->out_len > s->out_size) {
- fprintf(stderr, "%s: can't alloc %i bytes\n", __func__, len);
+ error_report("%s: can't alloc %i bytes", __func__, len);
exit(-1);
}
s->bd_addr.b[5] = data[offset + 2];
s->hci->bdaddr_set(s->hci, s->bd_addr.b);
- fprintf(stderr, "%s: bd_address loaded from firmware: "
- "%02x:%02x:%02x:%02x:%02x:%02x\n", __func__,
- s->bd_addr.b[0], s->bd_addr.b[1], s->bd_addr.b[2],
- s->bd_addr.b[3], s->bd_addr.b[4], s->bd_addr.b[5]);
+ error_report("%s: bd_address loaded from firmware: "
+ "%02x:%02x:%02x:%02x:%02x:%02x", __func__,
+ s->bd_addr.b[0], s->bd_addr.b[1], s->bd_addr.b[2],
+ s->bd_addr.b[3], s->bd_addr.b[4], s->bd_addr.b[5]);
}
rpkt = csrhci_out_packet_event(s, EVT_VENDOR, 11);
break;
default:
- fprintf(stderr, "%s: got a bad CMD packet\n", __func__);
+ error_report("%s: got a bad CMD packet", __func__);
return;
}
case H4_NEG_PKT:
if (s->in_hdr != sizeof(csrhci_neg_packet) ||
memcmp(pkt - 1, csrhci_neg_packet, s->in_hdr)) {
- fprintf(stderr, "%s: got a bad NEG packet\n", __func__);
+ error_report("%s: got a bad NEG packet", __func__);
return;
}
pkt += 2;
case H4_ALIVE_PKT:
if (s->in_hdr != 4 || pkt[1] != 0x55 || pkt[2] != 0x00) {
- fprintf(stderr, "%s: got a bad ALIVE packet\n", __func__);
+ error_report("%s: got a bad ALIVE packet", __func__);
return;
}
default:
bad_pkt:
/* TODO: error out */
- fprintf(stderr, "%s: got a bad packet\n", __func__);
+ error_report("%s: got a bad packet", __func__);
break;
}
*/
#include "qemu/osdep.h"
+#include "qemu/error-report.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "qemu/timer.h"
int mask_byte;
if (len > 255) {
- fprintf(stderr, "%s: HCI event params too long (%ib)\n",
- __func__, len);
+ error_report("%s: HCI event params too long (%ib)", __func__, len);
exit(-1);
}
bt_hci_inquiry_result_with_rssi(hci, slave);
return;
default:
- fprintf(stderr, "%s: bad inquiry mode %02x\n", __func__,
- hci->lm.inquiry_mode);
+ error_report("%s: bad inquiry mode %02x", __func__,
+ hci->lm.inquiry_mode);
exit(-1);
}
}
break;
short_hci:
- fprintf(stderr, "%s: HCI packet too short (%iB)\n",
- __func__, length);
+ error_report("%s: HCI packet too short (%iB)", __func__, length);
bt_hci_event_status(hci, HCI_INVALID_PARAMETERS);
break;
}
/* TODO: avoid memcpy'ing */
if (len + HCI_ACL_HDR_SIZE > sizeof(hci->acl_buf)) {
- fprintf(stderr, "%s: can't take ACL packets %i bytes long\n",
- __func__, len);
+ error_report("%s: can't take ACL packets %i bytes long",
+ __func__, len);
return;
}
memcpy(hci->acl_buf + HCI_ACL_HDR_SIZE, data, len);
struct bt_link_s *link;
if (length < HCI_ACL_HDR_SIZE) {
- fprintf(stderr, "%s: ACL packet too short (%iB)\n",
- __func__, length);
+ error_report("%s: ACL packet too short (%iB)", __func__, length);
return;
}
length -= HCI_ACL_HDR_SIZE;
if (bt_hci_handle_bad(hci, handle)) {
- fprintf(stderr, "%s: invalid ACL handle %03x\n",
- __func__, handle);
+ error_report("%s: invalid ACL handle %03x", __func__, handle);
/* TODO: signal an error */
return;
}
handle &= ~HCI_HANDLE_OFFSET;
if (datalen > length) {
- fprintf(stderr, "%s: ACL packet too short (%iB < %iB)\n",
- __func__, length, datalen);
+ error_report("%s: ACL packet too short (%iB < %iB)",
+ __func__, length, datalen);
return;
}
if (!hci->asb_handle)
hci->asb_handle = handle;
else if (handle != hci->asb_handle) {
- fprintf(stderr, "%s: Bad handle %03x in Active Slave Broadcast\n",
- __func__, handle);
+ error_report("%s: Bad handle %03x in Active Slave Broadcast",
+ __func__, handle);
/* TODO: signal an error */
return;
}
if (!hci->psb_handle)
hci->psb_handle = handle;
else if (handle != hci->psb_handle) {
- fprintf(stderr, "%s: Bad handle %03x in Parked Slave Broadcast\n",
+ error_report("%s: Bad handle %03x in Parked Slave Broadcast",
__func__, handle);
/* TODO: signal an error */
return;
length -= 3;
if (bt_hci_handle_bad(hci, handle)) {
- fprintf(stderr, "%s: invalid SCO handle %03x\n",
- __func__, handle);
+ error_report("%s: invalid SCO handle %03x", __func__, handle);
return;
}
if (datalen > length) {
- fprintf(stderr, "%s: SCO packet too short (%iB < %iB)\n",
- __func__, length, datalen);
+ error_report("%s: SCO packet too short (%iB < %iB)",
+ __func__, length, datalen);
return;
}
return bt_new_hci(vlan);
}
- fprintf(stderr, "qemu: Unknown bluetooth HCI `%s'.\n", str);
+ error_report("Unknown bluetooth HCI `%s'.", str);
return 0;
}
return;
bad:
- fprintf(stderr, "%s: bad transaction on Interrupt channel.\n",
+ error_report("%s: bad transaction on Interrupt channel.",
__func__);
}
*/
#include "qemu/osdep.h"
+#include "qemu/error-report.h"
#include "qemu-common.h"
#include "qemu/timer.h"
#include "qemu/bswap.h"
if (likely(ch)) {
if (ch->remote_cid != source_cid) {
- fprintf(stderr, "%s: Ignoring a Disconnection Request with the "
- "invalid SCID %04x.\n", __func__, source_cid);
+ error_report("%s: Ignoring a Disconnection Request with the "
+ "invalid SCID %04x.", __func__, source_cid);
return;
}
#if 0
/* TODO: do the IDs really have to be in sequence? */
if (!id || (id != l2cap->last_id && id != l2cap->next_id)) {
- fprintf(stderr, "%s: out of sequence command packet ignored.\n",
+ error_report("%s: out of sequence command packet ignored.",
__func__);
return;
}
}
/* We never issue commands other than Command Reject currently. */
- fprintf(stderr, "%s: stray Command Reject (%02x, %04x) "
- "packet, ignoring.\n", __func__, id,
- le16_to_cpu(((l2cap_cmd_rej *) params)->reason));
+ error_report("%s: stray Command Reject (%02x, %04x) "
+ "packet, ignoring.", __func__, id,
+ le16_to_cpu(((l2cap_cmd_rej *) params)->reason));
break;
case L2CAP_CONN_REQ:
}
/* We never issue Connection Requests currently. TODO */
- fprintf(stderr, "%s: unexpected Connection Response (%02x) "
- "packet, ignoring.\n", __func__, id);
+ error_report("%s: unexpected Connection Response (%02x) "
+ "packet, ignoring.", __func__, id);
break;
case L2CAP_CONF_REQ:
le16_to_cpu(((l2cap_conf_rsp *) params)->scid),
((l2cap_conf_rsp *) params)->data,
len - L2CAP_CONF_RSP_SIZE(0)))
- fprintf(stderr, "%s: unexpected Configure Response (%02x) "
- "packet, ignoring.\n", __func__, id);
+ error_report("%s: unexpected Configure Response (%02x) "
+ "packet, ignoring.", __func__, id);
break;
case L2CAP_DISCONN_REQ:
}
/* We never issue Disconnection Requests currently. TODO */
- fprintf(stderr, "%s: unexpected Disconnection Response (%02x) "
- "packet, ignoring.\n", __func__, id);
+ error_report("%s: unexpected Disconnection Response (%02x) "
+ "packet, ignoring.", __func__, id);
break;
case L2CAP_ECHO_REQ:
case L2CAP_ECHO_RSP:
/* We never issue Echo Requests currently. TODO */
- fprintf(stderr, "%s: unexpected Echo Response (%02x) "
- "packet, ignoring.\n", __func__, id);
+ error_report("%s: unexpected Echo Response (%02x) "
+ "packet, ignoring.", __func__, id);
break;
case L2CAP_INFO_REQ:
}
/* We never issue Information Requests currently. TODO */
- fprintf(stderr, "%s: unexpected Information Response (%02x) "
- "packet, ignoring.\n", __func__, id);
+ error_report("%s: unexpected Information Response (%02x) "
+ "packet, ignoring.", __func__, id);
break;
default:
uint16_t len = le16_to_cpu(frame->len);
if (unlikely(cid >= L2CAP_CID_MAX || !l2cap->cid[cid])) {
- fprintf(stderr, "%s: frame addressed to a non-existent L2CAP "
- "channel %04x received.\n", __func__, cid);
+ error_report("%s: frame addressed to a non-existent L2CAP "
+ "channel %04x received.", __func__, cid);
return;
}
struct l2cap_chan_s *chan = (struct l2cap_chan_s *) parm;
if (len > chan->params.remote_mtu) {
- fprintf(stderr, "%s: B-Frame for CID %04x longer than %i octets.\n",
- __func__,
- chan->remote_cid, chan->params.remote_mtu);
+ error_report("%s: B-Frame for CID %04x longer than %i octets.",
+ __func__,
+ chan->remote_cid, chan->params.remote_mtu);
exit(-1);
}
struct bt_l2cap_psm_s *new_psm = l2cap_psm(dev, psm);
if (new_psm) {
- fprintf(stderr, "%s: PSM %04x already registered for device `%s'.\n",
- __func__, psm, dev->device.lmp_name);
+ error_report("%s: PSM %04x already registered for device `%s'.",
+ __func__, psm, dev->device.lmp_name);
exit(-1);
}
*/
#include "qemu/osdep.h"
+#include "qemu/error-report.h"
#include "qemu-common.h"
#include "qemu/host-utils.h"
#include "hw/bt.h"
int rsp_len = 0;
if (len < 5) {
- fprintf(stderr, "%s: short SDP PDU (%iB).\n", __func__, len);
+ error_report("%s: short SDP PDU (%iB).", __func__, len);
return;
}
len -= 5;
if (len != plen) {
- fprintf(stderr, "%s: wrong SDP PDU length (%iB != %iB).\n",
+ error_report("%s: wrong SDP PDU length (%iB != %iB).",
__func__, plen, len);
err = SDP_INVALID_PDU_SIZE;
goto respond;
case SDP_SVC_SEARCH_RSP:
case SDP_SVC_SEARCH_ATTR_RSP:
default:
- fprintf(stderr, "%s: unexpected SDP PDU ID %02x.\n",
+ error_report("%s: unexpected SDP PDU ID %02x.",
__func__, pdu_id);
err = SDP_INVALID_SYNTAX;
break;