Home | History | Annotate | Download | only in tools
      1 /*
      2  *
      3  *  BlueZ - Bluetooth protocol stack for Linux
      4  *
      5  *  Copyright (C) 2003-2010  Marcel Holtmann <marcel (at) holtmann.org>
      6  *
      7  *
      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.
     12  *
     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.
     17  *
     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
     21  *
     22  */
     23 
     24 #ifdef HAVE_CONFIG_H
     25 #include <config.h>
     26 #endif
     27 
     28 #include <stdio.h>
     29 #include <errno.h>
     30 #include <fcntl.h>
     31 #include <unistd.h>
     32 #include <stdlib.h>
     33 #include <string.h>
     34 #include <sys/stat.h>
     35 #include <sys/mman.h>
     36 #include <sys/socket.h>
     37 
     38 #include <bluetooth/bluetooth.h>
     39 #include <bluetooth/hci.h>
     40 #include <bluetooth/hci_lib.h>
     41 
     42 #include "csr.h"
     43 
     44 struct psr_data {
     45 	uint16_t pskey;
     46 	uint8_t *value;
     47 	uint8_t size;
     48 	struct psr_data *next;
     49 };
     50 
     51 static struct psr_data *head = NULL, *tail = NULL;
     52 
     53 static struct {
     54 	uint16_t id;
     55 	char *str;
     56 } csr_map[] = {
     57 	{   66, "HCI 9.8"	},
     58 	{   97, "HCI 10.3"	},
     59 	{  101, "HCI 10.5"	},
     60 	{  111,	"HCI 11.0"	},
     61 	{  112,	"HCI 11.1"	},
     62 	{  114,	"HCI 11.2"	},
     63 	{  115,	"HCI 11.3"	},
     64 	{  117,	"HCI 12.0"	},
     65 	{  119,	"HCI 12.1"	},
     66 	{  133,	"HCI 12.2"	},
     67 	{  134,	"HCI 12.3"	},
     68 	{  162,	"HCI 12.4"	},
     69 	{  165,	"HCI 12.5"	},
     70 	{  169,	"HCI 12.6"	},
     71 	{  188,	"HCI 12.7"	},
     72 	{  218,	"HCI 12.8"	},
     73 	{  283,	"HCI 12.9"	},
     74 	{  203,	"HCI 13.2"	},
     75 	{  204,	"HCI 13.2"	},
     76 	{  210,	"HCI 13.3"	},
     77 	{  211,	"HCI 13.3"	},
     78 	{  213,	"HCI 13.4"	},
     79 	{  214,	"HCI 13.4"	},
     80 	{  225,	"HCI 13.5"	},
     81 	{  226,	"HCI 13.5"	},
     82 	{  237,	"HCI 13.6"	},
     83 	{  238,	"HCI 13.6"	},
     84 	{  242,	"HCI 14.0"	},
     85 	{  243,	"HCI 14.0"	},
     86 	{  244,	"HCI 14.0"	},
     87 	{  245,	"HCI 14.0"	},
     88 	{  254,	"HCI 13.7"	},
     89 	{  255,	"HCI 13.7"	},
     90 	{  264,	"HCI 14.1"	},
     91 	{  265,	"HCI 14.1"	},
     92 	{  267,	"HCI 14.2"	},
     93 	{  268,	"HCI 14.2"	},
     94 	{  272,	"HCI 14.3"	},
     95 	{  273,	"HCI 14.3"	},
     96 	{  274,	"HCI 13.8"	},
     97 	{  275,	"HCI 13.8"	},
     98 	{  286,	"HCI 13.9"	},
     99 	{  287,	"HCI 13.9"	},
    100 	{  309,	"HCI 13.10"	},
    101 	{  310,	"HCI 13.10"	},
    102 	{  313,	"HCI 14.4"	},
    103 	{  314,	"HCI 14.4"	},
    104 	{  323,	"HCI 14.5"	},
    105 	{  324,	"HCI 14.5"	},
    106 	{  336,	"HCI 14.6"	},
    107 	{  337,	"HCI 14.6"	},
    108 	{  351,	"HCI 13.11"	},
    109 	{  352,	"HCI 13.11"	},
    110 	{  362,	"HCI 15.0"	},
    111 	{  363,	"HCI 15.0"	},
    112 	{  364,	"HCI 15.0"	},
    113 	{  365,	"HCI 15.0"	},
    114 	{  373,	"HCI 14.7"	},
    115 	{  374,	"HCI 14.7"	},
    116 	{  379,	"HCI 15.1"	},
    117 	{  380,	"HCI 15.1"	},
    118 	{  381,	"HCI 15.1"	},
    119 	{  382,	"HCI 15.1"	},
    120 	{  392,	"HCI 15.2"	},
    121 	{  393,	"HCI 15.2"	},
    122 	{  394,	"HCI 15.2"	},
    123 	{  395,	"HCI 15.2"	},
    124 	{  436,	"HCI 16.0"	},
    125 	{  437,	"HCI 16.0"	},
    126 	{  438,	"HCI 16.0"	},
    127 	{  439,	"HCI 16.0"	},
    128 	{  443,	"HCI 15.3"	},
    129 	{  444,	"HCI 15.3"	},
    130 	{  465,	"HCI 16.1"	},
    131 	{  466,	"HCI 16.1"	},
    132 	{  467,	"HCI 16.1"	},
    133 	{  468,	"HCI 16.1"	},
    134 	{  487,	"HCI 14.8"	},
    135 	{  488,	"HCI 14.8"	},
    136 	{  492,	"HCI 16.2"	},
    137 	{  493,	"HCI 16.2"	},
    138 	{  495,	"HCI 16.2"	},
    139 	{  496,	"HCI 16.2"	},
    140 	{  502,	"HCI 16.1.1"	},
    141 	{  503,	"HCI 16.1.1"	},
    142 	{  504,	"HCI 16.1.1"	},
    143 	{  505,	"HCI 16.1.1"	},
    144 	{  506,	"HCI 16.1.2"	},
    145 	{  507,	"HCI 16.1.2"	},
    146 	{  508,	"HCI 16.1.2"	},
    147 	{  509,	"HCI 16.1.2"	},
    148 	{  516,	"HCI 16.3"	},
    149 	{  517,	"HCI 16.3"	},
    150 	{  518,	"HCI 16.3"	},
    151 	{  519,	"HCI 16.3"	},
    152 	{  523,	"HCI 16.4"	},
    153 	{  524,	"HCI 16.4"	},
    154 	{  525,	"HCI 16.4"	},
    155 	{  526,	"HCI 16.4"	},
    156 	{  553,	"HCI 15.3"	},
    157 	{  554,	"HCI 15.3"	},
    158 	{  562,	"HCI 16.5"	},
    159 	{  563,	"HCI 16.5"	},
    160 	{  564,	"HCI 16.5"	},
    161 	{  565,	"HCI 16.5"	},
    162 	{  593,	"HCI 17.0"	},
    163 	{  594,	"HCI 17.0"	},
    164 	{  595,	"HCI 17.0"	},
    165 	{  599,	"HCI 17.0"	},
    166 	{  600,	"HCI 17.0"	},
    167 	{  608,	"HCI 13.10.1"	},
    168 	{  609,	"HCI 13.10.1"	},
    169 	{  613,	"HCI 17.1"	},
    170 	{  614,	"HCI 17.1"	},
    171 	{  615,	"HCI 17.1"	},
    172 	{  616,	"HCI 17.1"	},
    173 	{  618,	"HCI 17.1"	},
    174 	{  624,	"HCI 17.2"	},
    175 	{  625,	"HCI 17.2"	},
    176 	{  626,	"HCI 17.2"	},
    177 	{  627,	"HCI 17.2"	},
    178 	{  637,	"HCI 16.6"	},
    179 	{  638,	"HCI 16.6"	},
    180 	{  639,	"HCI 16.6"	},
    181 	{  640,	"HCI 16.6"	},
    182 	{  642,	"HCI 13.10.2"	},
    183 	{  643,	"HCI 13.10.2"	},
    184 	{  644,	"HCI 13.10.3"	},
    185 	{  645,	"HCI 13.10.3"	},
    186 	{  668,	"HCI 13.10.4"	},
    187 	{  669,	"HCI 13.10.4"	},
    188 	{  681,	"HCI 16.7"	},
    189 	{  682,	"HCI 16.7"	},
    190 	{  683,	"HCI 16.7"	},
    191 	{  684,	"HCI 16.7"	},
    192 	{  704,	"HCI 16.8"	},
    193 	{  718,	"HCI 16.4.1"	},
    194 	{  719,	"HCI 16.4.1"	},
    195 	{  720,	"HCI 16.4.1"	},
    196 	{  721,	"HCI 16.4.1"	},
    197 	{  722,	"HCI 16.7.1"	},
    198 	{  723,	"HCI 16.7.1"	},
    199 	{  724,	"HCI 16.7.1"	},
    200 	{  725,	"HCI 16.7.1"	},
    201 	{  731,	"HCI 16.7.2"	},
    202 	{  732,	"HCI 16.7.2"	},
    203 	{  733,	"HCI 16.7.2"	},
    204 	{  734,	"HCI 16.7.2"	},
    205 	{  735,	"HCI 16.4.2"	},
    206 	{  736,	"HCI 16.4.2"	},
    207 	{  737,	"HCI 16.4.2"	},
    208 	{  738,	"HCI 16.4.2"	},
    209 	{  750,	"HCI 16.7.3"	},
    210 	{  751,	"HCI 16.7.3"	},
    211 	{  752,	"HCI 16.7.3"	},
    212 	{  753,	"HCI 16.7.3"	},
    213 	{  760,	"HCI 16.7.4"	},
    214 	{  761,	"HCI 16.7.4"	},
    215 	{  762,	"HCI 16.7.4"	},
    216 	{  763,	"HCI 16.7.4"	},
    217 	{  770,	"HCI 16.9"	},
    218 	{  771,	"HCI 16.9"	},
    219 	{  772,	"HCI 16.9"	},
    220 	{  773,	"HCI 16.9"	},
    221 	{  774,	"HCI 17.3"	},
    222 	{  775,	"HCI 17.3"	},
    223 	{  776,	"HCI 17.3"	},
    224 	{  777,	"HCI 17.3"	},
    225 	{  781,	"HCI 16.7.5"	},
    226 	{  786,	"HCI 16.10"	},
    227 	{  787,	"HCI 16.10"	},
    228 	{  788,	"HCI 16.10"	},
    229 	{  789,	"HCI 16.10"	},
    230 	{  791,	"HCI 16.4.3"	},
    231 	{  792,	"HCI 16.4.3"	},
    232 	{  793,	"HCI 16.4.3"	},
    233 	{  794,	"HCI 16.4.3"	},
    234 	{  798,	"HCI 16.11"	},
    235 	{  799,	"HCI 16.11"	},
    236 	{  800,	"HCI 16.11"	},
    237 	{  801,	"HCI 16.11"	},
    238 	{  806,	"HCI 16.7.5"	},
    239 	{  807,	"HCI 16.12"	},
    240 	{  808,	"HCI 16.12"	},
    241 	{  809,	"HCI 16.12"	},
    242 	{  810,	"HCI 16.12"	},
    243 	{  817,	"HCI 16.13"	},
    244 	{  818,	"HCI 16.13"	},
    245 	{  819,	"HCI 16.13"	},
    246 	{  820,	"HCI 16.13"	},
    247 	{  823,	"HCI 13.10.5"	},
    248 	{  824,	"HCI 13.10.5"	},
    249 	{  826,	"HCI 16.14"	},
    250 	{  827,	"HCI 16.14"	},
    251 	{  828,	"HCI 16.14"	},
    252 	{  829,	"HCI 16.14"	},
    253 	{  843,	"HCI 17.3.1"	},
    254 	{  856,	"HCI 17.3.2"	},
    255 	{  857,	"HCI 17.3.2"	},
    256 	{  858,	"HCI 17.3.2"	},
    257 	{ 1120, "HCI 17.11"	},
    258 	{ 1168, "HCI 18.1"	},
    259 	{ 1169, "HCI 18.1"	},
    260 	{ 1241, "HCI 18.x"	},
    261 	{ 1298, "HCI 18.2"	},
    262 	{ 1354, "HCI 18.2"	},
    263 	{ 1392, "HCI 18.2"	},
    264 	{ 1393, "HCI 18.2"	},
    265 	{ 1501, "HCI 18.2"	},
    266 	{ 1503, "HCI 18.2"	},
    267 	{ 1504, "HCI 18.2"	},
    268 	{ 1505, "HCI 18.2"	},
    269 	{ 1506, "HCI 18.2"	},
    270 	{ 1520, "HCI 18.2"	},
    271 	{ 1586, "HCI 18.2"	},
    272 	{ 1591, "HCI 18.2"	},
    273 	{ 1592, "HCI 18.2"	},
    274 	{ 1593, "HCI 18.2.1"	},
    275 	{ 1733, "HCI 18.3"	},
    276 	{ 1734, "HCI 18.3"	},
    277 	{ 1735, "HCI 18.3"	},
    278 	{ 1737, "HCI 18.3"	},
    279 	{ 1915, "HCI 19.2"	},
    280 	{ 1916, "HCI 19.2"	},
    281 	{ 1958, "HCI 19.2"	},
    282 	{ 1981, "Unified 20a"	},
    283 	{ 1982, "Unified 20a"	},
    284 	{ 1989, "HCI 18.4"	},
    285 	{ 2062, "Unified 20a1"	},
    286 	{ 2063, "Unified 20a1"	},
    287 	{ 2067, "Unified 18f"	},
    288 	{ 2068, "Unified 18f"	},
    289 	{ 2243, "Unified 18e"	},
    290 	{ 2244, "Unified 18e"	},
    291 	{ 2258, "Unified 20d"	},
    292 	{ 2259, "Unified 20d"	},
    293 	{ 2361, "Unified 20e"	},
    294 	{ 2362, "Unified 20e"	},
    295 	{ 2386, "Unified 21a"	},
    296 	{ 2387, "Unified 21a"	},
    297 	{ 2423, "Unified 21a"	},
    298 	{ 2424, "Unified 21a"	},
    299 	{ 2623, "Unified 21c"	},
    300 	{ 2624, "Unified 21c"	},
    301 	{ 2625, "Unified 21c"	},
    302 	{ 2626, "Unified 21c"	},
    303 	{ 2627, "Unified 21c"	},
    304 	{ 2628, "Unified 21c"	},
    305 	{ 2629, "Unified 21c"	},
    306 	{ 2630, "Unified 21c"	},
    307 	{ 2631, "Unified 21c"	},
    308 	{ 2632, "Unified 21c"	},
    309 	{ 2633, "Unified 21c"	},
    310 	{ 2634, "Unified 21c"	},
    311 	{ 2635, "Unified 21c"	},
    312 	{ 2636, "Unified 21c"	},
    313 	{ 2649, "Unified 21c"	},
    314 	{ 2650, "Unified 21c"	},
    315 	{ 2651, "Unified 21c"	},
    316 	{ 2652, "Unified 21c"	},
    317 	{ 2653, "Unified 21c"	},
    318 	{ 2654, "Unified 21c"	},
    319 	{ 2655, "Unified 21c"	},
    320 	{ 2656, "Unified 21c"	},
    321 	{ 2658, "Unified 21c"	},
    322 	{ 3057, "Unified 21d"	},
    323 	{ 3058, "Unified 21d"	},
    324 	{ 3059, "Unified 21d"	},
    325 	{ 3060, "Unified 21d"	},
    326 	{ 3062, "Unified 21d"	},
    327 	{ 3063, "Unified 21d"	},
    328 	{ 3064, "Unified 21d"	},
    329 	{ 3164, "Unified 21e"	},
    330 	{ 3413, "Unified 21f"	},
    331 	{ 3414, "Unified 21f"	},
    332 	{ 3415, "Unified 21f"	},
    333 	{ 3424, "Unified 21f"	},
    334 	{ 3454, "Unified 21f"	},
    335 	{ 3684, "Unified 21f"	},
    336 	{ 3764, "Unified 21f"	},
    337 	{ 4276, "Unified 22b"	},
    338 	{ 4277, "Unified 22b"	},
    339 	{ 4279, "Unified 22b"	},
    340 	{ 4281, "Unified 22b"	},
    341 	{ 4282, "Unified 22b"	},
    342 	{ 4283, "Unified 22b"	},
    343 	{ 4284, "Unified 22b"	},
    344 	{ 4285, "Unified 22b"	},
    345 	{ 4289, "Unified 22b"	},
    346 	{ 4290, "Unified 22b"	},
    347 	{ 4291, "Unified 22b"	},
    348 	{ 4292, "Unified 22b"	},
    349 	{ 4293, "Unified 22b"	},
    350 	{ 4294, "Unified 22b"	},
    351 	{ 4295, "Unified 22b"	},
    352 	{ 4363, "Unified 22c"	},
    353 	{ 4373, "Unified 22c"	},
    354 	{ 4374, "Unified 22c"	},
    355 	{ 4532, "Unified 22d"	},
    356 	{ 4533, "Unified 22d"	},
    357 	{ 4698, "Unified 23c"	},
    358 	{ 4839, "Unified 23c"	},
    359 	{ 4841, "Unified 23c"	},
    360 	{ 4866, "Unified 23c"	},
    361 	{ 4867, "Unified 23c"	},
    362 	{ 4868, "Unified 23c"	},
    363 	{ 4869, "Unified 23c"	},
    364 	{ 4870, "Unified 23c"	},
    365 	{ 4871, "Unified 23c"	},
    366 	{ 4872, "Unified 23c"	},
    367 	{ 4874, "Unified 23c"	},
    368 	{ 4875, "Unified 23c"	},
    369 	{ 4876, "Unified 23c"	},
    370 	{ 4877, "Unified 23c"	},
    371 	{ 2526, "Marcel 1 (2005-09-26)"	},
    372 	{ 2543, "Marcel 2 (2005-09-28)"	},
    373 	{ 2622, "Marcel 3 (2005-10-27)"	},
    374 	{ 3326, "Marcel 4 (2006-06-16)"	},
    375 	{ 3612, "Marcel 5 (2006-10-24)"	},
    376 	{ 4509, "Marcel 6 (2007-06-11)"	},
    377 	{ 5417, "Marcel 7 (2008-08-26)" },
    378 	{  195, "Sniff 1 (2001-11-27)"	},
    379 	{  220, "Sniff 2 (2002-01-03)"	},
    380 	{  269, "Sniff 3 (2002-02-22)"	},
    381 	{  270, "Sniff 4 (2002-02-26)"	},
    382 	{  284, "Sniff 5 (2002-03-12)"	},
    383 	{  292, "Sniff 6 (2002-03-20)"	},
    384 	{  305, "Sniff 7 (2002-04-12)"	},
    385 	{  306, "Sniff 8 (2002-04-12)"	},
    386 	{  343, "Sniff 9 (2002-05-02)"	},
    387 	{  346, "Sniff 10 (2002-05-03)"	},
    388 	{  355, "Sniff 11 (2002-05-16)"	},
    389 	{  256, "Sniff 11 (2002-05-16)"	},
    390 	{  390, "Sniff 12 (2002-06-26)"	},
    391 	{  450, "Sniff 13 (2002-08-16)"	},
    392 	{  451, "Sniff 13 (2002-08-16)"	},
    393 	{  533, "Sniff 14 (2002-10-11)"	},
    394 	{  580, "Sniff 15 (2002-11-14)"	},
    395 	{  623, "Sniff 16 (2002-12-12)"	},
    396 	{  678, "Sniff 17 (2003-01-29)"	},
    397 	{  847, "Sniff 18 (2003-04-17)"	},
    398 	{  876, "Sniff 19 (2003-06-10)"	},
    399 	{  997, "Sniff 22 (2003-09-05)"	},
    400 	{ 1027, "Sniff 23 (2003-10-03)"	},
    401 	{ 1029, "Sniff 24 (2003-10-03)"	},
    402 	{ 1112, "Sniff 25 (2003-12-03)"	},
    403 	{ 1113, "Sniff 25 (2003-12-03)"	},
    404 	{ 1133, "Sniff 26 (2003-12-18)"	},
    405 	{ 1134, "Sniff 26 (2003-12-18)"	},
    406 	{ 1223, "Sniff 27 (2004-03-08)"	},
    407 	{ 1224, "Sniff 27 (2004-03-08)"	},
    408 	{ 1319, "Sniff 31 (2004-04-22)"	},
    409 	{ 1320, "Sniff 31 (2004-04-22)"	},
    410 	{ 1427, "Sniff 34 (2004-06-16)"	},
    411 	{ 1508, "Sniff 35 (2004-07-19)"	},
    412 	{ 1509, "Sniff 35 (2004-07-19)"	},
    413 	{ 1587, "Sniff 36 (2004-08-18)"	},
    414 	{ 1588, "Sniff 36 (2004-08-18)"	},
    415 	{ 1641, "Sniff 37 (2004-09-16)"	},
    416 	{ 1642, "Sniff 37 (2004-09-16)"	},
    417 	{ 1699, "Sniff 38 (2004-10-07)"	},
    418 	{ 1700, "Sniff 38 (2004-10-07)"	},
    419 	{ 1752, "Sniff 39 (2004-11-02)"	},
    420 	{ 1753, "Sniff 39 (2004-11-02)"	},
    421 	{ 1759, "Sniff 40 (2004-11-03)"	},
    422 	{ 1760, "Sniff 40 (2004-11-03)"	},
    423 	{ 1761, "Sniff 40 (2004-11-03)"	},
    424 	{ 2009, "Sniff 41 (2005-04-06)"	},
    425 	{ 2010, "Sniff 41 (2005-04-06)"	},
    426 	{ 2011, "Sniff 41 (2005-04-06)"	},
    427 	{ 2016, "Sniff 42 (2005-04-11)"	},
    428 	{ 2017, "Sniff 42 (2005-04-11)"	},
    429 	{ 2018, "Sniff 42 (2005-04-11)"	},
    430 	{ 2023, "Sniff 43 (2005-04-14)"	},
    431 	{ 2024, "Sniff 43 (2005-04-14)"	},
    432 	{ 2025, "Sniff 43 (2005-04-14)"	},
    433 	{ 2032, "Sniff 44 (2005-04-18)"	},
    434 	{ 2033, "Sniff 44 (2005-04-18)"	},
    435 	{ 2034, "Sniff 44 (2005-04-18)"	},
    436 	{ 2288, "Sniff 45 (2005-07-08)"	},
    437 	{ 2289, "Sniff 45 (2005-07-08)"	},
    438 	{ 2290, "Sniff 45 (2005-07-08)"	},
    439 	{ 2388, "Sniff 46 (2005-08-17)"	},
    440 	{ 2389, "Sniff 46 (2005-08-17)"	},
    441 	{ 2390, "Sniff 46 (2005-08-17)"	},
    442 	{ 2869, "Sniff 47 (2006-02-15)"	},
    443 	{ 2870, "Sniff 47 (2006-02-15)"	},
    444 	{ 2871, "Sniff 47 (2006-02-15)"	},
    445 	{ 3214, "Sniff 48 (2006-05-16)"	},
    446 	{ 3215, "Sniff 48 (2006-05-16)"	},
    447 	{ 3216, "Sniff 48 (2006-05-16)"	},
    448 	{ 3356, "Sniff 49 (2006-07-17)"	},
    449 	{ 3529, "Sniff 50 (2006-09-21)"	},
    450 	{ 3546, "Sniff 51 (2006-09-29)"	},
    451 	{ 3683, "Sniff 52 (2006-11-03)"	},
    452 	{    0, }
    453 };
    454 
    455 char *csr_builddeftostr(uint16_t def)
    456 {
    457 	switch (def) {
    458 	case 0x0000:
    459 		return "NONE";
    460 	case 0x0001:
    461 		return "CHIP_BASE_BC01";
    462 	case 0x0002:
    463 		return "CHIP_BASE_BC02";
    464 	case 0x0003:
    465 		return "CHIP_BC01B";
    466 	case 0x0004:
    467 		return "CHIP_BC02_EXTERNAL";
    468 	case 0x0005:
    469 		return "BUILD_HCI";
    470 	case 0x0006:
    471 		return "BUILD_RFCOMM";
    472 	case 0x0007:
    473 		return "BT_VER_1_1";
    474 	case 0x0008:
    475 		return "TRANSPORT_ALL";
    476 	case 0x0009:
    477 		return "TRANSPORT_BCSP";
    478 	case 0x000a:
    479 		return "TRANSPORT_H4";
    480 	case 0x000b:
    481 		return "TRANSPORT_USB";
    482 	case 0x000c:
    483 		return "MAX_CRYPT_KEY_LEN_56";
    484 	case 0x000d:
    485 		return "MAX_CRYPT_KEY_LEN_128";
    486 	case 0x000e:
    487 		return "TRANSPORT_USER";
    488 	case 0x000f:
    489 		return "CHIP_BC02_KATO";
    490 	case 0x0010:
    491 		return "TRANSPORT_NONE";
    492 	case 0x0012:
    493 		return "REQUIRE_8MBIT";
    494 	case 0x0013:
    495 		return "RADIOTEST";
    496 	case 0x0014:
    497 		return "RADIOTEST_LITE";
    498 	case 0x0015:
    499 		return "INSTALL_FLASH";
    500 	case 0x0016:
    501 		return "INSTALL_EEPROM";
    502 	case 0x0017:
    503 		return "INSTALL_COMBO_DOT11";
    504 	case 0x0018:
    505 		return "LOWPOWER_TX";
    506 	case 0x0019:
    507 		return "TRANSPORT_TWUTL";
    508 	case 0x001a:
    509 		return "COMPILER_GCC";
    510 	case 0x001b:
    511 		return "CHIP_BC02_CLOUSEAU";
    512 	case 0x001c:
    513 		return "CHIP_BC02_TOULOUSE";
    514 	case 0x001d:
    515 		return "CHIP_BASE_BC3";
    516 	case 0x001e:
    517 		return "CHIP_BC3_NICKNACK";
    518 	case 0x001f:
    519 		return "CHIP_BC3_KALIMBA";
    520 	case 0x0020:
    521 		return "INSTALL_HCI_MODULE";
    522 	case 0x0021:
    523 		return "INSTALL_L2CAP_MODULE";
    524 	case 0x0022:
    525 		return "INSTALL_DM_MODULE";
    526 	case 0x0023:
    527 		return "INSTALL_SDP_MODULE";
    528 	case 0x0024:
    529 		return "INSTALL_RFCOMM_MODULE";
    530 	case 0x0025:
    531 		return "INSTALL_HIDIO_MODULE";
    532 	case 0x0026:
    533 		return "INSTALL_PAN_MODULE";
    534 	case 0x0027:
    535 		return "INSTALL_IPV4_MODULE";
    536 	case 0x0028:
    537 		return "INSTALL_IPV6_MODULE";
    538 	case 0x0029:
    539 		return "INSTALL_TCP_MODULE";
    540 	case 0x002a:
    541 		return "BT_VER_1_2";
    542 	case 0x002b:
    543 		return "INSTALL_UDP_MODULE";
    544 	case 0x002c:
    545 		return "REQUIRE_0_WAIT_STATES";
    546 	case 0x002d:
    547 		return "CHIP_BC3_PADDYWACK";
    548 	case 0x002e:
    549 		return "CHIP_BC4_COYOTE";
    550 	case 0x002f:
    551 		return "CHIP_BC4_ODDJOB";
    552 	case 0x0030:
    553 		return "TRANSPORT_H4DS";
    554 	case 0x0031:
    555 		return "CHIP_BASE_BC4";
    556 	default:
    557 		return "UNKNOWN";
    558 	}
    559 }
    560 
    561 char *csr_buildidtostr(uint16_t id)
    562 {
    563 	static char str[12];
    564 	int i;
    565 
    566 	for (i = 0; csr_map[i].id; i++)
    567 		if (csr_map[i].id == id)
    568 			return csr_map[i].str;
    569 
    570 	snprintf(str, 11, "Build %d", id);
    571 	return str;
    572 }
    573 
    574 char *csr_chipvertostr(uint16_t ver, uint16_t rev)
    575 {
    576 	switch (ver) {
    577 	case 0x00:
    578 		return "BlueCore01a";
    579 	case 0x01:
    580 		switch (rev) {
    581 		case 0x64:
    582 			return "BlueCore01b (ES)";
    583 		case 0x65:
    584 		default:
    585 			return "BlueCore01b";
    586 		}
    587 	case 0x02:
    588 		switch (rev) {
    589 		case 0x89:
    590 			return "BlueCore02-External (ES2)";
    591 		case 0x8a:
    592 			return "BlueCore02-External";
    593 		case 0x28:
    594 			return "BlueCore02-ROM/Audio/Flash";
    595 		default:
    596 			return "BlueCore02";
    597 		}
    598 	case 0x03:
    599 		switch (rev) {
    600 		case 0x43:
    601 			return "BlueCore3-MM";
    602 		case 0x15:
    603 			return "BlueCore3-ROM";
    604 		case 0xe2:
    605 			return "BlueCore3-Flash";
    606 		case 0x26:
    607 			return "BlueCore4-External";
    608 		case 0x30:
    609 			return "BlueCore4-ROM";
    610 		default:
    611 			return "BlueCore3 or BlueCore4";
    612 		}
    613 	default:
    614 		return "Unknown";
    615 	}
    616 }
    617 
    618 char *csr_pskeytostr(uint16_t pskey)
    619 {
    620 	switch (pskey) {
    621 	case CSR_PSKEY_BDADDR:
    622 		return "Bluetooth address";
    623 	case CSR_PSKEY_COUNTRYCODE:
    624 		return "Country code";
    625 	case CSR_PSKEY_CLASSOFDEVICE:
    626 		return "Class of device";
    627 	case CSR_PSKEY_DEVICE_DRIFT:
    628 		return "Device drift";
    629 	case CSR_PSKEY_DEVICE_JITTER:
    630 		return "Device jitter";
    631 	case CSR_PSKEY_MAX_ACLS:
    632 		return "Maximum ACL links";
    633 	case CSR_PSKEY_MAX_SCOS:
    634 		return "Maximum SCO links";
    635 	case CSR_PSKEY_MAX_REMOTE_MASTERS:
    636 		return "Maximum remote masters";
    637 	case CSR_PSKEY_ENABLE_MASTERY_WITH_SLAVERY:
    638 		return "Support master and slave roles simultaneously";
    639 	case CSR_PSKEY_H_HC_FC_MAX_ACL_PKT_LEN:
    640 		return "Maximum HCI ACL packet length";
    641 	case CSR_PSKEY_H_HC_FC_MAX_SCO_PKT_LEN:
    642 		return "Maximum HCI SCO packet length";
    643 	case CSR_PSKEY_H_HC_FC_MAX_ACL_PKTS:
    644 		return "Maximum number of HCI ACL packets";
    645 	case CSR_PSKEY_H_HC_FC_MAX_SCO_PKTS:
    646 		return "Maximum number of HCI SCO packets";
    647 	case CSR_PSKEY_LC_FC_BUFFER_LOW_WATER_MARK:
    648 		return "Flow control low water mark";
    649 	case CSR_PSKEY_LC_MAX_TX_POWER:
    650 		return "Maximum transmit power";
    651 	case CSR_PSKEY_TX_GAIN_RAMP:
    652 		return "Transmit gain ramp rate";
    653 	case CSR_PSKEY_LC_POWER_TABLE:
    654 		return "Radio power table";
    655 	case CSR_PSKEY_LC_PEER_POWER_PERIOD:
    656 		return "Peer transmit power control interval";
    657 	case CSR_PSKEY_LC_FC_POOLS_LOW_WATER_MARK:
    658 		return "Flow control pool low water mark";
    659 	case CSR_PSKEY_LC_DEFAULT_TX_POWER:
    660 		return "Default transmit power";
    661 	case CSR_PSKEY_LC_RSSI_GOLDEN_RANGE:
    662 		return "RSSI at bottom of golden receive range";
    663 	case CSR_PSKEY_LC_COMBO_DISABLE_PIO_MASK:
    664 		return "Combo: PIO lines and logic to disable transmit";
    665 	case CSR_PSKEY_LC_COMBO_PRIORITY_PIO_MASK:
    666 		return "Combo: priority activity PIO lines and logic";
    667 	case CSR_PSKEY_LC_COMBO_DOT11_CHANNEL_PIO_BASE:
    668 		return "Combo: 802.11b channel number base PIO line";
    669 	case CSR_PSKEY_LC_COMBO_DOT11_BLOCK_CHANNELS:
    670 		return "Combo: channels to block either side of 802.11b";
    671 	case CSR_PSKEY_LC_MAX_TX_POWER_NO_RSSI:
    672 		return "Maximum transmit power when peer has no RSSI";
    673 	case CSR_PSKEY_LC_CONNECTION_RX_WINDOW:
    674 		return "Receive window size during connections";
    675 	case CSR_PSKEY_LC_COMBO_DOT11_TX_PROTECTION_MODE:
    676 		return "Combo: which TX packets shall we protect";
    677 	case CSR_PSKEY_LC_ENHANCED_POWER_TABLE:
    678 		return "Radio power table";
    679 	case CSR_PSKEY_LC_WIDEBAND_RSSI_CONFIG:
    680 		return "RSSI configuration for use with wideband RSSI";
    681 	case CSR_PSKEY_LC_COMBO_DOT11_PRIORITY_LEAD:
    682 		return "Combo: How much notice will we give the Combo Card";
    683 	case CSR_PSKEY_BT_CLOCK_INIT:
    684 		return "Initial value of Bluetooth clock";
    685 	case CSR_PSKEY_TX_MR_MOD_DELAY:
    686 		return "TX Mod delay";
    687 	case CSR_PSKEY_RX_MR_SYNC_TIMING:
    688 		return "RX MR Sync Timing";
    689 	case CSR_PSKEY_RX_MR_SYNC_CONFIG:
    690 		return "RX MR Sync Configuration";
    691 	case CSR_PSKEY_LC_LOST_SYNC_SLOTS:
    692 		return "Time in ms for lost sync in low power modes";
    693 	case CSR_PSKEY_RX_MR_SAMP_CONFIG:
    694 		return "RX MR Sync Configuration";
    695 	case CSR_PSKEY_AGC_HYST_LEVELS:
    696 		return "AGC hysteresis levels";
    697 	case CSR_PSKEY_RX_LEVEL_LOW_SIGNAL:
    698 		return "ANA_RX_LVL at low signal strengths";
    699 	case CSR_PSKEY_AGC_IQ_LVL_VALUES:
    700 		return "ANA_IQ_LVL values for AGC algorithmn";
    701 	case CSR_PSKEY_MR_FTRIM_OFFSET_12DB:
    702 		return "ANA_RX_FTRIM offset when using 12 dB IF atten ";
    703 	case CSR_PSKEY_MR_FTRIM_OFFSET_6DB:
    704 		return "ANA_RX_FTRIM offset when using 6 dB IF atten ";
    705 	case CSR_PSKEY_NO_CAL_ON_BOOT:
    706 		return "Do not calibrate radio on boot";
    707 	case CSR_PSKEY_RSSI_HI_TARGET:
    708 		return "RSSI high target";
    709 	case CSR_PSKEY_PREFERRED_MIN_ATTENUATION:
    710 		return "Preferred minimum attenuator setting";
    711 	case CSR_PSKEY_LC_COMBO_DOT11_PRIORITY_OVERRIDE:
    712 		return "Combo: Treat all packets as high priority";
    713 	case CSR_PSKEY_LC_MULTISLOT_HOLDOFF:
    714 		return "Time till single slot packets are used for resync";
    715 	case CSR_PSKEY_FREE_KEY_PIGEON_HOLE:
    716 		return "Link key store bitfield";
    717 	case CSR_PSKEY_LINK_KEY_BD_ADDR0:
    718 		return "Bluetooth address + link key 0";
    719 	case CSR_PSKEY_LINK_KEY_BD_ADDR1:
    720 		return "Bluetooth address + link key 1";
    721 	case CSR_PSKEY_LINK_KEY_BD_ADDR2:
    722 		return "Bluetooth address + link key 2";
    723 	case CSR_PSKEY_LINK_KEY_BD_ADDR3:
    724 		return "Bluetooth address + link key 3";
    725 	case CSR_PSKEY_LINK_KEY_BD_ADDR4:
    726 		return "Bluetooth address + link key 4";
    727 	case CSR_PSKEY_LINK_KEY_BD_ADDR5:
    728 		return "Bluetooth address + link key 5";
    729 	case CSR_PSKEY_LINK_KEY_BD_ADDR6:
    730 		return "Bluetooth address + link key 6";
    731 	case CSR_PSKEY_LINK_KEY_BD_ADDR7:
    732 		return "Bluetooth address + link key 7";
    733 	case CSR_PSKEY_LINK_KEY_BD_ADDR8:
    734 		return "Bluetooth address + link key 8";
    735 	case CSR_PSKEY_LINK_KEY_BD_ADDR9:
    736 		return "Bluetooth address + link key 9";
    737 	case CSR_PSKEY_LINK_KEY_BD_ADDR10:
    738 		return "Bluetooth address + link key 10";
    739 	case CSR_PSKEY_LINK_KEY_BD_ADDR11:
    740 		return "Bluetooth address + link key 11";
    741 	case CSR_PSKEY_LINK_KEY_BD_ADDR12:
    742 		return "Bluetooth address + link key 12";
    743 	case CSR_PSKEY_LINK_KEY_BD_ADDR13:
    744 		return "Bluetooth address + link key 13";
    745 	case CSR_PSKEY_LINK_KEY_BD_ADDR14:
    746 		return "Bluetooth address + link key 14";
    747 	case CSR_PSKEY_LINK_KEY_BD_ADDR15:
    748 		return "Bluetooth address + link key 15";
    749 	case CSR_PSKEY_ENC_KEY_LMIN:
    750 		return "Minimum encryption key length";
    751 	case CSR_PSKEY_ENC_KEY_LMAX:
    752 		return "Maximum encryption key length";
    753 	case CSR_PSKEY_LOCAL_SUPPORTED_FEATURES:
    754 		return "Local supported features block";
    755 	case CSR_PSKEY_LM_USE_UNIT_KEY:
    756 		return "Allow use of unit key for authentication?";
    757 	case CSR_PSKEY_HCI_NOP_DISABLE:
    758 		return "Disable the HCI Command_Status event on boot";
    759 	case CSR_PSKEY_LM_MAX_EVENT_FILTERS:
    760 		return "Maximum number of event filters";
    761 	case CSR_PSKEY_LM_USE_ENC_MODE_BROADCAST:
    762 		return "Allow LM to use enc_mode=2";
    763 	case CSR_PSKEY_LM_TEST_SEND_ACCEPTED_TWICE:
    764 		return "LM sends two LMP_accepted messages in test mode";
    765 	case CSR_PSKEY_LM_MAX_PAGE_HOLD_TIME:
    766 		return "Maximum time we hold a device around page";
    767 	case CSR_PSKEY_AFH_ADAPTATION_RESPONSE_TIME:
    768 		return "LM period for AFH adaption";
    769 	case CSR_PSKEY_AFH_OPTIONS:
    770 		return "Options to configure AFH";
    771 	case CSR_PSKEY_AFH_RSSI_RUN_PERIOD:
    772 		return "AFH RSSI reading period";
    773 	case CSR_PSKEY_AFH_REENABLE_CHANNEL_TIME:
    774 		return "AFH good channel adding time";
    775 	case CSR_PSKEY_NO_DROP_ON_ACR_MS_FAIL:
    776 		return "Complete link if acr barge-in role switch refused";
    777 	case CSR_PSKEY_MAX_PRIVATE_KEYS:
    778 		return "Max private link keys stored";
    779 	case CSR_PSKEY_PRIVATE_LINK_KEY_BD_ADDR0:
    780 		return "Bluetooth address + link key 0";
    781 	case CSR_PSKEY_PRIVATE_LINK_KEY_BD_ADDR1:
    782 		return "Bluetooth address + link key 1";
    783 	case CSR_PSKEY_PRIVATE_LINK_KEY_BD_ADDR2:
    784 		return "Bluetooth address + link key 2";
    785 	case CSR_PSKEY_PRIVATE_LINK_KEY_BD_ADDR3:
    786 		return "Bluetooth address + link key 3";
    787 	case CSR_PSKEY_PRIVATE_LINK_KEY_BD_ADDR4:
    788 		return "Bluetooth address + link key 4";
    789 	case CSR_PSKEY_PRIVATE_LINK_KEY_BD_ADDR5:
    790 		return "Bluetooth address + link key 5";
    791 	case CSR_PSKEY_PRIVATE_LINK_KEY_BD_ADDR6:
    792 		return "Bluetooth address + link key 6";
    793 	case CSR_PSKEY_PRIVATE_LINK_KEY_BD_ADDR7:
    794 		return "Bluetooth address + link key 7";
    795 	case CSR_PSKEY_LOCAL_SUPPORTED_COMMANDS:
    796 		return "Local supported commands";
    797 	case CSR_PSKEY_LM_MAX_ABSENCE_INDEX:
    798 		return "Maximum absence index allowed";
    799 	case CSR_PSKEY_DEVICE_NAME:
    800 		return "Local device's \"user friendly\" name";
    801 	case CSR_PSKEY_AFH_RSSI_THRESHOLD:
    802 		return "AFH RSSI threshold";
    803 	case CSR_PSKEY_LM_CASUAL_SCAN_INTERVAL:
    804 		return "Scan interval in slots for casual scanning";
    805 	case CSR_PSKEY_AFH_MIN_MAP_CHANGE:
    806 		return "The minimum amount to change an AFH map by";
    807 	case CSR_PSKEY_AFH_RSSI_LP_RUN_PERIOD:
    808 		return "AFH RSSI reading period when in low power mode";
    809 	case CSR_PSKEY_HCI_LMP_LOCAL_VERSION:
    810 		return "The HCI and LMP version reported locally";
    811 	case CSR_PSKEY_LMP_REMOTE_VERSION:
    812 		return "The LMP version reported remotely";
    813 	case CSR_PSKEY_HOLD_ERROR_MESSAGE_NUMBER:
    814 		return "Maximum number of queued HCI Hardware Error Events";
    815 	case CSR_PSKEY_DFU_ATTRIBUTES:
    816 		return "DFU attributes";
    817 	case CSR_PSKEY_DFU_DETACH_TO:
    818 		return "DFU detach timeout";
    819 	case CSR_PSKEY_DFU_TRANSFER_SIZE:
    820 		return "DFU transfer size";
    821 	case CSR_PSKEY_DFU_ENABLE:
    822 		return "DFU enable";
    823 	case CSR_PSKEY_DFU_LIN_REG_ENABLE:
    824 		return "Linear Regulator enabled at boot in DFU mode";
    825 	case CSR_PSKEY_DFUENC_VMAPP_PK_MODULUS_MSB:
    826 		return "DFU encryption VM application public key MSB";
    827 	case CSR_PSKEY_DFUENC_VMAPP_PK_MODULUS_LSB:
    828 		return "DFU encryption VM application public key LSB";
    829 	case CSR_PSKEY_DFUENC_VMAPP_PK_M_DASH:
    830 		return "DFU encryption VM application M dash";
    831 	case CSR_PSKEY_DFUENC_VMAPP_PK_R2N_MSB:
    832 		return "DFU encryption VM application public key R2N MSB";
    833 	case CSR_PSKEY_DFUENC_VMAPP_PK_R2N_LSB:
    834 		return "DFU encryption VM application public key R2N LSB";
    835 	case CSR_PSKEY_BCSP_LM_PS_BLOCK:
    836 		return "BCSP link establishment block";
    837 	case CSR_PSKEY_HOSTIO_FC_PS_BLOCK:
    838 		return "HCI flow control block";
    839 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO0:
    840 		return "Host transport channel 0 settings (BCSP ACK)";
    841 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO1:
    842 		return "Host transport channel 1 settings (BCSP-LE)";
    843 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO2:
    844 		return "Host transport channel 2 settings (BCCMD)";
    845 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO3:
    846 		return "Host transport channel 3 settings (HQ)";
    847 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO4:
    848 		return "Host transport channel 4 settings (DM)";
    849 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO5:
    850 		return "Host transport channel 5 settings (HCI CMD/EVT)";
    851 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO6:
    852 		return "Host transport channel 6 settings (HCI ACL)";
    853 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO7:
    854 		return "Host transport channel 7 settings (HCI SCO)";
    855 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO8:
    856 		return "Host transport channel 8 settings (L2CAP)";
    857 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO9:
    858 		return "Host transport channel 9 settings (RFCOMM)";
    859 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO10:
    860 		return "Host transport channel 10 settings (SDP)";
    861 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO11:
    862 		return "Host transport channel 11 settings (TEST)";
    863 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO12:
    864 		return "Host transport channel 12 settings (DFU)";
    865 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO13:
    866 		return "Host transport channel 13 settings (VM)";
    867 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO14:
    868 		return "Host transport channel 14 settings";
    869 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO15:
    870 		return "Host transport channel 15 settings";
    871 	case CSR_PSKEY_HOSTIO_UART_RESET_TIMEOUT:
    872 		return "UART reset counter timeout";
    873 	case CSR_PSKEY_HOSTIO_USE_HCI_EXTN:
    874 		return "Use hci_extn to route non-hci channels";
    875 	case CSR_PSKEY_HOSTIO_USE_HCI_EXTN_CCFC:
    876 		return "Use command-complete flow control for hci_extn";
    877 	case CSR_PSKEY_HOSTIO_HCI_EXTN_PAYLOAD_SIZE:
    878 		return "Maximum hci_extn payload size";
    879 	case CSR_PSKEY_BCSP_LM_CNF_CNT_LIMIT:
    880 		return "BCSP link establishment conf message count";
    881 	case CSR_PSKEY_HOSTIO_MAP_SCO_PCM:
    882 		return "Map SCO over PCM";
    883 	case CSR_PSKEY_HOSTIO_AWKWARD_PCM_SYNC:
    884 		return "PCM interface synchronisation is difficult";
    885 	case CSR_PSKEY_HOSTIO_BREAK_POLL_PERIOD:
    886 		return "Break poll period (microseconds)";
    887 	case CSR_PSKEY_HOSTIO_MIN_UART_HCI_SCO_SIZE:
    888 		return "Minimum SCO packet size sent to host over UART HCI";
    889 	case CSR_PSKEY_HOSTIO_MAP_SCO_CODEC:
    890 		return "Map SCO over the built-in codec";
    891 	case CSR_PSKEY_PCM_CVSD_TX_HI_FREQ_BOOST:
    892 		return "High frequency boost for PCM when transmitting CVSD";
    893 	case CSR_PSKEY_PCM_CVSD_RX_HI_FREQ_BOOST:
    894 		return "High frequency boost for PCM when receiving CVSD";
    895 	case CSR_PSKEY_PCM_CONFIG32:
    896 		return "PCM interface settings bitfields";
    897 	case CSR_PSKEY_USE_OLD_BCSP_LE:
    898 		return "Use the old version of BCSP link establishment";
    899 	case CSR_PSKEY_PCM_CVSD_USE_NEW_FILTER:
    900 		return "CVSD uses the new filter if available";
    901 	case CSR_PSKEY_PCM_FORMAT:
    902 		return "PCM data format";
    903 	case CSR_PSKEY_CODEC_OUT_GAIN:
    904 		return "Audio output gain when using built-in codec";
    905 	case CSR_PSKEY_CODEC_IN_GAIN:
    906 		return "Audio input gain when using built-in codec";
    907 	case CSR_PSKEY_CODEC_PIO:
    908 		return "PIO to enable when built-in codec is enabled";
    909 	case CSR_PSKEY_PCM_LOW_JITTER_CONFIG:
    910 		return "PCM interface settings for low jitter master mode";
    911 	case CSR_PSKEY_HOSTIO_SCO_PCM_THRESHOLDS:
    912 		return "Thresholds for SCO PCM buffers";
    913 	case CSR_PSKEY_HOSTIO_SCO_HCI_THRESHOLDS:
    914 		return "Thresholds for SCO HCI buffers";
    915 	case CSR_PSKEY_HOSTIO_MAP_SCO_PCM_SLOT:
    916 		return "Route SCO data to specified slot in pcm frame";
    917 	case CSR_PSKEY_UART_BAUDRATE:
    918 		return "UART Baud rate";
    919 	case CSR_PSKEY_UART_CONFIG_BCSP:
    920 		return "UART configuration when using BCSP";
    921 	case CSR_PSKEY_UART_CONFIG_H4:
    922 		return "UART configuration when using H4";
    923 	case CSR_PSKEY_UART_CONFIG_H5:
    924 		return "UART configuration when using H5";
    925 	case CSR_PSKEY_UART_CONFIG_USR:
    926 		return "UART configuration when under VM control";
    927 	case CSR_PSKEY_UART_TX_CRCS:
    928 		return "Use CRCs for BCSP or H5";
    929 	case CSR_PSKEY_UART_ACK_TIMEOUT:
    930 		return "Acknowledgement timeout for BCSP and H5";
    931 	case CSR_PSKEY_UART_TX_MAX_ATTEMPTS:
    932 		return "Max times to send reliable BCSP or H5 message";
    933 	case CSR_PSKEY_UART_TX_WINDOW_SIZE:
    934 		return "Transmit window size for BCSP and H5";
    935 	case CSR_PSKEY_UART_HOST_WAKE:
    936 		return "UART host wakeup";
    937 	case CSR_PSKEY_HOSTIO_THROTTLE_TIMEOUT:
    938 		return "Host interface performance control.";
    939 	case CSR_PSKEY_PCM_ALWAYS_ENABLE:
    940 		return "PCM port is always enable when chip is running";
    941 	case CSR_PSKEY_UART_HOST_WAKE_SIGNAL:
    942 		return "Signal to use for uart host wakeup protocol";
    943 	case CSR_PSKEY_UART_CONFIG_H4DS:
    944 		return "UART configuration when using H4DS";
    945 	case CSR_PSKEY_H4DS_WAKE_DURATION:
    946 		return "How long to spend waking the host when using H4DS";
    947 	case CSR_PSKEY_H4DS_MAXWU:
    948 		return "Maximum number of H4DS Wake-Up messages to send";
    949 	case CSR_PSKEY_H4DS_LE_TIMER_PERIOD:
    950 		return "H4DS Link Establishment Tsync and Tconf period";
    951 	case CSR_PSKEY_H4DS_TWU_TIMER_PERIOD:
    952 		return "H4DS Twu timer period";
    953 	case CSR_PSKEY_H4DS_UART_IDLE_TIMER_PERIOD:
    954 		return "H4DS Tuart_idle timer period";
    955 	case CSR_PSKEY_ANA_FTRIM:
    956 		return "Crystal frequency trim";
    957 	case CSR_PSKEY_WD_TIMEOUT:
    958 		return "Watchdog timeout (microseconds)";
    959 	case CSR_PSKEY_WD_PERIOD:
    960 		return "Watchdog period (microseconds)";
    961 	case CSR_PSKEY_HOST_INTERFACE:
    962 		return "Host interface";
    963 	case CSR_PSKEY_HQ_HOST_TIMEOUT:
    964 		return "HQ host command timeout";
    965 	case CSR_PSKEY_HQ_ACTIVE:
    966 		return "Enable host query task?";
    967 	case CSR_PSKEY_BCCMD_SECURITY_ACTIVE:
    968 		return "Enable configuration security";
    969 	case CSR_PSKEY_ANA_FREQ:
    970 		return "Crystal frequency";
    971 	case CSR_PSKEY_PIO_PROTECT_MASK:
    972 		return "Access to PIO pins";
    973 	case CSR_PSKEY_PMALLOC_SIZES:
    974 		return "pmalloc sizes array";
    975 	case CSR_PSKEY_UART_BAUD_RATE:
    976 		return "UART Baud rate (pre 18)";
    977 	case CSR_PSKEY_UART_CONFIG:
    978 		return "UART configuration bitfield";
    979 	case CSR_PSKEY_STUB:
    980 		return "Stub";
    981 	case CSR_PSKEY_TXRX_PIO_CONTROL:
    982 		return "TX and RX PIO control";
    983 	case CSR_PSKEY_ANA_RX_LEVEL:
    984 		return "ANA_RX_LVL register initial value";
    985 	case CSR_PSKEY_ANA_RX_FTRIM:
    986 		return "ANA_RX_FTRIM register initial value";
    987 	case CSR_PSKEY_PSBC_DATA_VERSION:
    988 		return "Persistent store version";
    989 	case CSR_PSKEY_PCM0_ATTENUATION:
    990 		return "Volume control on PCM channel 0";
    991 	case CSR_PSKEY_LO_LVL_MAX:
    992 		return "Maximum value of LO level control register";
    993 	case CSR_PSKEY_LO_ADC_AMPL_MIN:
    994 		return "Minimum value of the LO amplitude measured on the ADC";
    995 	case CSR_PSKEY_LO_ADC_AMPL_MAX:
    996 		return "Maximum value of the LO amplitude measured on the ADC";
    997 	case CSR_PSKEY_IQ_TRIM_CHANNEL:
    998 		return "IQ calibration channel";
    999 	case CSR_PSKEY_IQ_TRIM_GAIN:
   1000 		return "IQ calibration gain";
   1001 	case CSR_PSKEY_IQ_TRIM_ENABLE:
   1002 		return "IQ calibration enable";
   1003 	case CSR_PSKEY_TX_OFFSET_HALF_MHZ:
   1004 		return "Transmit offset";
   1005 	case CSR_PSKEY_GBL_MISC_ENABLES:
   1006 		return "Global miscellaneous hardware enables";
   1007 	case CSR_PSKEY_UART_SLEEP_TIMEOUT:
   1008 		return "Time in ms to deep sleep if nothing received";
   1009 	case CSR_PSKEY_DEEP_SLEEP_STATE:
   1010 		return "Deep sleep state usage";
   1011 	case CSR_PSKEY_IQ_ENABLE_PHASE_TRIM:
   1012 		return "IQ phase enable";
   1013 	case CSR_PSKEY_HCI_HANDLE_FREEZE_PERIOD:
   1014 		return "Time for which HCI handle is frozen after link removal";
   1015 	case CSR_PSKEY_MAX_FROZEN_HCI_HANDLES:
   1016 		return "Maximum number of frozen HCI handles";
   1017 	case CSR_PSKEY_PAGETABLE_DESTRUCTION_DELAY:
   1018 		return "Delay from freezing buf handle to deleting page table";
   1019 	case CSR_PSKEY_IQ_TRIM_PIO_SETTINGS:
   1020 		return "IQ PIO settings";
   1021 	case CSR_PSKEY_USE_EXTERNAL_CLOCK:
   1022 		return "Device uses an external clock";
   1023 	case CSR_PSKEY_DEEP_SLEEP_WAKE_CTS:
   1024 		return "Exit deep sleep on CTS line activity";
   1025 	case CSR_PSKEY_FC_HC2H_FLUSH_DELAY:
   1026 		return "Delay from disconnect to flushing HC->H FC tokens";
   1027 	case CSR_PSKEY_RX_HIGHSIDE:
   1028 		return "Disable the HIGHSIDE bit in ANA_CONFIG";
   1029 	case CSR_PSKEY_TX_PRE_LVL:
   1030 		return "TX pre-amplifier level";
   1031 	case CSR_PSKEY_RX_SINGLE_ENDED:
   1032 		return "RX single ended";
   1033 	case CSR_PSKEY_TX_FILTER_CONFIG:
   1034 		return "TX filter configuration";
   1035 	case CSR_PSKEY_CLOCK_REQUEST_ENABLE:
   1036 		return "External clock request enable";
   1037 	case CSR_PSKEY_RX_MIN_ATTEN:
   1038 		return "Minimum attenuation allowed for receiver";
   1039 	case CSR_PSKEY_XTAL_TARGET_AMPLITUDE:
   1040 		return "Crystal target amplitude";
   1041 	case CSR_PSKEY_PCM_MIN_CPU_CLOCK:
   1042 		return "Minimum CPU clock speed with PCM port running";
   1043 	case CSR_PSKEY_HOST_INTERFACE_PIO_USB:
   1044 		return "USB host interface selection PIO line";
   1045 	case CSR_PSKEY_CPU_IDLE_MODE:
   1046 		return "CPU idle mode when radio is active";
   1047 	case CSR_PSKEY_DEEP_SLEEP_CLEAR_RTS:
   1048 		return "Deep sleep clears the UART RTS line";
   1049 	case CSR_PSKEY_RF_RESONANCE_TRIM:
   1050 		return "Frequency trim for IQ and LNA resonant circuits";
   1051 	case CSR_PSKEY_DEEP_SLEEP_PIO_WAKE:
   1052 		return "PIO line to wake the chip from deep sleep";
   1053 	case CSR_PSKEY_DRAIN_BORE_TIMERS:
   1054 		return "Energy consumption measurement settings";
   1055 	case CSR_PSKEY_DRAIN_TX_POWER_BASE:
   1056 		return "Energy consumption measurement settings";
   1057 	case CSR_PSKEY_MODULE_ID:
   1058 		return "Module serial number";
   1059 	case CSR_PSKEY_MODULE_DESIGN:
   1060 		return "Module design ID";
   1061 	case CSR_PSKEY_MODULE_SECURITY_CODE:
   1062 		return "Module security code";
   1063 	case CSR_PSKEY_VM_DISABLE:
   1064 		return "VM disable";
   1065 	case CSR_PSKEY_MOD_MANUF0:
   1066 		return "Module manufactuer data 0";
   1067 	case CSR_PSKEY_MOD_MANUF1:
   1068 		return "Module manufactuer data 1";
   1069 	case CSR_PSKEY_MOD_MANUF2:
   1070 		return "Module manufactuer data 2";
   1071 	case CSR_PSKEY_MOD_MANUF3:
   1072 		return "Module manufactuer data 3";
   1073 	case CSR_PSKEY_MOD_MANUF4:
   1074 		return "Module manufactuer data 4";
   1075 	case CSR_PSKEY_MOD_MANUF5:
   1076 		return "Module manufactuer data 5";
   1077 	case CSR_PSKEY_MOD_MANUF6:
   1078 		return "Module manufactuer data 6";
   1079 	case CSR_PSKEY_MOD_MANUF7:
   1080 		return "Module manufactuer data 7";
   1081 	case CSR_PSKEY_MOD_MANUF8:
   1082 		return "Module manufactuer data 8";
   1083 	case CSR_PSKEY_MOD_MANUF9:
   1084 		return "Module manufactuer data 9";
   1085 	case CSR_PSKEY_DUT_VM_DISABLE:
   1086 		return "VM disable when entering radiotest modes";
   1087 	case CSR_PSKEY_USR0:
   1088 		return "User configuration data 0";
   1089 	case CSR_PSKEY_USR1:
   1090 		return "User configuration data 1";
   1091 	case CSR_PSKEY_USR2:
   1092 		return "User configuration data 2";
   1093 	case CSR_PSKEY_USR3:
   1094 		return "User configuration data 3";
   1095 	case CSR_PSKEY_USR4:
   1096 		return "User configuration data 4";
   1097 	case CSR_PSKEY_USR5:
   1098 		return "User configuration data 5";
   1099 	case CSR_PSKEY_USR6:
   1100 		return "User configuration data 6";
   1101 	case CSR_PSKEY_USR7:
   1102 		return "User configuration data 7";
   1103 	case CSR_PSKEY_USR8:
   1104 		return "User configuration data 8";
   1105 	case CSR_PSKEY_USR9:
   1106 		return "User configuration data 9";
   1107 	case CSR_PSKEY_USR10:
   1108 		return "User configuration data 10";
   1109 	case CSR_PSKEY_USR11:
   1110 		return "User configuration data 11";
   1111 	case CSR_PSKEY_USR12:
   1112 		return "User configuration data 12";
   1113 	case CSR_PSKEY_USR13:
   1114 		return "User configuration data 13";
   1115 	case CSR_PSKEY_USR14:
   1116 		return "User configuration data 14";
   1117 	case CSR_PSKEY_USR15:
   1118 		return "User configuration data 15";
   1119 	case CSR_PSKEY_USR16:
   1120 		return "User configuration data 16";
   1121 	case CSR_PSKEY_USR17:
   1122 		return "User configuration data 17";
   1123 	case CSR_PSKEY_USR18:
   1124 		return "User configuration data 18";
   1125 	case CSR_PSKEY_USR19:
   1126 		return "User configuration data 19";
   1127 	case CSR_PSKEY_USR20:
   1128 		return "User configuration data 20";
   1129 	case CSR_PSKEY_USR21:
   1130 		return "User configuration data 21";
   1131 	case CSR_PSKEY_USR22:
   1132 		return "User configuration data 22";
   1133 	case CSR_PSKEY_USR23:
   1134 		return "User configuration data 23";
   1135 	case CSR_PSKEY_USR24:
   1136 		return "User configuration data 24";
   1137 	case CSR_PSKEY_USR25:
   1138 		return "User configuration data 25";
   1139 	case CSR_PSKEY_USR26:
   1140 		return "User configuration data 26";
   1141 	case CSR_PSKEY_USR27:
   1142 		return "User configuration data 27";
   1143 	case CSR_PSKEY_USR28:
   1144 		return "User configuration data 28";
   1145 	case CSR_PSKEY_USR29:
   1146 		return "User configuration data 29";
   1147 	case CSR_PSKEY_USR30:
   1148 		return "User configuration data 30";
   1149 	case CSR_PSKEY_USR31:
   1150 		return "User configuration data 31";
   1151 	case CSR_PSKEY_USR32:
   1152 		return "User configuration data 32";
   1153 	case CSR_PSKEY_USR33:
   1154 		return "User configuration data 33";
   1155 	case CSR_PSKEY_USR34:
   1156 		return "User configuration data 34";
   1157 	case CSR_PSKEY_USR35:
   1158 		return "User configuration data 35";
   1159 	case CSR_PSKEY_USR36:
   1160 		return "User configuration data 36";
   1161 	case CSR_PSKEY_USR37:
   1162 		return "User configuration data 37";
   1163 	case CSR_PSKEY_USR38:
   1164 		return "User configuration data 38";
   1165 	case CSR_PSKEY_USR39:
   1166 		return "User configuration data 39";
   1167 	case CSR_PSKEY_USR40:
   1168 		return "User configuration data 40";
   1169 	case CSR_PSKEY_USR41:
   1170 		return "User configuration data 41";
   1171 	case CSR_PSKEY_USR42:
   1172 		return "User configuration data 42";
   1173 	case CSR_PSKEY_USR43:
   1174 		return "User configuration data 43";
   1175 	case CSR_PSKEY_USR44:
   1176 		return "User configuration data 44";
   1177 	case CSR_PSKEY_USR45:
   1178 		return "User configuration data 45";
   1179 	case CSR_PSKEY_USR46:
   1180 		return "User configuration data 46";
   1181 	case CSR_PSKEY_USR47:
   1182 		return "User configuration data 47";
   1183 	case CSR_PSKEY_USR48:
   1184 		return "User configuration data 48";
   1185 	case CSR_PSKEY_USR49:
   1186 		return "User configuration data 49";
   1187 	case CSR_PSKEY_USB_VERSION:
   1188 		return "USB specification version number";
   1189 	case CSR_PSKEY_USB_DEVICE_CLASS_CODES:
   1190 		return "USB device class codes";
   1191 	case CSR_PSKEY_USB_VENDOR_ID:
   1192 		return "USB vendor identifier";
   1193 	case CSR_PSKEY_USB_PRODUCT_ID:
   1194 		return "USB product identifier";
   1195 	case CSR_PSKEY_USB_MANUF_STRING:
   1196 		return "USB manufacturer string";
   1197 	case CSR_PSKEY_USB_PRODUCT_STRING:
   1198 		return "USB product string";
   1199 	case CSR_PSKEY_USB_SERIAL_NUMBER_STRING:
   1200 		return "USB serial number string";
   1201 	case CSR_PSKEY_USB_CONFIG_STRING:
   1202 		return "USB configuration string";
   1203 	case CSR_PSKEY_USB_ATTRIBUTES:
   1204 		return "USB attributes bitmap";
   1205 	case CSR_PSKEY_USB_MAX_POWER:
   1206 		return "USB device maximum power consumption";
   1207 	case CSR_PSKEY_USB_BT_IF_CLASS_CODES:
   1208 		return "USB Bluetooth interface class codes";
   1209 	case CSR_PSKEY_USB_LANGID:
   1210 		return "USB language strings supported";
   1211 	case CSR_PSKEY_USB_DFU_CLASS_CODES:
   1212 		return "USB DFU class codes block";
   1213 	case CSR_PSKEY_USB_DFU_PRODUCT_ID:
   1214 		return "USB DFU product ID";
   1215 	case CSR_PSKEY_USB_PIO_DETACH:
   1216 		return "USB detach/attach PIO line";
   1217 	case CSR_PSKEY_USB_PIO_WAKEUP:
   1218 		return "USB wakeup PIO line";
   1219 	case CSR_PSKEY_USB_PIO_PULLUP:
   1220 		return "USB D+ pullup PIO line";
   1221 	case CSR_PSKEY_USB_PIO_VBUS:
   1222 		return "USB VBus detection PIO Line";
   1223 	case CSR_PSKEY_USB_PIO_WAKE_TIMEOUT:
   1224 		return "Timeout for assertion of USB PIO wake signal";
   1225 	case CSR_PSKEY_USB_PIO_RESUME:
   1226 		return "PIO signal used in place of bus resume";
   1227 	case CSR_PSKEY_USB_BT_SCO_IF_CLASS_CODES:
   1228 		return "USB Bluetooth SCO interface class codes";
   1229 	case CSR_PSKEY_USB_SUSPEND_PIO_LEVEL:
   1230 		return "USB PIO levels to set when suspended";
   1231 	case CSR_PSKEY_USB_SUSPEND_PIO_DIR:
   1232 		return "USB PIO I/O directions to set when suspended";
   1233 	case CSR_PSKEY_USB_SUSPEND_PIO_MASK:
   1234 		return "USB PIO lines to be set forcibly in suspend";
   1235 	case CSR_PSKEY_USB_ENDPOINT_0_MAX_PACKET_SIZE:
   1236 		return "The maxmimum packet size for USB endpoint 0";
   1237 	case CSR_PSKEY_USB_CONFIG:
   1238 		return "USB config params for new chips (>bc2)";
   1239 	case CSR_PSKEY_RADIOTEST_ATTEN_INIT:
   1240 		return "Radio test initial attenuator";
   1241 	case CSR_PSKEY_RADIOTEST_FIRST_TRIM_TIME:
   1242 		return "IQ first calibration period in test";
   1243 	case CSR_PSKEY_RADIOTEST_SUBSEQUENT_TRIM_TIME:
   1244 		return "IQ subsequent calibration period in test";
   1245 	case CSR_PSKEY_RADIOTEST_LO_LVL_TRIM_ENABLE:
   1246 		return "LO_LVL calibration enable";
   1247 	case CSR_PSKEY_RADIOTEST_DISABLE_MODULATION:
   1248 		return "Disable modulation during radiotest transmissions";
   1249 	case CSR_PSKEY_RFCOMM_FCON_THRESHOLD:
   1250 		return "RFCOMM aggregate flow control on threshold";
   1251 	case CSR_PSKEY_RFCOMM_FCOFF_THRESHOLD:
   1252 		return "RFCOMM aggregate flow control off threshold";
   1253 	case CSR_PSKEY_IPV6_STATIC_ADDR:
   1254 		return "Static IPv6 address";
   1255 	case CSR_PSKEY_IPV4_STATIC_ADDR:
   1256 		return "Static IPv4 address";
   1257 	case CSR_PSKEY_IPV6_STATIC_PREFIX_LEN:
   1258 		return "Static IPv6 prefix length";
   1259 	case CSR_PSKEY_IPV6_STATIC_ROUTER_ADDR:
   1260 		return "Static IPv6 router address";
   1261 	case CSR_PSKEY_IPV4_STATIC_SUBNET_MASK:
   1262 		return "Static IPv4 subnet mask";
   1263 	case CSR_PSKEY_IPV4_STATIC_ROUTER_ADDR:
   1264 		return "Static IPv4 router address";
   1265 	case CSR_PSKEY_MDNS_NAME:
   1266 		return "Multicast DNS name";
   1267 	case CSR_PSKEY_FIXED_PIN:
   1268 		return "Fixed PIN";
   1269 	case CSR_PSKEY_MDNS_PORT:
   1270 		return "Multicast DNS port";
   1271 	case CSR_PSKEY_MDNS_TTL:
   1272 		return "Multicast DNS TTL";
   1273 	case CSR_PSKEY_MDNS_IPV4_ADDR:
   1274 		return "Multicast DNS IPv4 address";
   1275 	case CSR_PSKEY_ARP_CACHE_TIMEOUT:
   1276 		return "ARP cache timeout";
   1277 	case CSR_PSKEY_HFP_POWER_TABLE:
   1278 		return "HFP power table";
   1279 	case CSR_PSKEY_DRAIN_BORE_TIMER_COUNTERS:
   1280 		return "Energy consumption estimation timer counters";
   1281 	case CSR_PSKEY_DRAIN_BORE_COUNTERS:
   1282 		return "Energy consumption estimation counters";
   1283 	case CSR_PSKEY_LOOP_FILTER_TRIM:
   1284 		return "Trim value to optimise loop filter";
   1285 	case CSR_PSKEY_DRAIN_BORE_CURRENT_PEAK:
   1286 		return "Energy consumption estimation current peak";
   1287 	case CSR_PSKEY_VM_E2_CACHE_LIMIT:
   1288 		return "Maximum RAM for caching EEPROM VM application";
   1289 	case CSR_PSKEY_FORCE_16MHZ_REF_PIO:
   1290 		return "PIO line to force 16 MHz reference to be assumed";
   1291 	case CSR_PSKEY_CDMA_LO_REF_LIMITS:
   1292 		return "Local oscillator frequency reference limits for CDMA";
   1293 	case CSR_PSKEY_CDMA_LO_ERROR_LIMITS:
   1294 		return "Local oscillator frequency error limits for CDMA";
   1295 	case CSR_PSKEY_CLOCK_STARTUP_DELAY:
   1296 		return "Clock startup delay in milliseconds";
   1297 	case CSR_PSKEY_DEEP_SLEEP_CORRECTION_FACTOR:
   1298 		return "Deep sleep clock correction factor";
   1299 	case CSR_PSKEY_TEMPERATURE_CALIBRATION:
   1300 		return "Temperature in deg C for a given internal setting";
   1301 	case CSR_PSKEY_TEMPERATURE_VS_DELTA_INTERNAL_PA:
   1302 		return "Temperature for given internal PA adjustment";
   1303 	case CSR_PSKEY_TEMPERATURE_VS_DELTA_TX_PRE_LVL:
   1304 		return "Temperature for a given TX_PRE_LVL adjustment";
   1305 	case CSR_PSKEY_TEMPERATURE_VS_DELTA_TX_BB:
   1306 		return "Temperature for a given TX_BB adjustment";
   1307 	case CSR_PSKEY_TEMPERATURE_VS_DELTA_ANA_FTRIM:
   1308 		return "Temperature for given crystal trim adjustment";
   1309 	case CSR_PSKEY_TEST_DELTA_OFFSET:
   1310 		return "Frequency offset applied to synthesiser in test mode";
   1311 	case CSR_PSKEY_RX_DYNAMIC_LVL_OFFSET:
   1312 		return "Receiver dynamic level offset depending on channel";
   1313 	case CSR_PSKEY_TEST_FORCE_OFFSET:
   1314 		return "Force use of exact value in PSKEY_TEST_DELTA_OFFSET";
   1315 	case CSR_PSKEY_RF_TRAP_BAD_DIVISION_RATIOS:
   1316 		return "Trap bad division ratios in radio frequency tables";
   1317 	case CSR_PSKEY_RADIOTEST_CDMA_LO_REF_LIMITS:
   1318 		return "LO frequency reference limits for CDMA in radiotest";
   1319 	case CSR_PSKEY_INITIAL_BOOTMODE:
   1320 		return "Initial device bootmode";
   1321 	case CSR_PSKEY_ONCHIP_HCI_CLIENT:
   1322 		return "HCI traffic routed internally";
   1323 	case CSR_PSKEY_RX_ATTEN_BACKOFF:
   1324 		return "Receiver attenuation back-off";
   1325 	case CSR_PSKEY_RX_ATTEN_UPDATE_RATE:
   1326 		return "Receiver attenuation update rate";
   1327 	case CSR_PSKEY_SYNTH_TXRX_THRESHOLDS:
   1328 		return "Local oscillator tuning voltage limits for tx and rx";
   1329 	case CSR_PSKEY_MIN_WAIT_STATES:
   1330 		return "Flash wait state indicator";
   1331 	case CSR_PSKEY_RSSI_CORRECTION:
   1332 		return "RSSI correction factor.";
   1333 	case CSR_PSKEY_SCHED_THROTTLE_TIMEOUT:
   1334 		return "Scheduler performance control.";
   1335 	case CSR_PSKEY_DEEP_SLEEP_USE_EXTERNAL_CLOCK:
   1336 		return "Deep sleep uses external 32 kHz clock source";
   1337 	case CSR_PSKEY_TRIM_RADIO_FILTERS:
   1338 		return "Trim rx and tx radio filters if true.";
   1339 	case CSR_PSKEY_TRANSMIT_OFFSET:
   1340 		return "Transmit offset in units of 62.5 kHz";
   1341 	case CSR_PSKEY_USB_VM_CONTROL:
   1342 		return "VM application will supply USB descriptors";
   1343 	case CSR_PSKEY_MR_ANA_RX_FTRIM:
   1344 		return "Medium rate value for the ANA_RX_FTRIM register";
   1345 	case CSR_PSKEY_I2C_CONFIG:
   1346 		return "I2C configuration";
   1347 	case CSR_PSKEY_IQ_LVL_RX:
   1348 		return "IQ demand level for reception";
   1349 	case CSR_PSKEY_MR_TX_FILTER_CONFIG:
   1350 		return "TX filter configuration used for enhanced data rate";
   1351 	case CSR_PSKEY_MR_TX_CONFIG2:
   1352 		return "TX filter configuration used for enhanced data rate";
   1353 	case CSR_PSKEY_USB_DONT_RESET_BOOTMODE_ON_HOST_RESET:
   1354 		return "Don't reset bootmode if USB host resets";
   1355 	case CSR_PSKEY_LC_USE_THROTTLING:
   1356 		return "Adjust packet selection on packet error rate";
   1357 	case CSR_PSKEY_CHARGER_TRIM:
   1358 		return "Trim value for the current charger";
   1359 	case CSR_PSKEY_CLOCK_REQUEST_FEATURES:
   1360 		return "Clock request is tristated if enabled";
   1361 	case CSR_PSKEY_TRANSMIT_OFFSET_CLASS1:
   1362 		return "Transmit offset / 62.5 kHz for class 1 radios";
   1363 	case CSR_PSKEY_TX_AVOID_PA_CLASS1_PIO:
   1364 		return "PIO line asserted in class1 operation to avoid PA";
   1365 	case CSR_PSKEY_MR_PIO_CONFIG:
   1366 		return "PIO line asserted in class1 operation to avoid PA";
   1367 	case CSR_PSKEY_UART_CONFIG2:
   1368 		return "The UART Sampling point";
   1369 	case CSR_PSKEY_CLASS1_IQ_LVL:
   1370 		return "IQ demand level for class 1 power level";
   1371 	case CSR_PSKEY_CLASS1_TX_CONFIG2:
   1372 		return "TX filter configuration used for class 1 tx power";
   1373 	case CSR_PSKEY_TEMPERATURE_VS_DELTA_INTERNAL_PA_CLASS1:
   1374 		return "Temperature for given internal PA adjustment";
   1375 	case CSR_PSKEY_TEMPERATURE_VS_DELTA_EXTERNAL_PA_CLASS1:
   1376 		return "Temperature for given internal PA adjustment";
   1377 	case CSR_PSKEY_TEMPERATURE_VS_DELTA_TX_PRE_LVL_MR:
   1378 		return "Temperature adjustment for TX_PRE_LVL in EDR";
   1379 	case CSR_PSKEY_TEMPERATURE_VS_DELTA_TX_BB_MR_HEADER:
   1380 		return "Temperature for a given TX_BB in EDR header";
   1381 	case CSR_PSKEY_TEMPERATURE_VS_DELTA_TX_BB_MR_PAYLOAD:
   1382 		return "Temperature for a given TX_BB in EDR payload";
   1383 	case CSR_PSKEY_RX_MR_EQ_TAPS:
   1384 		return "Adjust receiver configuration for EDR";
   1385 	case CSR_PSKEY_TX_PRE_LVL_CLASS1:
   1386 		return "TX pre-amplifier level in class 1 operation";
   1387 	case CSR_PSKEY_ANALOGUE_ATTENUATOR:
   1388 		return "TX analogue attenuator setting";
   1389 	case CSR_PSKEY_MR_RX_FILTER_TRIM:
   1390 		return "Trim for receiver used in EDR.";
   1391 	case CSR_PSKEY_MR_RX_FILTER_RESPONSE:
   1392 		return "Filter response for receiver used in EDR.";
   1393 	case CSR_PSKEY_PIO_WAKEUP_STATE:
   1394 		return "PIO deep sleep wake up state ";
   1395 	case CSR_PSKEY_MR_TX_IF_ATTEN_OFF_TEMP:
   1396 		return "TX IF atten off temperature when using EDR.";
   1397 	case CSR_PSKEY_LO_DIV_LATCH_BYPASS:
   1398 		return "Bypass latch for LO dividers";
   1399 	case CSR_PSKEY_LO_VCO_STANDBY:
   1400 		return "Use standby mode for the LO VCO";
   1401 	case CSR_PSKEY_SLOW_CLOCK_FILTER_SHIFT:
   1402 		return "Slow clock sampling filter constant";
   1403 	case CSR_PSKEY_SLOW_CLOCK_FILTER_DIVIDER:
   1404 		return "Slow clock filter fractional threshold";
   1405 	case CSR_PSKEY_USB_ATTRIBUTES_POWER:
   1406 		return "USB self powered";
   1407 	case CSR_PSKEY_USB_ATTRIBUTES_WAKEUP:
   1408 		return "USB responds to wake-up";
   1409 	case CSR_PSKEY_DFU_ATTRIBUTES_MANIFESTATION_TOLERANT:
   1410 		return "DFU manifestation tolerant";
   1411 	case CSR_PSKEY_DFU_ATTRIBUTES_CAN_UPLOAD:
   1412 		return "DFU can upload";
   1413 	case CSR_PSKEY_DFU_ATTRIBUTES_CAN_DOWNLOAD:
   1414 		return "DFU can download";
   1415 	case CSR_PSKEY_UART_CONFIG_STOP_BITS:
   1416 		return "UART: stop bits";
   1417 	case CSR_PSKEY_UART_CONFIG_PARITY_BIT:
   1418 		return "UART: parity bit";
   1419 	case CSR_PSKEY_UART_CONFIG_FLOW_CTRL_EN:
   1420 		return "UART: hardware flow control";
   1421 	case CSR_PSKEY_UART_CONFIG_RTS_AUTO_EN:
   1422 		return "UART: RTS auto-enabled";
   1423 	case CSR_PSKEY_UART_CONFIG_RTS:
   1424 		return "UART: RTS asserted";
   1425 	case CSR_PSKEY_UART_CONFIG_TX_ZERO_EN:
   1426 		return "UART: TX zero enable";
   1427 	case CSR_PSKEY_UART_CONFIG_NON_BCSP_EN:
   1428 		return "UART: enable BCSP-specific hardware";
   1429 	case CSR_PSKEY_UART_CONFIG_RX_RATE_DELAY:
   1430 		return "UART: RX rate delay";
   1431 	case CSR_PSKEY_UART_SEQ_TIMEOUT:
   1432 		return "UART: BCSP ack timeout";
   1433 	case CSR_PSKEY_UART_SEQ_RETRIES:
   1434 		return "UART: retry limit in sequencing layer";
   1435 	case CSR_PSKEY_UART_SEQ_WINSIZE:
   1436 		return "UART: BCSP transmit window size";
   1437 	case CSR_PSKEY_UART_USE_CRC_ON_TX:
   1438 		return "UART: use BCSP CRCs";
   1439 	case CSR_PSKEY_UART_HOST_INITIAL_STATE:
   1440 		return "UART: initial host state";
   1441 	case CSR_PSKEY_UART_HOST_ATTENTION_SPAN:
   1442 		return "UART: host attention span";
   1443 	case CSR_PSKEY_UART_HOST_WAKEUP_TIME:
   1444 		return "UART: host wakeup time";
   1445 	case CSR_PSKEY_UART_HOST_WAKEUP_WAIT:
   1446 		return "UART: host wakeup wait";
   1447 	case CSR_PSKEY_BCSP_LM_MODE:
   1448 		return "BCSP link establishment mode";
   1449 	case CSR_PSKEY_BCSP_LM_SYNC_RETRIES:
   1450 		return "BCSP link establishment sync retries";
   1451 	case CSR_PSKEY_BCSP_LM_TSHY:
   1452 		return "BCSP link establishment Tshy";
   1453 	case CSR_PSKEY_UART_DFU_CONFIG_STOP_BITS:
   1454 		return "DFU mode UART: stop bits";
   1455 	case CSR_PSKEY_UART_DFU_CONFIG_PARITY_BIT:
   1456 		return "DFU mode UART: parity bit";
   1457 	case CSR_PSKEY_UART_DFU_CONFIG_FLOW_CTRL_EN:
   1458 		return "DFU mode UART: hardware flow control";
   1459 	case CSR_PSKEY_UART_DFU_CONFIG_RTS_AUTO_EN:
   1460 		return "DFU mode UART: RTS auto-enabled";
   1461 	case CSR_PSKEY_UART_DFU_CONFIG_RTS:
   1462 		return "DFU mode UART: RTS asserted";
   1463 	case CSR_PSKEY_UART_DFU_CONFIG_TX_ZERO_EN:
   1464 		return "DFU mode UART: TX zero enable";
   1465 	case CSR_PSKEY_UART_DFU_CONFIG_NON_BCSP_EN:
   1466 		return "DFU mode UART: enable BCSP-specific hardware";
   1467 	case CSR_PSKEY_UART_DFU_CONFIG_RX_RATE_DELAY:
   1468 		return "DFU mode UART: RX rate delay";
   1469 	case CSR_PSKEY_AMUX_AIO0:
   1470 		return "Multiplexer for AIO 0";
   1471 	case CSR_PSKEY_AMUX_AIO1:
   1472 		return "Multiplexer for AIO 1";
   1473 	case CSR_PSKEY_AMUX_AIO2:
   1474 		return "Multiplexer for AIO 2";
   1475 	case CSR_PSKEY_AMUX_AIO3:
   1476 		return "Multiplexer for AIO 3";
   1477 	case CSR_PSKEY_LOCAL_NAME_SIMPLIFIED:
   1478 		return "Local Name (simplified)";
   1479 	case CSR_PSKEY_EXTENDED_STUB:
   1480 		return "Extended stub";
   1481 	default:
   1482 		return "Unknown";
   1483 	}
   1484 }
   1485 
   1486 char *csr_pskeytoval(uint16_t pskey)
   1487 {
   1488 	switch (pskey) {
   1489 	case CSR_PSKEY_BDADDR:
   1490 		return "BDADDR";
   1491 	case CSR_PSKEY_COUNTRYCODE:
   1492 		return "COUNTRYCODE";
   1493 	case CSR_PSKEY_CLASSOFDEVICE:
   1494 		return "CLASSOFDEVICE";
   1495 	case CSR_PSKEY_DEVICE_DRIFT:
   1496 		return "DEVICE_DRIFT";
   1497 	case CSR_PSKEY_DEVICE_JITTER:
   1498 		return "DEVICE_JITTER";
   1499 	case CSR_PSKEY_MAX_ACLS:
   1500 		return "MAX_ACLS";
   1501 	case CSR_PSKEY_MAX_SCOS:
   1502 		return "MAX_SCOS";
   1503 	case CSR_PSKEY_MAX_REMOTE_MASTERS:
   1504 		return "MAX_REMOTE_MASTERS";
   1505 	case CSR_PSKEY_ENABLE_MASTERY_WITH_SLAVERY:
   1506 		return "ENABLE_MASTERY_WITH_SLAVERY";
   1507 	case CSR_PSKEY_H_HC_FC_MAX_ACL_PKT_LEN:
   1508 		return "H_HC_FC_MAX_ACL_PKT_LEN";
   1509 	case CSR_PSKEY_H_HC_FC_MAX_SCO_PKT_LEN:
   1510 		return "H_HC_FC_MAX_SCO_PKT_LEN";
   1511 	case CSR_PSKEY_H_HC_FC_MAX_ACL_PKTS:
   1512 		return "H_HC_FC_MAX_ACL_PKTS";
   1513 	case CSR_PSKEY_H_HC_FC_MAX_SCO_PKTS:
   1514 		return "H_HC_FC_MAX_SCO_PKTS";
   1515 	case CSR_PSKEY_LC_FC_BUFFER_LOW_WATER_MARK:
   1516 		return "LC_FC_BUFFER_LOW_WATER_MARK";
   1517 	case CSR_PSKEY_LC_MAX_TX_POWER:
   1518 		return "LC_MAX_TX_POWER";
   1519 	case CSR_PSKEY_TX_GAIN_RAMP:
   1520 		return "TX_GAIN_RAMP";
   1521 	case CSR_PSKEY_LC_POWER_TABLE:
   1522 		return "LC_POWER_TABLE";
   1523 	case CSR_PSKEY_LC_PEER_POWER_PERIOD:
   1524 		return "LC_PEER_POWER_PERIOD";
   1525 	case CSR_PSKEY_LC_FC_POOLS_LOW_WATER_MARK:
   1526 		return "LC_FC_POOLS_LOW_WATER_MARK";
   1527 	case CSR_PSKEY_LC_DEFAULT_TX_POWER:
   1528 		return "LC_DEFAULT_TX_POWER";
   1529 	case CSR_PSKEY_LC_RSSI_GOLDEN_RANGE:
   1530 		return "LC_RSSI_GOLDEN_RANGE";
   1531 	case CSR_PSKEY_LC_COMBO_DISABLE_PIO_MASK:
   1532 		return "LC_COMBO_DISABLE_PIO_MASK";
   1533 	case CSR_PSKEY_LC_COMBO_PRIORITY_PIO_MASK:
   1534 		return "LC_COMBO_PRIORITY_PIO_MASK";
   1535 	case CSR_PSKEY_LC_COMBO_DOT11_CHANNEL_PIO_BASE:
   1536 		return "LC_COMBO_DOT11_CHANNEL_PIO_BASE";
   1537 	case CSR_PSKEY_LC_COMBO_DOT11_BLOCK_CHANNELS:
   1538 		return "LC_COMBO_DOT11_BLOCK_CHANNELS";
   1539 	case CSR_PSKEY_LC_MAX_TX_POWER_NO_RSSI:
   1540 		return "LC_MAX_TX_POWER_NO_RSSI";
   1541 	case CSR_PSKEY_LC_CONNECTION_RX_WINDOW:
   1542 		return "LC_CONNECTION_RX_WINDOW";
   1543 	case CSR_PSKEY_LC_COMBO_DOT11_TX_PROTECTION_MODE:
   1544 		return "LC_COMBO_DOT11_TX_PROTECTION_MODE";
   1545 	case CSR_PSKEY_LC_ENHANCED_POWER_TABLE:
   1546 		return "LC_ENHANCED_POWER_TABLE";
   1547 	case CSR_PSKEY_LC_WIDEBAND_RSSI_CONFIG:
   1548 		return "LC_WIDEBAND_RSSI_CONFIG";
   1549 	case CSR_PSKEY_LC_COMBO_DOT11_PRIORITY_LEAD:
   1550 		return "LC_COMBO_DOT11_PRIORITY_LEAD";
   1551 	case CSR_PSKEY_BT_CLOCK_INIT:
   1552 		return "BT_CLOCK_INIT";
   1553 	case CSR_PSKEY_TX_MR_MOD_DELAY:
   1554 		return "TX_MR_MOD_DELAY";
   1555 	case CSR_PSKEY_RX_MR_SYNC_TIMING:
   1556 		return "RX_MR_SYNC_TIMING";
   1557 	case CSR_PSKEY_RX_MR_SYNC_CONFIG:
   1558 		return "RX_MR_SYNC_CONFIG";
   1559 	case CSR_PSKEY_LC_LOST_SYNC_SLOTS:
   1560 		return "LC_LOST_SYNC_SLOTS";
   1561 	case CSR_PSKEY_RX_MR_SAMP_CONFIG:
   1562 		return "RX_MR_SAMP_CONFIG";
   1563 	case CSR_PSKEY_AGC_HYST_LEVELS:
   1564 		return "AGC_HYST_LEVELS";
   1565 	case CSR_PSKEY_RX_LEVEL_LOW_SIGNAL:
   1566 		return "RX_LEVEL_LOW_SIGNAL";
   1567 	case CSR_PSKEY_AGC_IQ_LVL_VALUES:
   1568 		return "AGC_IQ_LVL_VALUES";
   1569 	case CSR_PSKEY_MR_FTRIM_OFFSET_12DB:
   1570 		return "MR_FTRIM_OFFSET_12DB";
   1571 	case CSR_PSKEY_MR_FTRIM_OFFSET_6DB:
   1572 		return "MR_FTRIM_OFFSET_6DB";
   1573 	case CSR_PSKEY_NO_CAL_ON_BOOT:
   1574 		return "NO_CAL_ON_BOOT";
   1575 	case CSR_PSKEY_RSSI_HI_TARGET:
   1576 		return "RSSI_HI_TARGET";
   1577 	case CSR_PSKEY_PREFERRED_MIN_ATTENUATION:
   1578 		return "PREFERRED_MIN_ATTENUATION";
   1579 	case CSR_PSKEY_LC_COMBO_DOT11_PRIORITY_OVERRIDE:
   1580 		return "LC_COMBO_DOT11_PRIORITY_OVERRIDE";
   1581 	case CSR_PSKEY_LC_MULTISLOT_HOLDOFF:
   1582 		return "LC_MULTISLOT_HOLDOFF";
   1583 	case CSR_PSKEY_FREE_KEY_PIGEON_HOLE:
   1584 		return "FREE_KEY_PIGEON_HOLE";
   1585 	case CSR_PSKEY_LINK_KEY_BD_ADDR0:
   1586 		return "LINK_KEY_BD_ADDR0";
   1587 	case CSR_PSKEY_LINK_KEY_BD_ADDR1:
   1588 		return "LINK_KEY_BD_ADDR1";
   1589 	case CSR_PSKEY_LINK_KEY_BD_ADDR2:
   1590 		return "LINK_KEY_BD_ADDR2";
   1591 	case CSR_PSKEY_LINK_KEY_BD_ADDR3:
   1592 		return "LINK_KEY_BD_ADDR3";
   1593 	case CSR_PSKEY_LINK_KEY_BD_ADDR4:
   1594 		return "LINK_KEY_BD_ADDR4";
   1595 	case CSR_PSKEY_LINK_KEY_BD_ADDR5:
   1596 		return "LINK_KEY_BD_ADDR5";
   1597 	case CSR_PSKEY_LINK_KEY_BD_ADDR6:
   1598 		return "LINK_KEY_BD_ADDR6";
   1599 	case CSR_PSKEY_LINK_KEY_BD_ADDR7:
   1600 		return "LINK_KEY_BD_ADDR7";
   1601 	case CSR_PSKEY_LINK_KEY_BD_ADDR8:
   1602 		return "LINK_KEY_BD_ADDR8";
   1603 	case CSR_PSKEY_LINK_KEY_BD_ADDR9:
   1604 		return "LINK_KEY_BD_ADDR9";
   1605 	case CSR_PSKEY_LINK_KEY_BD_ADDR10:
   1606 		return "LINK_KEY_BD_ADDR10";
   1607 	case CSR_PSKEY_LINK_KEY_BD_ADDR11:
   1608 		return "LINK_KEY_BD_ADDR11";
   1609 	case CSR_PSKEY_LINK_KEY_BD_ADDR12:
   1610 		return "LINK_KEY_BD_ADDR12";
   1611 	case CSR_PSKEY_LINK_KEY_BD_ADDR13:
   1612 		return "LINK_KEY_BD_ADDR13";
   1613 	case CSR_PSKEY_LINK_KEY_BD_ADDR14:
   1614 		return "LINK_KEY_BD_ADDR14";
   1615 	case CSR_PSKEY_LINK_KEY_BD_ADDR15:
   1616 		return "LINK_KEY_BD_ADDR15";
   1617 	case CSR_PSKEY_ENC_KEY_LMIN:
   1618 		return "ENC_KEY_LMIN";
   1619 	case CSR_PSKEY_ENC_KEY_LMAX:
   1620 		return "ENC_KEY_LMAX";
   1621 	case CSR_PSKEY_LOCAL_SUPPORTED_FEATURES:
   1622 		return "LOCAL_SUPPORTED_FEATURES";
   1623 	case CSR_PSKEY_LM_USE_UNIT_KEY:
   1624 		return "LM_USE_UNIT_KEY";
   1625 	case CSR_PSKEY_HCI_NOP_DISABLE:
   1626 		return "HCI_NOP_DISABLE";
   1627 	case CSR_PSKEY_LM_MAX_EVENT_FILTERS:
   1628 		return "LM_MAX_EVENT_FILTERS";
   1629 	case CSR_PSKEY_LM_USE_ENC_MODE_BROADCAST:
   1630 		return "LM_USE_ENC_MODE_BROADCAST";
   1631 	case CSR_PSKEY_LM_TEST_SEND_ACCEPTED_TWICE:
   1632 		return "LM_TEST_SEND_ACCEPTED_TWICE";
   1633 	case CSR_PSKEY_LM_MAX_PAGE_HOLD_TIME:
   1634 		return "LM_MAX_PAGE_HOLD_TIME";
   1635 	case CSR_PSKEY_AFH_ADAPTATION_RESPONSE_TIME:
   1636 		return "AFH_ADAPTATION_RESPONSE_TIME";
   1637 	case CSR_PSKEY_AFH_OPTIONS:
   1638 		return "AFH_OPTIONS";
   1639 	case CSR_PSKEY_AFH_RSSI_RUN_PERIOD:
   1640 		return "AFH_RSSI_RUN_PERIOD";
   1641 	case CSR_PSKEY_AFH_REENABLE_CHANNEL_TIME:
   1642 		return "AFH_REENABLE_CHANNEL_TIME";
   1643 	case CSR_PSKEY_NO_DROP_ON_ACR_MS_FAIL:
   1644 		return "NO_DROP_ON_ACR_MS_FAIL";
   1645 	case CSR_PSKEY_MAX_PRIVATE_KEYS:
   1646 		return "MAX_PRIVATE_KEYS";
   1647 	case CSR_PSKEY_PRIVATE_LINK_KEY_BD_ADDR0:
   1648 		return "PRIVATE_LINK_KEY_BD_ADDR0";
   1649 	case CSR_PSKEY_PRIVATE_LINK_KEY_BD_ADDR1:
   1650 		return "PRIVATE_LINK_KEY_BD_ADDR1";
   1651 	case CSR_PSKEY_PRIVATE_LINK_KEY_BD_ADDR2:
   1652 		return "PRIVATE_LINK_KEY_BD_ADDR2";
   1653 	case CSR_PSKEY_PRIVATE_LINK_KEY_BD_ADDR3:
   1654 		return "PRIVATE_LINK_KEY_BD_ADDR3";
   1655 	case CSR_PSKEY_PRIVATE_LINK_KEY_BD_ADDR4:
   1656 		return "PRIVATE_LINK_KEY_BD_ADDR4";
   1657 	case CSR_PSKEY_PRIVATE_LINK_KEY_BD_ADDR5:
   1658 		return "PRIVATE_LINK_KEY_BD_ADDR5";
   1659 	case CSR_PSKEY_PRIVATE_LINK_KEY_BD_ADDR6:
   1660 		return "PRIVATE_LINK_KEY_BD_ADDR6";
   1661 	case CSR_PSKEY_PRIVATE_LINK_KEY_BD_ADDR7:
   1662 		return "PRIVATE_LINK_KEY_BD_ADDR7";
   1663 	case CSR_PSKEY_LOCAL_SUPPORTED_COMMANDS:
   1664 		return "LOCAL_SUPPORTED_COMMANDS";
   1665 	case CSR_PSKEY_LM_MAX_ABSENCE_INDEX:
   1666 		return "LM_MAX_ABSENCE_INDEX";
   1667 	case CSR_PSKEY_DEVICE_NAME:
   1668 		return "DEVICE_NAME";
   1669 	case CSR_PSKEY_AFH_RSSI_THRESHOLD:
   1670 		return "AFH_RSSI_THRESHOLD";
   1671 	case CSR_PSKEY_LM_CASUAL_SCAN_INTERVAL:
   1672 		return "LM_CASUAL_SCAN_INTERVAL";
   1673 	case CSR_PSKEY_AFH_MIN_MAP_CHANGE:
   1674 		return "AFH_MIN_MAP_CHANGE";
   1675 	case CSR_PSKEY_AFH_RSSI_LP_RUN_PERIOD:
   1676 		return "AFH_RSSI_LP_RUN_PERIOD";
   1677 	case CSR_PSKEY_HCI_LMP_LOCAL_VERSION:
   1678 		return "HCI_LMP_LOCAL_VERSION";
   1679 	case CSR_PSKEY_LMP_REMOTE_VERSION:
   1680 		return "LMP_REMOTE_VERSION";
   1681 	case CSR_PSKEY_HOLD_ERROR_MESSAGE_NUMBER:
   1682 		return "HOLD_ERROR_MESSAGE_NUMBER";
   1683 	case CSR_PSKEY_DFU_ATTRIBUTES:
   1684 		return "DFU_ATTRIBUTES";
   1685 	case CSR_PSKEY_DFU_DETACH_TO:
   1686 		return "DFU_DETACH_TO";
   1687 	case CSR_PSKEY_DFU_TRANSFER_SIZE:
   1688 		return "DFU_TRANSFER_SIZE";
   1689 	case CSR_PSKEY_DFU_ENABLE:
   1690 		return "DFU_ENABLE";
   1691 	case CSR_PSKEY_DFU_LIN_REG_ENABLE:
   1692 		return "DFU_LIN_REG_ENABLE";
   1693 	case CSR_PSKEY_DFUENC_VMAPP_PK_MODULUS_MSB:
   1694 		return "DFUENC_VMAPP_PK_MODULUS_MSB";
   1695 	case CSR_PSKEY_DFUENC_VMAPP_PK_MODULUS_LSB:
   1696 		return "DFUENC_VMAPP_PK_MODULUS_LSB";
   1697 	case CSR_PSKEY_DFUENC_VMAPP_PK_M_DASH:
   1698 		return "DFUENC_VMAPP_PK_M_DASH";
   1699 	case CSR_PSKEY_DFUENC_VMAPP_PK_R2N_MSB:
   1700 		return "DFUENC_VMAPP_PK_R2N_MSB";
   1701 	case CSR_PSKEY_DFUENC_VMAPP_PK_R2N_LSB:
   1702 		return "DFUENC_VMAPP_PK_R2N_LSB";
   1703 	case CSR_PSKEY_BCSP_LM_PS_BLOCK:
   1704 		return "BCSP_LM_PS_BLOCK";
   1705 	case CSR_PSKEY_HOSTIO_FC_PS_BLOCK:
   1706 		return "HOSTIO_FC_PS_BLOCK";
   1707 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO0:
   1708 		return "HOSTIO_PROTOCOL_INFO0";
   1709 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO1:
   1710 		return "HOSTIO_PROTOCOL_INFO1";
   1711 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO2:
   1712 		return "HOSTIO_PROTOCOL_INFO2";
   1713 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO3:
   1714 		return "HOSTIO_PROTOCOL_INFO3";
   1715 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO4:
   1716 		return "HOSTIO_PROTOCOL_INFO4";
   1717 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO5:
   1718 		return "HOSTIO_PROTOCOL_INFO5";
   1719 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO6:
   1720 		return "HOSTIO_PROTOCOL_INFO6";
   1721 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO7:
   1722 		return "HOSTIO_PROTOCOL_INFO7";
   1723 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO8:
   1724 		return "HOSTIO_PROTOCOL_INFO8";
   1725 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO9:
   1726 		return "HOSTIO_PROTOCOL_INFO9";
   1727 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO10:
   1728 		return "HOSTIO_PROTOCOL_INFO10";
   1729 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO11:
   1730 		return "HOSTIO_PROTOCOL_INFO11";
   1731 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO12:
   1732 		return "HOSTIO_PROTOCOL_INFO12";
   1733 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO13:
   1734 		return "HOSTIO_PROTOCOL_INFO13";
   1735 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO14:
   1736 		return "HOSTIO_PROTOCOL_INFO14";
   1737 	case CSR_PSKEY_HOSTIO_PROTOCOL_INFO15:
   1738 		return "HOSTIO_PROTOCOL_INFO15";
   1739 	case CSR_PSKEY_HOSTIO_UART_RESET_TIMEOUT:
   1740 		return "HOSTIO_UART_RESET_TIMEOUT";
   1741 	case CSR_PSKEY_HOSTIO_USE_HCI_EXTN:
   1742 		return "HOSTIO_USE_HCI_EXTN";
   1743 	case CSR_PSKEY_HOSTIO_USE_HCI_EXTN_CCFC:
   1744 		return "HOSTIO_USE_HCI_EXTN_CCFC";
   1745 	case CSR_PSKEY_HOSTIO_HCI_EXTN_PAYLOAD_SIZE:
   1746 		return "HOSTIO_HCI_EXTN_PAYLOAD_SIZE";
   1747 	case CSR_PSKEY_BCSP_LM_CNF_CNT_LIMIT:
   1748 		return "BCSP_LM_CNF_CNT_LIMIT";
   1749 	case CSR_PSKEY_HOSTIO_MAP_SCO_PCM:
   1750 		return "HOSTIO_MAP_SCO_PCM";
   1751 	case CSR_PSKEY_HOSTIO_AWKWARD_PCM_SYNC:
   1752 		return "HOSTIO_AWKWARD_PCM_SYNC";
   1753 	case CSR_PSKEY_HOSTIO_BREAK_POLL_PERIOD:
   1754 		return "HOSTIO_BREAK_POLL_PERIOD";
   1755 	case CSR_PSKEY_HOSTIO_MIN_UART_HCI_SCO_SIZE:
   1756 		return "HOSTIO_MIN_UART_HCI_SCO_SIZE";
   1757 	case CSR_PSKEY_HOSTIO_MAP_SCO_CODEC:
   1758 		return "HOSTIO_MAP_SCO_CODEC";
   1759 	case CSR_PSKEY_PCM_CVSD_TX_HI_FREQ_BOOST:
   1760 		return "PCM_CVSD_TX_HI_FREQ_BOOST";
   1761 	case CSR_PSKEY_PCM_CVSD_RX_HI_FREQ_BOOST:
   1762 		return "PCM_CVSD_RX_HI_FREQ_BOOST";
   1763 	case CSR_PSKEY_PCM_CONFIG32:
   1764 		return "PCM_CONFIG32";
   1765 	case CSR_PSKEY_USE_OLD_BCSP_LE:
   1766 		return "USE_OLD_BCSP_LE";
   1767 	case CSR_PSKEY_PCM_CVSD_USE_NEW_FILTER:
   1768 		return "PCM_CVSD_USE_NEW_FILTER";
   1769 	case CSR_PSKEY_PCM_FORMAT:
   1770 		return "PCM_FORMAT";
   1771 	case CSR_PSKEY_CODEC_OUT_GAIN:
   1772 		return "CODEC_OUT_GAIN";
   1773 	case CSR_PSKEY_CODEC_IN_GAIN:
   1774 		return "CODEC_IN_GAIN";
   1775 	case CSR_PSKEY_CODEC_PIO:
   1776 		return "CODEC_PIO";
   1777 	case CSR_PSKEY_PCM_LOW_JITTER_CONFIG:
   1778 		return "PCM_LOW_JITTER_CONFIG";
   1779 	case CSR_PSKEY_HOSTIO_SCO_PCM_THRESHOLDS:
   1780 		return "HOSTIO_SCO_PCM_THRESHOLDS";
   1781 	case CSR_PSKEY_HOSTIO_SCO_HCI_THRESHOLDS:
   1782 		return "HOSTIO_SCO_HCI_THRESHOLDS";
   1783 	case CSR_PSKEY_HOSTIO_MAP_SCO_PCM_SLOT:
   1784 		return "HOSTIO_MAP_SCO_PCM_SLOT";
   1785 	case CSR_PSKEY_UART_BAUDRATE:
   1786 		return "UART_BAUDRATE";
   1787 	case CSR_PSKEY_UART_CONFIG_BCSP:
   1788 		return "UART_CONFIG_BCSP";
   1789 	case CSR_PSKEY_UART_CONFIG_H4:
   1790 		return "UART_CONFIG_H4";
   1791 	case CSR_PSKEY_UART_CONFIG_H5:
   1792 		return "UART_CONFIG_H5";
   1793 	case CSR_PSKEY_UART_CONFIG_USR:
   1794 		return "UART_CONFIG_USR";
   1795 	case CSR_PSKEY_UART_TX_CRCS:
   1796 		return "UART_TX_CRCS";
   1797 	case CSR_PSKEY_UART_ACK_TIMEOUT:
   1798 		return "UART_ACK_TIMEOUT";
   1799 	case CSR_PSKEY_UART_TX_MAX_ATTEMPTS:
   1800 		return "UART_TX_MAX_ATTEMPTS";
   1801 	case CSR_PSKEY_UART_TX_WINDOW_SIZE:
   1802 		return "UART_TX_WINDOW_SIZE";
   1803 	case CSR_PSKEY_UART_HOST_WAKE:
   1804 		return "UART_HOST_WAKE";
   1805 	case CSR_PSKEY_HOSTIO_THROTTLE_TIMEOUT:
   1806 		return "HOSTIO_THROTTLE_TIMEOUT";
   1807 	case CSR_PSKEY_PCM_ALWAYS_ENABLE:
   1808 		return "PCM_ALWAYS_ENABLE";
   1809 	case CSR_PSKEY_UART_HOST_WAKE_SIGNAL:
   1810 		return "UART_HOST_WAKE_SIGNAL";
   1811 	case CSR_PSKEY_UART_CONFIG_H4DS:
   1812 		return "UART_CONFIG_H4DS";
   1813 	case CSR_PSKEY_H4DS_WAKE_DURATION:
   1814 		return "H4DS_WAKE_DURATION";
   1815 	case CSR_PSKEY_H4DS_MAXWU:
   1816 		return "H4DS_MAXWU";
   1817 	case CSR_PSKEY_H4DS_LE_TIMER_PERIOD:
   1818 		return "H4DS_LE_TIMER_PERIOD";
   1819 	case CSR_PSKEY_H4DS_TWU_TIMER_PERIOD:
   1820 		return "H4DS_TWU_TIMER_PERIOD";
   1821 	case CSR_PSKEY_H4DS_UART_IDLE_TIMER_PERIOD:
   1822 		return "H4DS_UART_IDLE_TIMER_PERIOD";
   1823 	case CSR_PSKEY_ANA_FTRIM:
   1824 		return "ANA_FTRIM";
   1825 	case CSR_PSKEY_WD_TIMEOUT:
   1826 		return "WD_TIMEOUT";
   1827 	case CSR_PSKEY_WD_PERIOD:
   1828 		return "WD_PERIOD";
   1829 	case CSR_PSKEY_HOST_INTERFACE:
   1830 		return "HOST_INTERFACE";
   1831 	case CSR_PSKEY_HQ_HOST_TIMEOUT:
   1832 		return "HQ_HOST_TIMEOUT";
   1833 	case CSR_PSKEY_HQ_ACTIVE:
   1834 		return "HQ_ACTIVE";
   1835 	case CSR_PSKEY_BCCMD_SECURITY_ACTIVE:
   1836 		return "BCCMD_SECURITY_ACTIVE";
   1837 	case CSR_PSKEY_ANA_FREQ:
   1838 		return "ANA_FREQ";
   1839 	case CSR_PSKEY_PIO_PROTECT_MASK:
   1840 		return "PIO_PROTECT_MASK";
   1841 	case CSR_PSKEY_PMALLOC_SIZES:
   1842 		return "PMALLOC_SIZES";
   1843 	case CSR_PSKEY_UART_BAUD_RATE:
   1844 		return "UART_BAUD_RATE";
   1845 	case CSR_PSKEY_UART_CONFIG:
   1846 		return "UART_CONFIG";
   1847 	case CSR_PSKEY_STUB:
   1848 		return "STUB";
   1849 	case CSR_PSKEY_TXRX_PIO_CONTROL:
   1850 		return "TXRX_PIO_CONTROL";
   1851 	case CSR_PSKEY_ANA_RX_LEVEL:
   1852 		return "ANA_RX_LEVEL";
   1853 	case CSR_PSKEY_ANA_RX_FTRIM:
   1854 		return "ANA_RX_FTRIM";
   1855 	case CSR_PSKEY_PSBC_DATA_VERSION:
   1856 		return "PSBC_DATA_VERSION";
   1857 	case CSR_PSKEY_PCM0_ATTENUATION:
   1858 		return "PCM0_ATTENUATION";
   1859 	case CSR_PSKEY_LO_LVL_MAX:
   1860 		return "LO_LVL_MAX";
   1861 	case CSR_PSKEY_LO_ADC_AMPL_MIN:
   1862 		return "LO_ADC_AMPL_MIN";
   1863 	case CSR_PSKEY_LO_ADC_AMPL_MAX:
   1864 		return "LO_ADC_AMPL_MAX";
   1865 	case CSR_PSKEY_IQ_TRIM_CHANNEL:
   1866 		return "IQ_TRIM_CHANNEL";
   1867 	case CSR_PSKEY_IQ_TRIM_GAIN:
   1868 		return "IQ_TRIM_GAIN";
   1869 	case CSR_PSKEY_IQ_TRIM_ENABLE:
   1870 		return "IQ_TRIM_ENABLE";
   1871 	case CSR_PSKEY_TX_OFFSET_HALF_MHZ:
   1872 		return "TX_OFFSET_HALF_MHZ";
   1873 	case CSR_PSKEY_GBL_MISC_ENABLES:
   1874 		return "GBL_MISC_ENABLES";
   1875 	case CSR_PSKEY_UART_SLEEP_TIMEOUT:
   1876 		return "UART_SLEEP_TIMEOUT";
   1877 	case CSR_PSKEY_DEEP_SLEEP_STATE:
   1878 		return "DEEP_SLEEP_STATE";
   1879 	case CSR_PSKEY_IQ_ENABLE_PHASE_TRIM:
   1880 		return "IQ_ENABLE_PHASE_TRIM";
   1881 	case CSR_PSKEY_HCI_HANDLE_FREEZE_PERIOD:
   1882 		return "HCI_HANDLE_FREEZE_PERIOD";
   1883 	case CSR_PSKEY_MAX_FROZEN_HCI_HANDLES:
   1884 		return "MAX_FROZEN_HCI_HANDLES";
   1885 	case CSR_PSKEY_PAGETABLE_DESTRUCTION_DELAY:
   1886 		return "PAGETABLE_DESTRUCTION_DELAY";
   1887 	case CSR_PSKEY_IQ_TRIM_PIO_SETTINGS:
   1888 		return "IQ_TRIM_PIO_SETTINGS";
   1889 	case CSR_PSKEY_USE_EXTERNAL_CLOCK:
   1890 		return "USE_EXTERNAL_CLOCK";
   1891 	case CSR_PSKEY_DEEP_SLEEP_WAKE_CTS:
   1892 		return "DEEP_SLEEP_WAKE_CTS";
   1893 	case CSR_PSKEY_FC_HC2H_FLUSH_DELAY:
   1894 		return "FC_HC2H_FLUSH_DELAY";
   1895 	case CSR_PSKEY_RX_HIGHSIDE:
   1896 		return "RX_HIGHSIDE";
   1897 	case CSR_PSKEY_TX_PRE_LVL:
   1898 		return "TX_PRE_LVL";
   1899 	case CSR_PSKEY_RX_SINGLE_ENDED:
   1900 		return "RX_SINGLE_ENDED";
   1901 	case CSR_PSKEY_TX_FILTER_CONFIG:
   1902 		return "TX_FILTER_CONFIG";
   1903 	case CSR_PSKEY_CLOCK_REQUEST_ENABLE:
   1904 		return "CLOCK_REQUEST_ENABLE";
   1905 	case CSR_PSKEY_RX_MIN_ATTEN:
   1906 		return "RX_MIN_ATTEN";
   1907 	case CSR_PSKEY_XTAL_TARGET_AMPLITUDE:
   1908 		return "XTAL_TARGET_AMPLITUDE";
   1909 	case CSR_PSKEY_PCM_MIN_CPU_CLOCK:
   1910 		return "PCM_MIN_CPU_CLOCK";
   1911 	case CSR_PSKEY_HOST_INTERFACE_PIO_USB:
   1912 		return "HOST_INTERFACE_PIO_USB";
   1913 	case CSR_PSKEY_CPU_IDLE_MODE:
   1914 		return "CPU_IDLE_MODE";
   1915 	case CSR_PSKEY_DEEP_SLEEP_CLEAR_RTS:
   1916 		return "DEEP_SLEEP_CLEAR_RTS";
   1917 	case CSR_PSKEY_RF_RESONANCE_TRIM:
   1918 		return "RF_RESONANCE_TRIM";
   1919 	case CSR_PSKEY_DEEP_SLEEP_PIO_WAKE:
   1920 		return "DEEP_SLEEP_PIO_WAKE";
   1921 	case CSR_PSKEY_DRAIN_BORE_TIMERS:
   1922 		return "DRAIN_BORE_TIMERS";
   1923 	case CSR_PSKEY_DRAIN_TX_POWER_BASE:
   1924 		return "DRAIN_TX_POWER_BASE";
   1925 	case CSR_PSKEY_MODULE_ID:
   1926 		return "MODULE_ID";
   1927 	case CSR_PSKEY_MODULE_DESIGN:
   1928 		return "MODULE_DESIGN";
   1929 	case CSR_PSKEY_MODULE_SECURITY_CODE:
   1930 		return "MODULE_SECURITY_CODE";
   1931 	case CSR_PSKEY_VM_DISABLE:
   1932 		return "VM_DISABLE";
   1933 	case CSR_PSKEY_MOD_MANUF0:
   1934 		return "MOD_MANUF0";
   1935 	case CSR_PSKEY_MOD_MANUF1:
   1936 		return "MOD_MANUF1";
   1937 	case CSR_PSKEY_MOD_MANUF2:
   1938 		return "MOD_MANUF2";
   1939 	case CSR_PSKEY_MOD_MANUF3:
   1940 		return "MOD_MANUF3";
   1941 	case CSR_PSKEY_MOD_MANUF4:
   1942 		return "MOD_MANUF4";
   1943 	case CSR_PSKEY_MOD_MANUF5:
   1944 		return "MOD_MANUF5";
   1945 	case CSR_PSKEY_MOD_MANUF6:
   1946 		return "MOD_MANUF6";
   1947 	case CSR_PSKEY_MOD_MANUF7:
   1948 		return "MOD_MANUF7";
   1949 	case CSR_PSKEY_MOD_MANUF8:
   1950 		return "MOD_MANUF8";
   1951 	case CSR_PSKEY_MOD_MANUF9:
   1952 		return "MOD_MANUF9";
   1953 	case CSR_PSKEY_DUT_VM_DISABLE:
   1954 		return "DUT_VM_DISABLE";
   1955 	case CSR_PSKEY_USR0:
   1956 		return "USR0";
   1957 	case CSR_PSKEY_USR1:
   1958 		return "USR1";
   1959 	case CSR_PSKEY_USR2:
   1960 		return "USR2";
   1961 	case CSR_PSKEY_USR3:
   1962 		return "USR3";
   1963 	case CSR_PSKEY_USR4:
   1964 		return "USR4";
   1965 	case CSR_PSKEY_USR5:
   1966 		return "USR5";
   1967 	case CSR_PSKEY_USR6:
   1968 		return "USR6";
   1969 	case CSR_PSKEY_USR7:
   1970 		return "USR7";
   1971 	case CSR_PSKEY_USR8:
   1972 		return "USR8";
   1973 	case CSR_PSKEY_USR9:
   1974 		return "USR9";
   1975 	case CSR_PSKEY_USR10:
   1976 		return "USR10";
   1977 	case CSR_PSKEY_USR11:
   1978 		return "USR11";
   1979 	case CSR_PSKEY_USR12:
   1980 		return "USR12";
   1981 	case CSR_PSKEY_USR13:
   1982 		return "USR13";
   1983 	case CSR_PSKEY_USR14:
   1984 		return "USR14";
   1985 	case CSR_PSKEY_USR15:
   1986 		return "USR15";
   1987 	case CSR_PSKEY_USR16:
   1988 		return "USR16";
   1989 	case CSR_PSKEY_USR17:
   1990 		return "USR17";
   1991 	case CSR_PSKEY_USR18:
   1992 		return "USR18";
   1993 	case CSR_PSKEY_USR19:
   1994 		return "USR19";
   1995 	case CSR_PSKEY_USR20:
   1996 		return "USR20";
   1997 	case CSR_PSKEY_USR21:
   1998 		return "USR21";
   1999 	case CSR_PSKEY_USR22:
   2000 		return "USR22";
   2001 	case CSR_PSKEY_USR23:
   2002 		return "USR23";
   2003 	case CSR_PSKEY_USR24:
   2004 		return "USR24";
   2005 	case CSR_PSKEY_USR25:
   2006 		return "USR25";
   2007 	case CSR_PSKEY_USR26:
   2008 		return "USR26";
   2009 	case CSR_PSKEY_USR27:
   2010 		return "USR27";
   2011 	case CSR_PSKEY_USR28:
   2012 		return "USR28";
   2013 	case CSR_PSKEY_USR29:
   2014 		return "USR29";
   2015 	case CSR_PSKEY_USR30:
   2016 		return "USR30";
   2017 	case CSR_PSKEY_USR31:
   2018 		return "USR31";
   2019 	case CSR_PSKEY_USR32:
   2020 		return "USR32";
   2021 	case CSR_PSKEY_USR33:
   2022 		return "USR33";
   2023 	case CSR_PSKEY_USR34:
   2024 		return "USR34";
   2025 	case CSR_PSKEY_USR35:
   2026 		return "USR35";
   2027 	case CSR_PSKEY_USR36:
   2028 		return "USR36";
   2029 	case CSR_PSKEY_USR37:
   2030 		return "USR37";
   2031 	case CSR_PSKEY_USR38:
   2032 		return "USR38";
   2033 	case CSR_PSKEY_USR39:
   2034 		return "USR39";
   2035 	case CSR_PSKEY_USR40:
   2036 		return "USR40";
   2037 	case CSR_PSKEY_USR41:
   2038 		return "USR41";
   2039 	case CSR_PSKEY_USR42:
   2040 		return "USR42";
   2041 	case CSR_PSKEY_USR43:
   2042 		return "USR43";
   2043 	case CSR_PSKEY_USR44:
   2044 		return "USR44";
   2045 	case CSR_PSKEY_USR45:
   2046 		return "USR45";
   2047 	case CSR_PSKEY_USR46:
   2048 		return "USR46";
   2049 	case CSR_PSKEY_USR47:
   2050 		return "USR47";
   2051 	case CSR_PSKEY_USR48:
   2052 		return "USR48";
   2053 	case CSR_PSKEY_USR49:
   2054 		return "USR49";
   2055 	case CSR_PSKEY_USB_VERSION:
   2056 		return "USB_VERSION";
   2057 	case CSR_PSKEY_USB_DEVICE_CLASS_CODES:
   2058 		return "USB_DEVICE_CLASS_CODES";
   2059 	case CSR_PSKEY_USB_VENDOR_ID:
   2060 		return "USB_VENDOR_ID";
   2061 	case CSR_PSKEY_USB_PRODUCT_ID:
   2062 		return "USB_PRODUCT_ID";
   2063 	case CSR_PSKEY_USB_MANUF_STRING:
   2064 		return "USB_MANUF_STRING";
   2065 	case CSR_PSKEY_USB_PRODUCT_STRING:
   2066 		return "USB_PRODUCT_STRING";
   2067 	case CSR_PSKEY_USB_SERIAL_NUMBER_STRING:
   2068 		return "USB_SERIAL_NUMBER_STRING";
   2069 	case CSR_PSKEY_USB_CONFIG_STRING:
   2070 		return "USB_CONFIG_STRING";
   2071 	case CSR_PSKEY_USB_ATTRIBUTES:
   2072 		return "USB_ATTRIBUTES";
   2073 	case CSR_PSKEY_USB_MAX_POWER:
   2074 		return "USB_MAX_POWER";
   2075 	case CSR_PSKEY_USB_BT_IF_CLASS_CODES:
   2076 		return "USB_BT_IF_CLASS_CODES";
   2077 	case CSR_PSKEY_USB_LANGID:
   2078 		return "USB_LANGID";
   2079 	case CSR_PSKEY_USB_DFU_CLASS_CODES:
   2080 		return "USB_DFU_CLASS_CODES";
   2081 	case CSR_PSKEY_USB_DFU_PRODUCT_ID:
   2082 		return "USB_DFU_PRODUCT_ID";
   2083 	case CSR_PSKEY_USB_PIO_DETACH:
   2084 		return "USB_PIO_DETACH";
   2085 	case CSR_PSKEY_USB_PIO_WAKEUP:
   2086 		return "USB_PIO_WAKEUP";
   2087 	case CSR_PSKEY_USB_PIO_PULLUP:
   2088 		return "USB_PIO_PULLUP";
   2089 	case CSR_PSKEY_USB_PIO_VBUS:
   2090 		return "USB_PIO_VBUS";
   2091 	case CSR_PSKEY_USB_PIO_WAKE_TIMEOUT:
   2092 		return "USB_PIO_WAKE_TIMEOUT";
   2093 	case CSR_PSKEY_USB_PIO_RESUME:
   2094 		return "USB_PIO_RESUME";
   2095 	case CSR_PSKEY_USB_BT_SCO_IF_CLASS_CODES:
   2096 		return "USB_BT_SCO_IF_CLASS_CODES";
   2097 	case CSR_PSKEY_USB_SUSPEND_PIO_LEVEL:
   2098 		return "USB_SUSPEND_PIO_LEVEL";
   2099 	case CSR_PSKEY_USB_SUSPEND_PIO_DIR:
   2100 		return "USB_SUSPEND_PIO_DIR";
   2101 	case CSR_PSKEY_USB_SUSPEND_PIO_MASK:
   2102 		return "USB_SUSPEND_PIO_MASK";
   2103 	case CSR_PSKEY_USB_ENDPOINT_0_MAX_PACKET_SIZE:
   2104 		return "USB_ENDPOINT_0_MAX_PACKET_SIZE";
   2105 	case CSR_PSKEY_USB_CONFIG:
   2106 		return "USB_CONFIG";
   2107 	case CSR_PSKEY_RADIOTEST_ATTEN_INIT:
   2108 		return "RADIOTEST_ATTEN_INIT";
   2109 	case CSR_PSKEY_RADIOTEST_FIRST_TRIM_TIME:
   2110 		return "RADIOTEST_FIRST_TRIM_TIME";
   2111 	case CSR_PSKEY_RADIOTEST_SUBSEQUENT_TRIM_TIME:
   2112 		return "RADIOTEST_SUBSEQUENT_TRIM_TIME";
   2113 	case CSR_PSKEY_RADIOTEST_LO_LVL_TRIM_ENABLE:
   2114 		return "RADIOTEST_LO_LVL_TRIM_ENABLE";
   2115 	case CSR_PSKEY_RADIOTEST_DISABLE_MODULATION:
   2116 		return "RADIOTEST_DISABLE_MODULATION";
   2117 	case CSR_PSKEY_RFCOMM_FCON_THRESHOLD:
   2118 		return "RFCOMM_FCON_THRESHOLD";
   2119 	case CSR_PSKEY_RFCOMM_FCOFF_THRESHOLD:
   2120 		return "RFCOMM_FCOFF_THRESHOLD";
   2121 	case CSR_PSKEY_IPV6_STATIC_ADDR:
   2122 		return "IPV6_STATIC_ADDR";
   2123 	case CSR_PSKEY_IPV4_STATIC_ADDR:
   2124 		return "IPV4_STATIC_ADDR";
   2125 	case CSR_PSKEY_IPV6_STATIC_PREFIX_LEN:
   2126 		return "IPV6_STATIC_PREFIX_LEN";
   2127 	case CSR_PSKEY_IPV6_STATIC_ROUTER_ADDR:
   2128 		return "IPV6_STATIC_ROUTER_ADDR";
   2129 	case CSR_PSKEY_IPV4_STATIC_SUBNET_MASK:
   2130 		return "IPV4_STATIC_SUBNET_MASK";
   2131 	case CSR_PSKEY_IPV4_STATIC_ROUTER_ADDR:
   2132 		return "IPV4_STATIC_ROUTER_ADDR";
   2133 	case CSR_PSKEY_MDNS_NAME:
   2134 		return "MDNS_NAME";
   2135 	case CSR_PSKEY_FIXED_PIN:
   2136 		return "FIXED_PIN";
   2137 	case CSR_PSKEY_MDNS_PORT:
   2138 		return "MDNS_PORT";
   2139 	case CSR_PSKEY_MDNS_TTL:
   2140 		return "MDNS_TTL";
   2141 	case CSR_PSKEY_MDNS_IPV4_ADDR:
   2142 		return "MDNS_IPV4_ADDR";
   2143 	case CSR_PSKEY_ARP_CACHE_TIMEOUT:
   2144 		return "ARP_CACHE_TIMEOUT";
   2145 	case CSR_PSKEY_HFP_POWER_TABLE:
   2146 		return "HFP_POWER_TABLE";
   2147 	case CSR_PSKEY_DRAIN_BORE_TIMER_COUNTERS:
   2148 		return "DRAIN_BORE_TIMER_COUNTERS";
   2149 	case CSR_PSKEY_DRAIN_BORE_COUNTERS:
   2150 		return "DRAIN_BORE_COUNTERS";
   2151 	case CSR_PSKEY_LOOP_FILTER_TRIM:
   2152 		return "LOOP_FILTER_TRIM";
   2153 	case CSR_PSKEY_DRAIN_BORE_CURRENT_PEAK:
   2154 		return "DRAIN_BORE_CURRENT_PEAK";
   2155 	case CSR_PSKEY_VM_E2_CACHE_LIMIT:
   2156 		return "VM_E2_CACHE_LIMIT";
   2157 	case CSR_PSKEY_FORCE_16MHZ_REF_PIO:
   2158 		return "FORCE_16MHZ_REF_PIO";
   2159 	case CSR_PSKEY_CDMA_LO_REF_LIMITS:
   2160 		return "CDMA_LO_REF_LIMITS";
   2161 	case CSR_PSKEY_CDMA_LO_ERROR_LIMITS:
   2162 		return "CDMA_LO_ERROR_LIMITS";
   2163 	case CSR_PSKEY_CLOCK_STARTUP_DELAY:
   2164 		return "CLOCK_STARTUP_DELAY";
   2165 	case CSR_PSKEY_DEEP_SLEEP_CORRECTION_FACTOR:
   2166 		return "DEEP_SLEEP_CORRECTION_FACTOR";
   2167 	case CSR_PSKEY_TEMPERATURE_CALIBRATION:
   2168 		return "TEMPERATURE_CALIBRATION";
   2169 	case CSR_PSKEY_TEMPERATURE_VS_DELTA_INTERNAL_PA:
   2170 		return "TEMPERATURE_VS_DELTA_INTERNAL_PA";
   2171 	case CSR_PSKEY_TEMPERATURE_VS_DELTA_TX_PRE_LVL:
   2172 		return "TEMPERATURE_VS_DELTA_TX_PRE_LVL";
   2173 	case CSR_PSKEY_TEMPERATURE_VS_DELTA_TX_BB:
   2174 		return "TEMPERATURE_VS_DELTA_TX_BB";
   2175 	case CSR_PSKEY_TEMPERATURE_VS_DELTA_ANA_FTRIM:
   2176 		return "TEMPERATURE_VS_DELTA_ANA_FTRIM";
   2177 	case CSR_PSKEY_TEST_DELTA_OFFSET:
   2178 		return "TEST_DELTA_OFFSET";
   2179 	case CSR_PSKEY_RX_DYNAMIC_LVL_OFFSET:
   2180 		return "RX_DYNAMIC_LVL_OFFSET";
   2181 	case CSR_PSKEY_TEST_FORCE_OFFSET:
   2182 		return "TEST_FORCE_OFFSET";
   2183 	case CSR_PSKEY_RF_TRAP_BAD_DIVISION_RATIOS:
   2184 		return "RF_TRAP_BAD_DIVISION_RATIOS";
   2185 	case CSR_PSKEY_RADIOTEST_CDMA_LO_REF_LIMITS:
   2186 		return "RADIOTEST_CDMA_LO_REF_LIMITS";
   2187 	case CSR_PSKEY_INITIAL_BOOTMODE:
   2188 		return "INITIAL_BOOTMODE";
   2189 	case CSR_PSKEY_ONCHIP_HCI_CLIENT:
   2190 		return "ONCHIP_HCI_CLIENT";
   2191 	case CSR_PSKEY_RX_ATTEN_BACKOFF:
   2192 		return "RX_ATTEN_BACKOFF";
   2193 	case CSR_PSKEY_RX_ATTEN_UPDATE_RATE:
   2194 		return "RX_ATTEN_UPDATE_RATE";
   2195 	case CSR_PSKEY_SYNTH_TXRX_THRESHOLDS:
   2196 		return "SYNTH_TXRX_THRESHOLDS";
   2197 	case CSR_PSKEY_MIN_WAIT_STATES:
   2198 		return "MIN_WAIT_STATES";
   2199 	case CSR_PSKEY_RSSI_CORRECTION:
   2200 		return "RSSI_CORRECTION";
   2201 	case CSR_PSKEY_SCHED_THROTTLE_TIMEOUT:
   2202 		return "SCHED_THROTTLE_TIMEOUT";
   2203 	case CSR_PSKEY_DEEP_SLEEP_USE_EXTERNAL_CLOCK:
   2204 		return "DEEP_SLEEP_USE_EXTERNAL_CLOCK";
   2205 	case CSR_PSKEY_TRIM_RADIO_FILTERS:
   2206 		return "TRIM_RADIO_FILTERS";
   2207 	case CSR_PSKEY_TRANSMIT_OFFSET:
   2208 		return "TRANSMIT_OFFSET";
   2209 	case CSR_PSKEY_USB_VM_CONTROL:
   2210 		return "USB_VM_CONTROL";
   2211 	case CSR_PSKEY_MR_ANA_RX_FTRIM:
   2212 		return "MR_ANA_RX_FTRIM";
   2213 	case CSR_PSKEY_I2C_CONFIG:
   2214 		return "I2C_CONFIG";
   2215 	case CSR_PSKEY_IQ_LVL_RX:
   2216 		return "IQ_LVL_RX";
   2217 	case CSR_PSKEY_MR_TX_FILTER_CONFIG:
   2218 		return "MR_TX_FILTER_CONFIG";
   2219 	case CSR_PSKEY_MR_TX_CONFIG2:
   2220 		return "MR_TX_CONFIG2";
   2221 	case CSR_PSKEY_USB_DONT_RESET_BOOTMODE_ON_HOST_RESET:
   2222 		return "USB_DONT_RESET_BOOTMODE_ON_HOST_RESET";
   2223 	case CSR_PSKEY_LC_USE_THROTTLING:
   2224 		return "LC_USE_THROTTLING";
   2225 	case CSR_PSKEY_CHARGER_TRIM:
   2226 		return "CHARGER_TRIM";
   2227 	case CSR_PSKEY_CLOCK_REQUEST_FEATURES:
   2228 		return "CLOCK_REQUEST_FEATURES";
   2229 	case CSR_PSKEY_TRANSMIT_OFFSET_CLASS1:
   2230 		return "TRANSMIT_OFFSET_CLASS1";
   2231 	case CSR_PSKEY_TX_AVOID_PA_CLASS1_PIO:
   2232 		return "TX_AVOID_PA_CLASS1_PIO";
   2233 	case CSR_PSKEY_MR_PIO_CONFIG:
   2234 		return "MR_PIO_CONFIG";
   2235 	case CSR_PSKEY_UART_CONFIG2:
   2236 		return "UART_CONFIG2";
   2237 	case CSR_PSKEY_CLASS1_IQ_LVL:
   2238 		return "CLASS1_IQ_LVL";
   2239 	case CSR_PSKEY_CLASS1_TX_CONFIG2:
   2240 		return "CLASS1_TX_CONFIG2";
   2241 	case CSR_PSKEY_TEMPERATURE_VS_DELTA_INTERNAL_PA_CLASS1:
   2242 		return "TEMPERATURE_VS_DELTA_INTERNAL_PA_CLASS1";
   2243 	case CSR_PSKEY_TEMPERATURE_VS_DELTA_EXTERNAL_PA_CLASS1:
   2244 		return "TEMPERATURE_VS_DELTA_EXTERNAL_PA_CLASS1";
   2245 	case CSR_PSKEY_TEMPERATURE_VS_DELTA_TX_PRE_LVL_MR:
   2246 		return "TEMPERATURE_VS_DELTA_TX_PRE_LVL_MR";
   2247 	case CSR_PSKEY_TEMPERATURE_VS_DELTA_TX_BB_MR_HEADER:
   2248 		return "TEMPERATURE_VS_DELTA_TX_BB_MR_HEADER";
   2249 	case CSR_PSKEY_TEMPERATURE_VS_DELTA_TX_BB_MR_PAYLOAD:
   2250 		return "TEMPERATURE_VS_DELTA_TX_BB_MR_PAYLOAD";
   2251 	case CSR_PSKEY_RX_MR_EQ_TAPS:
   2252 		return "RX_MR_EQ_TAPS";
   2253 	case CSR_PSKEY_TX_PRE_LVL_CLASS1:
   2254 		return "TX_PRE_LVL_CLASS1";
   2255 	case CSR_PSKEY_ANALOGUE_ATTENUATOR:
   2256 		return "ANALOGUE_ATTENUATOR";
   2257 	case CSR_PSKEY_MR_RX_FILTER_TRIM:
   2258 		return "MR_RX_FILTER_TRIM";
   2259 	case CSR_PSKEY_MR_RX_FILTER_RESPONSE:
   2260 		return "MR_RX_FILTER_RESPONSE";
   2261 	case CSR_PSKEY_PIO_WAKEUP_STATE:
   2262 		return "PIO_WAKEUP_STATE";
   2263 	case CSR_PSKEY_MR_TX_IF_ATTEN_OFF_TEMP:
   2264 		return "MR_TX_IF_ATTEN_OFF_TEMP";
   2265 	case CSR_PSKEY_LO_DIV_LATCH_BYPASS:
   2266 		return "LO_DIV_LATCH_BYPASS";
   2267 	case CSR_PSKEY_LO_VCO_STANDBY:
   2268 		return "LO_VCO_STANDBY";
   2269 	case CSR_PSKEY_SLOW_CLOCK_FILTER_SHIFT:
   2270 		return "SLOW_CLOCK_FILTER_SHIFT";
   2271 	case CSR_PSKEY_SLOW_CLOCK_FILTER_DIVIDER:
   2272 		return "SLOW_CLOCK_FILTER_DIVIDER";
   2273 	case CSR_PSKEY_USB_ATTRIBUTES_POWER:
   2274 		return "USB_ATTRIBUTES_POWER";
   2275 	case CSR_PSKEY_USB_ATTRIBUTES_WAKEUP:
   2276 		return "USB_ATTRIBUTES_WAKEUP";
   2277 	case CSR_PSKEY_DFU_ATTRIBUTES_MANIFESTATION_TOLERANT:
   2278 		return "DFU_ATTRIBUTES_MANIFESTATION_TOLERANT";
   2279 	case CSR_PSKEY_DFU_ATTRIBUTES_CAN_UPLOAD:
   2280 		return "DFU_ATTRIBUTES_CAN_UPLOAD";
   2281 	case CSR_PSKEY_DFU_ATTRIBUTES_CAN_DOWNLOAD:
   2282 		return "DFU_ATTRIBUTES_CAN_DOWNLOAD";
   2283 	case CSR_PSKEY_UART_CONFIG_STOP_BITS:
   2284 		return "UART_CONFIG_STOP_BITS";
   2285 	case CSR_PSKEY_UART_CONFIG_PARITY_BIT:
   2286 		return "UART_CONFIG_PARITY_BIT";
   2287 	case CSR_PSKEY_UART_CONFIG_FLOW_CTRL_EN:
   2288 		return "UART_CONFIG_FLOW_CTRL_EN";
   2289 	case CSR_PSKEY_UART_CONFIG_RTS_AUTO_EN:
   2290 		return "UART_CONFIG_RTS_AUTO_EN";
   2291 	case CSR_PSKEY_UART_CONFIG_RTS:
   2292 		return "UART_CONFIG_RTS";
   2293 	case CSR_PSKEY_UART_CONFIG_TX_ZERO_EN:
   2294 		return "UART_CONFIG_TX_ZERO_EN";
   2295 	case CSR_PSKEY_UART_CONFIG_NON_BCSP_EN:
   2296 		return "UART_CONFIG_NON_BCSP_EN";
   2297 	case CSR_PSKEY_UART_CONFIG_RX_RATE_DELAY:
   2298 		return "UART_CONFIG_RX_RATE_DELAY";
   2299 	case CSR_PSKEY_UART_SEQ_TIMEOUT:
   2300 		return "UART_SEQ_TIMEOUT";
   2301 	case CSR_PSKEY_UART_SEQ_RETRIES:
   2302 		return "UART_SEQ_RETRIES";
   2303 	case CSR_PSKEY_UART_SEQ_WINSIZE:
   2304 		return "UART_SEQ_WINSIZE";
   2305 	case CSR_PSKEY_UART_USE_CRC_ON_TX:
   2306 		return "UART_USE_CRC_ON_TX";
   2307 	case CSR_PSKEY_UART_HOST_INITIAL_STATE:
   2308 		return "UART_HOST_INITIAL_STATE";
   2309 	case CSR_PSKEY_UART_HOST_ATTENTION_SPAN:
   2310 		return "UART_HOST_ATTENTION_SPAN";
   2311 	case CSR_PSKEY_UART_HOST_WAKEUP_TIME:
   2312 		return "UART_HOST_WAKEUP_TIME";
   2313 	case CSR_PSKEY_UART_HOST_WAKEUP_WAIT:
   2314 		return "UART_HOST_WAKEUP_WAIT";
   2315 	case CSR_PSKEY_BCSP_LM_MODE:
   2316 		return "BCSP_LM_MODE";
   2317 	case CSR_PSKEY_BCSP_LM_SYNC_RETRIES:
   2318 		return "BCSP_LM_SYNC_RETRIES";
   2319 	case CSR_PSKEY_BCSP_LM_TSHY:
   2320 		return "BCSP_LM_TSHY";
   2321 	case CSR_PSKEY_UART_DFU_CONFIG_STOP_BITS:
   2322 		return "UART_DFU_CONFIG_STOP_BITS";
   2323 	case CSR_PSKEY_UART_DFU_CONFIG_PARITY_BIT:
   2324 		return "UART_DFU_CONFIG_PARITY_BIT";
   2325 	case CSR_PSKEY_UART_DFU_CONFIG_FLOW_CTRL_EN:
   2326 		return "UART_DFU_CONFIG_FLOW_CTRL_EN";
   2327 	case CSR_PSKEY_UART_DFU_CONFIG_RTS_AUTO_EN:
   2328 		return "UART_DFU_CONFIG_RTS_AUTO_EN";
   2329 	case CSR_PSKEY_UART_DFU_CONFIG_RTS:
   2330 		return "UART_DFU_CONFIG_RTS";
   2331 	case CSR_PSKEY_UART_DFU_CONFIG_TX_ZERO_EN:
   2332 		return "UART_DFU_CONFIG_TX_ZERO_EN";
   2333 	case CSR_PSKEY_UART_DFU_CONFIG_NON_BCSP_EN:
   2334 		return "UART_DFU_CONFIG_NON_BCSP_EN";
   2335 	case CSR_PSKEY_UART_DFU_CONFIG_RX_RATE_DELAY:
   2336 		return "UART_DFU_CONFIG_RX_RATE_DELAY";
   2337 	case CSR_PSKEY_AMUX_AIO0:
   2338 		return "AMUX_AIO0";
   2339 	case CSR_PSKEY_AMUX_AIO1:
   2340 		return "AMUX_AIO1";
   2341 	case CSR_PSKEY_AMUX_AIO2:
   2342 		return "AMUX_AIO2";
   2343 	case CSR_PSKEY_AMUX_AIO3:
   2344 		return "AMUX_AIO3";
   2345 	case CSR_PSKEY_LOCAL_NAME_SIMPLIFIED:
   2346 		return "LOCAL_NAME_SIMPLIFIED";
   2347 	case CSR_PSKEY_EXTENDED_STUB:
   2348 		return "EXTENDED_STUB";
   2349 	default:
   2350 		return "UNKNOWN";
   2351 	}
   2352 }
   2353 
   2354 int csr_write_varid_valueless(int dd, uint16_t seqnum, uint16_t varid)
   2355 {
   2356 	unsigned char cmd[] = { 0x02, 0x00, 0x09, 0x00,
   2357 				seqnum & 0xff, seqnum >> 8, varid & 0xff, varid >> 8, 0x00, 0x00,
   2358 				0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
   2359 
   2360 	unsigned char cp[254], rp[254];
   2361 	struct hci_request rq;
   2362 
   2363 	memset(&cp, 0, sizeof(cp));
   2364 	cp[0] = 0xc2;
   2365 	memcpy(cp + 1, cmd, sizeof(cmd));
   2366 
   2367 	switch (varid) {
   2368 	case CSR_VARID_COLD_RESET:
   2369 	case CSR_VARID_WARM_RESET:
   2370 	case CSR_VARID_COLD_HALT:
   2371 	case CSR_VARID_WARM_HALT:
   2372 		return hci_send_cmd(dd, OGF_VENDOR_CMD, 0x00, sizeof(cmd) + 1, cp);
   2373 	}
   2374 
   2375 	memset(&rq, 0, sizeof(rq));
   2376 	rq.ogf    = OGF_VENDOR_CMD;
   2377 	rq.ocf    = 0x00;
   2378 	rq.event  = EVT_VENDOR;
   2379 	rq.cparam = cp;
   2380 	rq.clen   = sizeof(cmd) + 1;
   2381 	rq.rparam = rp;
   2382 	rq.rlen   = sizeof(rp);
   2383 
   2384 	if (hci_send_req(dd, &rq, 2000) < 0)
   2385 		return -1;
   2386 
   2387 	if (rp[0] != 0xc2) {
   2388 		errno = EIO;
   2389 		return -1;
   2390 	}
   2391 
   2392 	if ((rp[9] + (rp[10] << 8)) != 0) {
   2393 		errno = ENXIO;
   2394 		return -1;
   2395 	}
   2396 
   2397 	return 0;
   2398 }
   2399 
   2400 int csr_write_varid_complex(int dd, uint16_t seqnum, uint16_t varid, uint8_t *value, uint16_t length)
   2401 {
   2402 	unsigned char cmd[] = { 0x02, 0x00, ((length / 2) + 5) & 0xff, ((length / 2) + 5) >> 8,
   2403 				seqnum & 0xff, seqnum >> 8, varid & 0xff, varid >> 8, 0x00, 0x00,
   2404 				0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
   2405 
   2406 	unsigned char cp[254], rp[254];
   2407 	struct hci_request rq;
   2408 
   2409 	memset(&cp, 0, sizeof(cp));
   2410 	cp[0] = 0xc2;
   2411 	memcpy(cp + 1, cmd, sizeof(cmd));
   2412 	memcpy(cp + 11, value, length);
   2413 
   2414 	memset(&rq, 0, sizeof(rq));
   2415 	rq.ogf    = OGF_VENDOR_CMD;
   2416 	rq.ocf    = 0x00;
   2417 	rq.event  = EVT_VENDOR;
   2418 	rq.cparam = cp;
   2419 	rq.clen   = sizeof(cmd) + length + 1;
   2420 	rq.rparam = rp;
   2421 	rq.rlen   = sizeof(rp);
   2422 
   2423 	if (hci_send_req(dd, &rq, 2000) < 0)
   2424 		return -1;
   2425 
   2426 	if (rp[0] != 0xc2) {
   2427 		errno = EIO;
   2428 		return -1;
   2429 	}
   2430 
   2431 	if ((rp[9] + (rp[10] << 8)) != 0) {
   2432 		errno = ENXIO;
   2433 		return -1;
   2434 	}
   2435 
   2436 	return 0;
   2437 }
   2438 
   2439 int csr_read_varid_complex(int dd, uint16_t seqnum, uint16_t varid, uint8_t *value, uint16_t length)
   2440 {
   2441 	unsigned char cmd[] = { 0x00, 0x00, ((length / 2) + 5) & 0xff, ((length / 2) + 5) >> 8,
   2442 				seqnum & 0xff, seqnum >> 8, varid & 0xff, varid >> 8, 0x00, 0x00,
   2443 				0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
   2444 
   2445 	unsigned char cp[254], rp[254];
   2446 	struct hci_request rq;
   2447 
   2448 	memset(&cp, 0, sizeof(cp));
   2449 	cp[0] = 0xc2;
   2450 	memcpy(cp + 1, cmd, sizeof(cmd));
   2451 	memcpy(cp + 11, value, length);
   2452 
   2453 	memset(&rq, 0, sizeof(rq));
   2454 	rq.ogf    = OGF_VENDOR_CMD;
   2455 	rq.ocf    = 0x00;
   2456 	rq.event  = EVT_VENDOR;
   2457 	rq.cparam = cp;
   2458 	rq.clen   = sizeof(cmd) + length + 1;
   2459 	rq.rparam = rp;
   2460 	rq.rlen   = sizeof(rp);
   2461 
   2462 	if (hci_send_req(dd, &rq, 2000) < 0)
   2463 		return -1;
   2464 
   2465 	if (rp[0] != 0xc2) {
   2466 		errno = EIO;
   2467 		return -1;
   2468 	}
   2469 
   2470 	if ((rp[9] + (rp[10] << 8)) != 0) {
   2471 		errno = ENXIO;
   2472 		return -1;
   2473 	}
   2474 
   2475 	memcpy(value, rp + 11, length);
   2476 
   2477 	return 0;
   2478 }
   2479 
   2480 int csr_read_varid_uint16(int dd, uint16_t seqnum, uint16_t varid, uint16_t *value)
   2481 {
   2482 	unsigned char cmd[] = { 0x00, 0x00, 0x09, 0x00,
   2483 				seqnum & 0xff, seqnum >> 8, varid & 0xff, varid >> 8, 0x00, 0x00,
   2484 				0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
   2485 
   2486 	unsigned char cp[254], rp[254];
   2487 	struct hci_request rq;
   2488 
   2489 	memset(&cp, 0, sizeof(cp));
   2490 	cp[0] = 0xc2;
   2491 	memcpy(cp + 1, cmd, sizeof(cmd));
   2492 
   2493 	memset(&rq, 0, sizeof(rq));
   2494 	rq.ogf    = OGF_VENDOR_CMD;
   2495 	rq.ocf    = 0x00;
   2496 	rq.event  = EVT_VENDOR;
   2497 	rq.cparam = cp;
   2498 	rq.clen   = sizeof(cmd) + 1;
   2499 	rq.rparam = rp;
   2500 	rq.rlen   = sizeof(rp);
   2501 
   2502 	if (hci_send_req(dd, &rq, 2000) < 0)
   2503 		return -1;
   2504 
   2505 	if (rp[0] != 0xc2) {
   2506 		errno = EIO;
   2507 		return -1;
   2508 	}
   2509 
   2510 	if ((rp[9] + (rp[10] << 8)) != 0) {
   2511 		errno = ENXIO;
   2512 		return -1;
   2513 	}
   2514 
   2515 	*value = rp[11] + (rp[12] << 8);
   2516 
   2517 	return 0;
   2518 }
   2519 
   2520 int csr_read_varid_uint32(int dd, uint16_t seqnum, uint16_t varid, uint32_t *value)
   2521 {
   2522 	unsigned char cmd[] = { 0x00, 0x00, 0x09, 0x00,
   2523 				seqnum & 0xff, seqnum >> 8, varid & 0xff, varid >> 8, 0x00, 0x00,
   2524 				0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
   2525 
   2526 	unsigned char cp[254], rp[254];
   2527 	struct hci_request rq;
   2528 
   2529 	memset(&cp, 0, sizeof(cp));
   2530 	cp[0] = 0xc2;
   2531 	memcpy(cp + 1, cmd, sizeof(cmd));
   2532 
   2533 	memset(&rq, 0, sizeof(rq));
   2534 	rq.ogf    = OGF_VENDOR_CMD;
   2535 	rq.ocf    = 0x00;
   2536 	rq.event  = EVT_VENDOR;
   2537 	rq.cparam = cp;
   2538 	rq.clen   = sizeof(cmd) + 1;
   2539 	rq.rparam = rp;
   2540 	rq.rlen   = sizeof(rp);
   2541 
   2542 	if (hci_send_req(dd, &rq, 2000) < 0)
   2543 		return -1;
   2544 
   2545 	if (rp[0] != 0xc2) {
   2546 		errno = EIO;
   2547 		return -1;
   2548 	}
   2549 
   2550 	if ((rp[9] + (rp[10] << 8)) != 0) {
   2551 		errno = ENXIO;
   2552 		return -1;
   2553 	}
   2554 
   2555 	*value = ((rp[11] + (rp[12] << 8)) << 16) + (rp[13] + (rp[14] << 8));
   2556 
   2557 	return 0;
   2558 }
   2559 
   2560 int csr_read_pskey_complex(int dd, uint16_t seqnum, uint16_t pskey, uint16_t stores, uint8_t *value, uint16_t length)
   2561 {
   2562 	unsigned char cmd[] = { 0x00, 0x00, ((length / 2) + 8) & 0xff, ((length / 2) + 8) >> 8,
   2563 				seqnum & 0xff, seqnum >> 8, 0x03, 0x70, 0x00, 0x00,
   2564 				pskey & 0xff, pskey >> 8,
   2565 				(length / 2) & 0xff, (length / 2) >> 8,
   2566 				stores & 0xff, stores >> 8, 0x00, 0x00 };
   2567 
   2568 	unsigned char cp[254], rp[254];
   2569 	struct hci_request rq;
   2570 
   2571 	memset(&cp, 0, sizeof(cp));
   2572 	cp[0] = 0xc2;
   2573 	memcpy(cp + 1, cmd, sizeof(cmd));
   2574 
   2575 	memset(&rq, 0, sizeof(rq));
   2576 	rq.ogf    = OGF_VENDOR_CMD;
   2577 	rq.ocf    = 0x00;
   2578 	rq.event  = EVT_VENDOR;
   2579 	rq.cparam = cp;
   2580 	rq.clen   = sizeof(cmd) + length - 1;
   2581 	rq.rparam = rp;
   2582 	rq.rlen   = sizeof(rp);
   2583 
   2584 	if (hci_send_req(dd, &rq, 2000) < 0)
   2585 		return -1;
   2586 
   2587 	if (rp[0] != 0xc2) {
   2588 		errno = EIO;
   2589 		return -1;
   2590 	}
   2591 
   2592 	if ((rp[9] + (rp[10] << 8)) != 0) {
   2593 		errno = ENXIO;
   2594 		return -1;
   2595 	}
   2596 
   2597 	memcpy(value, rp + 17, length);
   2598 
   2599 	return 0;
   2600 }
   2601 
   2602 int csr_write_pskey_complex(int dd, uint16_t seqnum, uint16_t pskey, uint16_t stores, uint8_t *value, uint16_t length)
   2603 {
   2604 	unsigned char cmd[] = { 0x02, 0x00, ((length / 2) + 8) & 0xff, ((length / 2) + 8) >> 8,
   2605 				seqnum & 0xff, seqnum >> 8, 0x03, 0x70, 0x00, 0x00,
   2606 				pskey & 0xff, pskey >> 8,
   2607 				(length / 2) & 0xff, (length / 2) >> 8,
   2608 				stores & 0xff, stores >> 8, 0x00, 0x00 };
   2609 
   2610 	unsigned char cp[254], rp[254];
   2611 	struct hci_request rq;
   2612 
   2613 	memset(&cp, 0, sizeof(cp));
   2614 	cp[0] = 0xc2;
   2615 	memcpy(cp + 1, cmd, sizeof(cmd));
   2616 
   2617 	memcpy(cp + 17, value, length);
   2618 
   2619 	memset(&rq, 0, sizeof(rq));
   2620 	rq.ogf    = OGF_VENDOR_CMD;
   2621 	rq.ocf    = 0x00;
   2622 	rq.event  = EVT_VENDOR;
   2623 	rq.cparam = cp;
   2624 	rq.clen   = sizeof(cmd) + length - 1;
   2625 	rq.rparam = rp;
   2626 	rq.rlen   = sizeof(rp);
   2627 
   2628 	if (hci_send_req(dd, &rq, 2000) < 0)
   2629 		return -1;
   2630 
   2631 	if (rp[0] != 0xc2) {
   2632 		errno = EIO;
   2633 		return -1;
   2634 	}
   2635 
   2636 	if ((rp[9] + (rp[10] << 8)) != 0) {
   2637 		errno = ENXIO;
   2638 		return -1;
   2639 	}
   2640 
   2641 	return 0;
   2642 }
   2643 
   2644 int csr_read_pskey_uint16(int dd, uint16_t seqnum, uint16_t pskey, uint16_t stores, uint16_t *value)
   2645 {
   2646 	uint8_t array[2] = { 0x00, 0x00 };
   2647 	int err;
   2648 
   2649 	err = csr_read_pskey_complex(dd, seqnum, pskey, stores, array, 2);
   2650 
   2651 	*value = array[0] + (array[1] << 8);
   2652 
   2653 	return err;
   2654 }
   2655 
   2656 int csr_write_pskey_uint16(int dd, uint16_t seqnum, uint16_t pskey, uint16_t stores, uint16_t value)
   2657 {
   2658 	uint8_t array[2] = { value & 0xff, value >> 8 };
   2659 
   2660 	return csr_write_pskey_complex(dd, seqnum, pskey, stores, array, 2);
   2661 }
   2662 
   2663 int csr_read_pskey_uint32(int dd, uint16_t seqnum, uint16_t pskey, uint16_t stores, uint32_t *value)
   2664 {
   2665 	uint8_t array[4] = { 0x00, 0x00, 0x00, 0x00 };
   2666 	int err;
   2667 
   2668 	err = csr_read_pskey_complex(dd, seqnum, pskey, stores, array, 4);
   2669 
   2670 	*value = ((array[0] + (array[1] << 8)) << 16) +
   2671 						(array[2] + (array[3] << 8));
   2672 
   2673 	return err;
   2674 }
   2675 
   2676 int csr_write_pskey_uint32(int dd, uint16_t seqnum, uint16_t pskey, uint16_t stores, uint32_t value)
   2677 {
   2678 	uint8_t array[4] = { (value & 0xff0000) >> 16, value >> 24,
   2679 					value & 0xff, (value & 0xff00) >> 8 };
   2680 
   2681 	return csr_write_pskey_complex(dd, seqnum, pskey, stores, array, 4);
   2682 }
   2683 
   2684 int psr_put(uint16_t pskey, uint8_t *value, uint16_t size)
   2685 {
   2686 	struct psr_data *item;
   2687 
   2688 	item = malloc(sizeof(*item));
   2689 	if (!item)
   2690 		return -ENOMEM;
   2691 
   2692 	item->pskey = pskey;
   2693 
   2694 	if (size > 0) {
   2695 		item->value = malloc(size);
   2696 		if (!item->value) {
   2697 			free(item);
   2698 			return -ENOMEM;
   2699 		}
   2700 
   2701 		memcpy(item->value, value, size);
   2702 		item->size = size;
   2703 	} else {
   2704 		item->value = NULL;
   2705 		item->size = 0;
   2706 	}
   2707 
   2708 	item->next = NULL;
   2709 
   2710 	if (!head)
   2711 		head = item;
   2712 	else
   2713 		tail->next = item;
   2714 
   2715 	tail = item;
   2716 
   2717 	return 0;
   2718 }
   2719 
   2720 int psr_get(uint16_t *pskey, uint8_t *value, uint16_t *size)
   2721 {
   2722 	struct psr_data *item = head;
   2723 
   2724 	if (!head)
   2725 		return -ENOENT;
   2726 
   2727 	*pskey = item->pskey;
   2728 
   2729 	if (item->value) {
   2730 		if (value && item->size > 0)
   2731 			memcpy(value, item->value, item->size);
   2732 		free(item->value);
   2733 		*size = item->size;
   2734 	} else
   2735 		*size = 0;
   2736 
   2737 	if (head == tail)
   2738 		tail = NULL;
   2739 
   2740 	head = head->next;
   2741 	free(item);
   2742 
   2743 	return 0;
   2744 }
   2745 
   2746 static int parse_line(char *str)
   2747 {
   2748 	uint8_t array[256];
   2749 	uint16_t value, pskey, length = 0;
   2750 	char *off, *end;
   2751 
   2752 	pskey = strtol(str + 1, NULL, 16);
   2753 	off = strstr(str, "=") + 1;
   2754 	if (!off)
   2755 		return -EIO;
   2756 
   2757 	while (1) {
   2758 		value = strtol(off, &end, 16);
   2759 		if (value == 0 && off == end)
   2760 			break;
   2761 
   2762 		array[length++] = value & 0xff;
   2763 		array[length++] = value >> 8;
   2764 
   2765 		if (*end == '\0')
   2766 			break;
   2767 
   2768 		off = end + 1;
   2769 	}
   2770 
   2771 	return psr_put(pskey, array, length);
   2772 }
   2773 
   2774 int psr_read(const char *filename)
   2775 {
   2776 	struct stat st;
   2777 	char *str, *map, *off, *end;
   2778 	int fd, err = 0;
   2779 
   2780 	fd = open(filename, O_RDONLY);
   2781 	if (fd < 0)
   2782 		return fd;
   2783 
   2784 	if (fstat(fd, &st) < 0) {
   2785 		err = -errno;
   2786 		goto close;
   2787 	}
   2788 
   2789 	map = mmap(0, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
   2790 	if (!map || map == MAP_FAILED) {
   2791 		err = -errno;
   2792 		goto close;
   2793 	}
   2794 
   2795 	off = map;
   2796 
   2797 	while (1) {
   2798 		if (*off == '\r' || *off == '\n') {
   2799 			off++;
   2800 			continue;
   2801 		}
   2802 
   2803 		end = strpbrk(off, "\r\n");
   2804 		if (!end)
   2805 			break;
   2806 
   2807 		str = malloc(end - off + 1);
   2808 		if (!str)
   2809 			break;
   2810 
   2811 		memset(str, 0, end - off + 1);
   2812 		strncpy(str, off, end - off);
   2813 		if (*str == '&')
   2814 			parse_line(str);
   2815 
   2816 		free(str);
   2817 		off = end + 1;
   2818 	}
   2819 
   2820 	munmap(map, st.st_size);
   2821 
   2822 close:
   2823 	close(fd);
   2824 
   2825 	return err;
   2826 }
   2827 
   2828 int psr_print(void)
   2829 {
   2830 	uint8_t array[256];
   2831 	uint16_t pskey, length;
   2832 	char *str, val[7];
   2833 	int i;
   2834 
   2835 	while (1) {
   2836 		if (psr_get(&pskey, array, &length) < 0)
   2837 			break;
   2838 
   2839 		str = csr_pskeytoval(pskey);
   2840 		if (!strcasecmp(str, "UNKNOWN")) {
   2841 			sprintf(val, "0x%04x", pskey);
   2842 			str = NULL;
   2843 		}
   2844 
   2845 		printf("// %s%s\n&%04x =", str ? "PSKEY_" : "",
   2846 						str ? str : val, pskey);
   2847 		for (i = 0; i < length / 2; i++)
   2848 			printf(" %02x%02x", array[i * 2 + 1], array[i * 2]);
   2849 		printf("\n");
   2850 	}
   2851 
   2852 	return 0;
   2853 }
   2854