3 * BlueZ - Bluetooth protocol stack for Linux
5 * Copyright (C) 2003-2011 Marcel Holtmann <marcel@holtmann.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
36 static char *type2str(uint8_t head)
38 switch (head & 0xf0) {
48 return "Get protocol";
50 return "Set protocol";
58 return "Data continuation";
64 static char *result2str(uint8_t head)
66 switch (head & 0x0f) {
72 return "Invalid report ID";
74 return "Unsupported request";
76 return "Invalid parameter";
86 static char *operation2str(uint8_t head)
88 switch (head & 0x0f) {
90 return "No operation";
98 return "Exit suspend";
100 return "Virtual cable unplug";
106 static char *report2str(uint8_t head)
108 switch (head & 0x03) {
110 return "Other report";
112 return "Input report";
114 return "Output report";
116 return "Feature report";
122 static char *protocol2str(uint8_t head)
124 switch (head & 0x01) {
126 return "Boot protocol";
128 return "Report protocol";
134 void hidp_dump(int level, struct frame *frm)
141 switch (hdr & 0xf0) {
143 param = result2str(hdr);
146 param = operation2str(hdr);
150 param = protocol2str(hdr);
156 param = report2str(hdr);
163 p_indent(level, frm);
165 printf("HIDP: %s: %s\n", type2str(hdr), param);
167 raw_dump(level, frm);