Blame tools/parser/ericsson.c

Packit 34410b
/*
Packit 34410b
 *
Packit 34410b
 *  BlueZ - Bluetooth protocol stack for Linux
Packit 34410b
 *
Packit 34410b
 *  Copyright (C) 2004-2011  Marcel Holtmann <marcel@holtmann.org>
Packit 34410b
 *
Packit 34410b
 *
Packit 34410b
 *  This program is free software; you can redistribute it and/or modify
Packit 34410b
 *  it under the terms of the GNU General Public License as published by
Packit 34410b
 *  the Free Software Foundation; either version 2 of the License, or
Packit 34410b
 *  (at your option) any later version.
Packit 34410b
 *
Packit 34410b
 *  This program is distributed in the hope that it will be useful,
Packit 34410b
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 34410b
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 34410b
 *  GNU General Public License for more details.
Packit 34410b
 *
Packit 34410b
 *  You should have received a copy of the GNU General Public License
Packit 34410b
 *  along with this program; if not, write to the Free Software
Packit 34410b
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
Packit 34410b
 *
Packit 34410b
 */
Packit 34410b
Packit 34410b
#ifdef HAVE_CONFIG_H
Packit 34410b
#include <config.h>
Packit 34410b
#endif
Packit 34410b
Packit 34410b
#define _GNU_SOURCE
Packit 34410b
#include <stdio.h>
Packit 34410b
#include <errno.h>
Packit 34410b
Packit 34410b
#include "parser.h"
Packit 34410b
Packit 34410b
void ericsson_dump(int level, struct frame *frm)
Packit 34410b
{
Packit 34410b
	uint8_t event = p_get_u8(frm);
Packit 34410b
	uint8_t *buf = (uint8_t *) frm->ptr;
Packit 34410b
Packit 34410b
	if (event != 0x10) {
Packit 34410b
		p_indent(level, frm);
Packit 34410b
		printf("Ericsson: event 0x%2.2x\n", event);
Packit 34410b
		raw_dump(level, frm);
Packit 34410b
	}
Packit 34410b
Packit 34410b
	frm->master = !(buf[0] & 0x01);
Packit 34410b
	frm->handle = buf[1] | (buf[2] << 8);
Packit 34410b
Packit 34410b
	buf[5] = (buf[5] << 1) | (buf[3] & 0x01);
Packit 34410b
Packit 34410b
	frm->ptr += 5;
Packit 34410b
	frm->len -= 5;
Packit 34410b
Packit 34410b
	lmp_dump(level, frm);
Packit 34410b
}