3 * BlueZ - Bluetooth protocol stack for Linux
5 * Copyright (C) 2011 Intel Corporation
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
32 #include "lib/bluetooth.h"
35 #include "src/shared/tester.h"
36 #include "src/shared/util.h"
49 static const unsigned char macbookair_data[] = {
50 0x17, 0x09, 0x4d, 0x61, 0x72, 0x63, 0x65, 0x6c,
51 0xe2, 0x80, 0x99, 0x73, 0x20, 0x4d, 0x61, 0x63,
52 0x42, 0x6f, 0x6f, 0x6b, 0x20, 0x41, 0x69, 0x72,
53 0x11, 0x03, 0x12, 0x11, 0x0c, 0x11, 0x0a, 0x11,
54 0x1f, 0x11, 0x01, 0x11, 0x00, 0x10, 0x0a, 0x11,
55 0x17, 0x11, 0x11, 0xff, 0x4c, 0x00, 0x01, 0x4d,
56 0x61, 0x63, 0x42, 0x6f, 0x6f, 0x6b, 0x41, 0x69,
57 0x72, 0x33, 0x2c, 0x31, 0x00, 0x00, 0x00, 0x00,
58 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
59 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
60 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
61 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
62 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
63 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
64 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
65 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
66 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
67 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
68 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
69 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
70 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
71 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
72 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
73 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
74 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
75 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
76 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
77 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
78 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
79 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
82 static const char *macbookair_uuid[] = {
83 "00001112-0000-1000-8000-00805f9b34fb",
84 "0000110c-0000-1000-8000-00805f9b34fb",
85 "0000110a-0000-1000-8000-00805f9b34fb",
86 "0000111f-0000-1000-8000-00805f9b34fb",
87 "00001101-0000-1000-8000-00805f9b34fb",
88 "00001000-0000-1000-8000-00805f9b34fb",
89 "0000110a-0000-1000-8000-00805f9b34fb",
90 "00001117-0000-1000-8000-00805f9b34fb",
94 static const struct test_data macbookair_test = {
95 .eir_data = macbookair_data,
96 .eir_size = sizeof(macbookair_data),
97 .name = "Marcel’s MacBook Air",
98 .name_complete = true,
100 .uuid = macbookair_uuid,
103 static const unsigned char iphone5_data[] = {
104 0x14, 0x09, 0x4d, 0x61, 0x72, 0x63, 0x65, 0x6c,
105 0xe2, 0x80, 0x99, 0x73, 0x20, 0x69, 0x50, 0x68,
106 0x6f, 0x6e, 0x65, 0x20, 0x35, 0x0f, 0x03, 0x00,
107 0x12, 0x1f, 0x11, 0x2f, 0x11, 0x0a, 0x11, 0x0c,
108 0x11, 0x16, 0x11, 0x32, 0x11, 0x01, 0x05, 0x11,
109 0x07, 0xfe, 0xca, 0xca, 0xde, 0xaf, 0xde, 0xca,
110 0xde, 0xde, 0xfa, 0xca, 0xde, 0x00, 0x00, 0x00,
111 0x00, 0x27, 0xff, 0x00, 0x4c, 0x02, 0x24, 0x02,
112 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
113 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
114 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
115 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
116 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
117 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
118 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
119 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
120 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
121 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
122 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
123 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
124 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
125 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
126 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
127 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
128 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
129 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
130 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
131 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
132 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
133 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
136 static const char *iphone5_uuid[] = {
137 "00001200-0000-1000-8000-00805f9b34fb",
138 "0000111f-0000-1000-8000-00805f9b34fb",
139 "0000112f-0000-1000-8000-00805f9b34fb",
140 "0000110a-0000-1000-8000-00805f9b34fb",
141 "0000110c-0000-1000-8000-00805f9b34fb",
142 "00001116-0000-1000-8000-00805f9b34fb",
143 "00001132-0000-1000-8000-00805f9b34fb",
144 "00000000-deca-fade-deca-deafdecacafe",
148 static const struct test_data iphone5_test = {
149 .eir_data = iphone5_data,
150 .eir_size = sizeof(iphone5_data),
151 .name = "Marcel’s iPhone 5",
152 .name_complete = true,
154 .uuid = iphone5_uuid,
157 static const unsigned char ipadmini_data[] = {
158 0x13, 0x09, 0x4d, 0x61, 0x72, 0x63, 0x65, 0x6c,
159 0x27, 0x73, 0x20, 0x69, 0x50, 0x61, 0x64, 0x20,
160 0x6d, 0x69, 0x6e, 0x69, 0x0b, 0x03, 0x00, 0x12,
161 0x1f, 0x11, 0x0a, 0x11, 0x0c, 0x11, 0x32, 0x11,
162 0x01, 0x05, 0x11, 0x07, 0xfe, 0xca, 0xca, 0xde,
163 0xaf, 0xde, 0xca, 0xde, 0xde, 0xfa, 0xca, 0xde,
164 0x00, 0x00, 0x00, 0x00, 0x27, 0xff, 0x00, 0x4c,
165 0x02, 0x24, 0x02, 0x0c, 0x00, 0x00, 0x00, 0x00,
166 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
167 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
168 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
169 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
170 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
171 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
172 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
173 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
174 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
175 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
176 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
177 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
178 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
179 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
180 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
181 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
182 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
183 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
185 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
186 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
187 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
190 static const char *ipadmini_uuid[] = {
191 "00001200-0000-1000-8000-00805f9b34fb",
192 "0000111f-0000-1000-8000-00805f9b34fb",
193 "0000110a-0000-1000-8000-00805f9b34fb",
194 "0000110c-0000-1000-8000-00805f9b34fb",
195 "00001132-0000-1000-8000-00805f9b34fb",
196 "00000000-deca-fade-deca-deafdecacafe",
200 static const struct test_data ipadmini_test = {
201 .eir_data = ipadmini_data,
202 .eir_size = sizeof(ipadmini_data),
203 .name = "Marcel's iPad mini",
204 .name_complete = true,
206 .uuid = ipadmini_uuid,
209 static const unsigned char gigaset_sl400h_data[] = {
210 0x0b, 0x03, 0x01, 0x11, 0x05, 0x11, 0x12, 0x11,
211 0x03, 0x12, 0x1f, 0x11, 0x10, 0x09, 0x4d, 0x61,
212 0x72, 0x63, 0x65, 0x6c, 0x27, 0x73, 0x20, 0x53,
213 0x4c, 0x34, 0x30, 0x30, 0x48, 0x00, 0x00, 0x00,
214 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
215 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
216 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
217 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
218 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
219 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
220 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
221 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
222 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
223 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
224 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
225 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
226 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
227 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
228 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
229 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
230 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
231 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
232 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
233 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
234 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
235 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
236 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
237 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
238 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
239 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
242 static const char *gigaset_sl400h_uuid[] = {
243 "00001101-0000-1000-8000-00805f9b34fb",
244 "00001105-0000-1000-8000-00805f9b34fb",
245 "00001112-0000-1000-8000-00805f9b34fb",
246 "00001203-0000-1000-8000-00805f9b34fb",
247 "0000111f-0000-1000-8000-00805f9b34fb",
251 static const struct test_data gigaset_sl400h_test = {
252 .eir_data = gigaset_sl400h_data,
253 .eir_size = sizeof(gigaset_sl400h_data),
254 .name = "Marcel's SL400H",
255 .name_complete = true,
257 .uuid = gigaset_sl400h_uuid,
260 static const unsigned char gigaset_sl910_data[] = {
261 0x0b, 0x03, 0x01, 0x11, 0x05, 0x11, 0x12, 0x11,
262 0x03, 0x12, 0x1f, 0x11, 0x0f, 0x09, 0x4d, 0x61,
263 0x72, 0x63, 0x65, 0x6c, 0x27, 0x73, 0x20, 0x53,
264 0x4c, 0x39, 0x31, 0x30, 0x00, 0x00, 0x00, 0x00,
265 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
266 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
267 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
268 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
269 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
270 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
271 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
272 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
273 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
274 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
275 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
276 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
277 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
278 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
279 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
280 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
281 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
282 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
283 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
284 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
285 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
286 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
287 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
288 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
289 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
290 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
293 static const char *gigaset_sl910_uuid[] = {
294 "00001101-0000-1000-8000-00805f9b34fb",
295 "00001105-0000-1000-8000-00805f9b34fb",
296 "00001112-0000-1000-8000-00805f9b34fb",
297 "00001203-0000-1000-8000-00805f9b34fb",
298 "0000111f-0000-1000-8000-00805f9b34fb",
302 static const struct test_data gigaset_sl910_test = {
303 .eir_data = gigaset_sl910_data,
304 .eir_size = sizeof(gigaset_sl910_data),
305 .name = "Marcel's SL910",
306 .name_complete = true,
308 .uuid = gigaset_sl910_uuid,
311 static const unsigned char nokia_bh907_data[] = {
312 0x16, 0x09, 0x4e, 0x6f, 0x6b, 0x69, 0x61, 0x20,
313 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e,
314 0x20, 0x42, 0x48, 0x2d, 0x39, 0x30, 0x37, 0x02,
315 0x0a, 0x04, 0x0f, 0x02, 0x0d, 0x11, 0x0b, 0x11,
316 0x0e, 0x11, 0x0f, 0x11, 0x1e, 0x11, 0x08, 0x11,
317 0x31, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
318 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
319 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
320 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
321 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
322 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
323 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
324 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
325 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
326 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
327 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
328 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
329 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
330 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
331 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
332 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
333 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
334 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
335 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
336 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
337 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
338 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
339 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
340 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
341 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
344 static const char *nokia_bh907_uuid[] = {
345 "0000110d-0000-1000-8000-00805f9b34fb",
346 "0000110b-0000-1000-8000-00805f9b34fb",
347 "0000110e-0000-1000-8000-00805f9b34fb",
348 "0000110f-0000-1000-8000-00805f9b34fb",
349 "0000111e-0000-1000-8000-00805f9b34fb",
350 "00001108-0000-1000-8000-00805f9b34fb",
351 "00001131-0000-1000-8000-00805f9b34fb",
355 static const struct test_data nokia_bh907_test = {
356 .eir_data = nokia_bh907_data,
357 .eir_size = sizeof(nokia_bh907_data),
358 .name = "Nokia Reaction BH-907",
359 .name_complete = true,
361 .uuid = nokia_bh907_uuid,
364 static const unsigned char fuelband_data[] = {
365 0x0f, 0x09, 0x4e, 0x69, 0x6b, 0x65, 0x2b, 0x20,
366 0x46, 0x75, 0x65, 0x6c, 0x42, 0x61, 0x6e, 0x64,
367 0x11, 0x07, 0x00, 0x00, 0x00, 0x00, 0xde, 0xca,
368 0xfa, 0xde, 0xde, 0xca, 0xde, 0xaf, 0xde, 0xca,
369 0xca, 0xff, 0x02, 0x0a, 0x00, 0x00, 0x00, 0x00,
370 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
371 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
372 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
373 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
374 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
375 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
376 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
377 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
378 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
379 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
380 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
381 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
382 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
383 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
384 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
385 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
386 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
387 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
388 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
389 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
390 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
391 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
392 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
393 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
394 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
397 static const char *fuelband_uuid[] = {
398 "ffcacade-afde-cade-defa-cade00000000",
402 static const struct test_data fuelband_test = {
403 .eir_data = fuelband_data,
404 .eir_size = sizeof(fuelband_data),
405 .name = "Nike+ FuelBand",
406 .name_complete = true,
408 .uuid = fuelband_uuid,
411 static const unsigned char bluesc_data[] = {
412 0x02, 0x01, 0x06, 0x03, 0x02, 0x16, 0x18, 0x12,
413 0x09, 0x57, 0x61, 0x68, 0x6f, 0x6f, 0x20, 0x42,
414 0x6c, 0x75, 0x65, 0x53, 0x43, 0x20, 0x76, 0x31,
418 static const char *bluesc_uuid[] = {
419 "00001816-0000-1000-8000-00805f9b34fb",
423 static const struct test_data bluesc_test = {
424 .eir_data = bluesc_data,
425 .eir_size = sizeof(bluesc_data),
427 .name = "Wahoo BlueSC v1.4",
428 .name_complete = true,
433 static const unsigned char wahoo_scale_data[] = {
434 0x02, 0x01, 0x06, 0x03, 0x02, 0x01, 0x19, 0x11,
435 0x09, 0x57, 0x61, 0x68, 0x6f, 0x6f, 0x20, 0x53,
436 0x63, 0x61, 0x6c, 0x65, 0x20, 0x76, 0x31, 0x2e,
437 0x33, 0x05, 0xff, 0x00, 0x00, 0x00, 0x9c,
440 static const char *wahoo_scale_uuid[] = {
441 "00001901-0000-1000-8000-00805f9b34fb",
445 static const struct test_data wahoo_scale_test = {
446 .eir_data = wahoo_scale_data,
447 .eir_size = sizeof(wahoo_scale_data),
449 .name = "Wahoo Scale v1.3",
450 .name_complete = true,
452 .uuid = wahoo_scale_uuid,
455 static const unsigned char mio_alpha_data[] = {
456 0x02, 0x01, 0x06, 0x03, 0x02, 0x0d, 0x18, 0x06,
457 0x09, 0x41, 0x4c, 0x50, 0x48, 0x41,
460 static const char *mio_alpha_uuid[] = {
461 "0000180d-0000-1000-8000-00805f9b34fb",
465 static const struct test_data mio_alpha_test = {
466 .eir_data = mio_alpha_data,
467 .eir_size = sizeof(mio_alpha_data),
470 .name_complete = true,
472 .uuid = mio_alpha_uuid,
475 static const unsigned char cookoo_data[] = {
476 0x02, 0x01, 0x05, 0x05, 0x02, 0x02, 0x18, 0x0a,
477 0x18, 0x0d, 0x09, 0x43, 0x4f, 0x4f, 0x4b, 0x4f,
478 0x4f, 0x20, 0x77, 0x61, 0x74, 0x63, 0x68,
481 static const char *cookoo_uuid[] = {
482 "00001802-0000-1000-8000-00805f9b34fb",
483 "0000180a-0000-1000-8000-00805f9b34fb",
487 static const struct test_data cookoo_test = {
488 .eir_data = cookoo_data,
489 .eir_size = sizeof(cookoo_data),
491 .name = "COOKOO watch",
492 .name_complete = true,
497 static const unsigned char citizen_adv_data[] = {
498 0x02, 0x01, 0x05, 0x05, 0x12, 0x7f, 0x01, 0x8f,
499 0x01, 0x14, 0x09, 0x45, 0x63, 0x6f, 0x2d, 0x44,
500 0x72, 0x69, 0x76, 0x65, 0x20, 0x50, 0x72, 0x6f,
501 0x78, 0x69, 0x6d, 0x69, 0x74, 0x79,
504 static const struct test_data citizen_adv_test = {
505 .eir_data = citizen_adv_data,
506 .eir_size = sizeof(citizen_adv_data),
508 .name = "Eco-Drive Proximity",
509 .name_complete = true,
513 static const unsigned char citizen_scan_data[] = {
514 0x02, 0x0a, 0x00, 0x11, 0x07, 0x1b, 0xc5, 0xd5,
515 0xa5, 0x02, 0x00, 0x46, 0x9a, 0xe1, 0x11, 0xb7,
516 0x8d, 0x60, 0xb4, 0x45, 0x2d,
519 static const char *citizen_scan_uuid[] = {
520 "2d45b460-8db7-11e1-9a46-0002a5d5c51b",
524 static const struct test_data citizen_scan_test = {
525 .eir_data = citizen_scan_data,
526 .eir_size = sizeof(citizen_scan_data),
528 .uuid = citizen_scan_uuid,
531 static void test_basic(const void *data)
534 unsigned char buf[HCI_MAX_EIR_LENGTH];
536 memset(buf, 0, sizeof(buf));
537 memset(&eir, 0, sizeof(eir));
539 eir_parse(&eir, buf, HCI_MAX_EIR_LENGTH);
540 g_assert(eir.services == NULL);
541 g_assert(eir.name == NULL);
545 tester_test_passed();
548 static void print_debug(const char *str, void *user_data)
550 char *prefix = user_data;
552 tester_debug("%s%s", prefix, str);
555 static void test_parsing(gconstpointer data)
557 const struct test_data *test = data;
561 memset(&eir, 0, sizeof(eir));
563 eir_parse(&eir, test->eir_data, test->eir_size);
565 tester_debug("Flags: %d", eir.flags);
566 tester_debug("Name: %s", eir.name);
567 tester_debug("TX power: %d", eir.tx_power);
569 for (list = eir.services; list; list = list->next) {
570 char *uuid_str = list->data;
572 tester_debug("UUID: %s", uuid_str);
575 g_assert_cmpint(eir.flags, ==, test->flags);
578 g_assert_cmpstr(eir.name, ==, test->name);
579 g_assert(eir.name_complete == test->name_complete);
581 g_assert(eir.name == NULL);
584 g_assert(eir.tx_power == test->tx_power);
590 for (list = eir.services; list; list = list->next, n++) {
591 char *uuid_str = list->data;
592 g_assert(test->uuid[n]);
593 g_assert_cmpstr(test->uuid[n], ==, uuid_str);
596 g_assert(eir.services == NULL);
599 for (list = eir.msd_list; list; list = list->next) {
600 struct eir_msd *msd = list->data;
602 tester_debug("Manufacturer ID: 0x%04x", msd->company);
603 util_hexdump(' ', msd->data, msd->data_len, print_debug,
604 "Manufacturer Data:");
607 for (list = eir.sd_list; list; list = list->next) {
608 struct eir_sd *sd = list->data;
610 tester_debug("Service UUID: %s", sd->uuid);
611 util_hexdump(' ', sd->data, sd->data_len, print_debug,
617 tester_test_passed();
620 static const unsigned char gigaset_gtag_data[] = {
621 0x02, 0x01, 0x06, 0x0d, 0xff, 0x80, 0x01, 0x02,
622 0x15, 0x12, 0x34, 0x80, 0x91, 0xd0, 0xf2, 0xbb,
623 0xc5, 0x03, 0x02, 0x0f, 0x18, 0x00, 0x00, 0x00,
624 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
627 static const char *gigaset_gtag_uuid[] = {
628 "0000180f-0000-1000-8000-00805f9b34fb",
632 static const struct test_data gigaset_gtag_test = {
633 .eir_data = gigaset_gtag_data,
634 .eir_size = sizeof(gigaset_gtag_data),
637 .uuid = gigaset_gtag_uuid,
640 static const char *uri_beacon_uuid[] = {
641 "0000fed8-0000-1000-8000-00805f9b34fb",
645 static const unsigned char uri_beacon_data[] = {
646 0x03, 0x03, 0xd8, 0xfe, 0x0c, 0x16, 0xd8, 0xfe, 0x00,
647 0x20, 0x00, 'b', 'l', 'u', 'e', 'z', 0x08
650 static const struct test_data uri_beacon_test = {
651 .eir_data = uri_beacon_data,
652 .eir_size = sizeof(uri_beacon_data),
654 .uuid = uri_beacon_uuid,
657 int main(int argc, char *argv[])
659 tester_init(&argc, &argv);
661 tester_add("/eir/basic", NULL, NULL, test_basic, NULL);
663 tester_add("/eir/macbookair", &macbookair_test, NULL, test_parsing,
665 tester_add("/eir/iphone5", &iphone5_test, NULL, test_parsing, NULL);
666 tester_add("/eir/ipadmini", &ipadmini_test, NULL, test_parsing, NULL);
667 tester_add("/eir/sl400h", &gigaset_sl400h_test, NULL, test_parsing,
669 tester_add("/eir/sl910", &gigaset_sl910_test, NULL, test_parsing, NULL);
670 tester_add("/eir/bh907", &nokia_bh907_test, NULL, test_parsing, NULL);
671 tester_add("/eir/fuelband", &fuelband_test, NULL, test_parsing, NULL);
672 tester_add("/ad/bluesc", &bluesc_test, NULL, test_parsing, NULL);
673 tester_add("/ad/wahooscale", &wahoo_scale_test, NULL, test_parsing,
675 tester_add("/ad/mioalpha", &mio_alpha_test, NULL, test_parsing, NULL);
676 tester_add("/ad/cookoo", &cookoo_test, NULL, test_parsing, NULL);
677 tester_add("/ad/citizen1", &citizen_adv_test, NULL, test_parsing, NULL);
678 tester_add("/ad/citizen2", &citizen_scan_test, NULL, test_parsing,
680 tester_add("ad/g-tag", &gigaset_gtag_test, NULL, test_parsing, NULL);
681 tester_add("ad/uri-beacon", &uri_beacon_test, NULL, test_parsing, NULL);