summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/csr.h21
-rw-r--r--tools/pskey.c34
2 files changed, 32 insertions, 23 deletions
diff --git a/tools/csr.h b/tools/csr.h
index 42dfb8d0..347e1d54 100644
--- a/tools/csr.h
+++ b/tools/csr.h
@@ -58,15 +58,18 @@
#define CSR_VARID_MAX_TX_POWER 0x6827 /* int8 */
#define CSR_VARID_DEFAULT_TX_POWER 0x682b /* int8 */
-#define CSR_PSKEY_ENC_KEY_LMIN 0x00da
-#define CSR_PSKEY_ENC_KEY_LMAX 0x00db
-#define CSR_PSKEY_HOSTIO_MAP_SCO_PCM 0x01ab
-#define CSR_PSKEY_UART_BAUDRATE 0x01be
-#define CSR_PSKEY_HOST_INTERFACE 0x01f9
-#define CSR_PSKEY_USB_VENDOR_ID 0x02be
-#define CSR_PSKEY_USB_PRODUCT_ID 0x02bf
-#define CSR_PSKEY_USB_DFU_PRODUCT_ID 0x02cb
-#define CSR_PSKEY_INITIAL_BOOTMODE 0x03cd
+#define CSR_PSKEY_LOCAL_SUPPORTED_FEATURES 0x00ef /* uint16[] = { 0xffff, 0xFE8f, 0xF99B, 0x8000 } */
+#define CSR_PSKEY_ENC_KEY_LMIN 0x00da
+#define CSR_PSKEY_ENC_KEY_LMAX 0x00db
+#define CSR_PSKEY_HCI_LMP_LOCAL_VERSION 0x010d /* uint16 */
+#define CSR_PSKEY_LMP_REMOTE_VERSION 0x010e /* uint8 */
+#define CSR_PSKEY_HOSTIO_MAP_SCO_PCM 0x01ab
+#define CSR_PSKEY_UART_BAUDRATE 0x01be
+#define CSR_PSKEY_HOST_INTERFACE 0x01f9
+#define CSR_PSKEY_USB_VENDOR_ID 0x02be
+#define CSR_PSKEY_USB_PRODUCT_ID 0x02bf
+#define CSR_PSKEY_USB_DFU_PRODUCT_ID 0x02cb
+#define CSR_PSKEY_INITIAL_BOOTMODE 0x03cd
char *csr_buildidtostr(uint16_t id);
char *csr_chipvertostr(uint16_t ver, uint16_t rev);
diff --git a/tools/pskey.c b/tools/pskey.c
index f0ce1b4a..2b4bc210 100644
--- a/tools/pskey.c
+++ b/tools/pskey.c
@@ -42,15 +42,16 @@
#include "csr.h"
-#define CSR_TYPE_NULL 0
-#define CSR_TYPE_UINT16 1
+#define CSR_TYPE_NULL 0
+#define CSR_TYPE_UINT8 1
+#define CSR_TYPE_UINT16 2
static int write_pskey(int dd, uint16_t pskey, int type, int argc, char *argv[])
{
uint16_t value;
int err;
- if (type != CSR_TYPE_UINT16) {
+ if (type != CSR_TYPE_UINT8 && type != CSR_TYPE_UINT16) {
errno = EFAULT;
return -1;
}
@@ -60,7 +61,10 @@ static int write_pskey(int dd, uint16_t pskey, int type, int argc, char *argv[])
return -1;
}
- value = atoi(argv[0]);
+ if (!strncasecmp(argv[0], "0x", 2))
+ value = strtol(argv[0] + 2, NULL, 16);
+ else
+ value = atoi(argv[0]);
err = csr_write_pskey_uint16(dd, 0x4711, pskey, value);
@@ -72,7 +76,7 @@ static int read_pskey(int dd, uint16_t pskey, int type)
uint16_t value;
int err;
- if (type != CSR_TYPE_UINT16) {
+ if (type != CSR_TYPE_UINT8 && type != CSR_TYPE_UINT16) {
errno = EFAULT;
return -1;
}
@@ -91,15 +95,17 @@ static struct {
int type;
char *str;
} storage[] = {
- { CSR_PSKEY_ENC_KEY_LMIN, CSR_TYPE_UINT16, "keymin" },
- { CSR_PSKEY_ENC_KEY_LMAX, CSR_TYPE_UINT16, "keymax" },
- { CSR_PSKEY_HOSTIO_MAP_SCO_PCM, CSR_TYPE_UINT16, "mapsco" },
- { CSR_PSKEY_UART_BAUDRATE, CSR_TYPE_UINT16, "baudrate" },
- { CSR_PSKEY_HOST_INTERFACE, CSR_TYPE_UINT16, "hostintf" },
- { CSR_PSKEY_USB_VENDOR_ID, CSR_TYPE_UINT16, "usbvid" },
- { CSR_PSKEY_USB_PRODUCT_ID, CSR_TYPE_UINT16, "usbpid" },
- { CSR_PSKEY_USB_DFU_PRODUCT_ID, CSR_TYPE_UINT16, "dfupid" },
- { CSR_PSKEY_INITIAL_BOOTMODE, CSR_TYPE_UINT16, "bootmode" },
+ { CSR_PSKEY_ENC_KEY_LMIN, CSR_TYPE_UINT16, "keymin" },
+ { CSR_PSKEY_ENC_KEY_LMAX, CSR_TYPE_UINT16, "keymax" },
+ { CSR_PSKEY_HCI_LMP_LOCAL_VERSION, CSR_TYPE_UINT16, "version" },
+ { CSR_PSKEY_LMP_REMOTE_VERSION, CSR_TYPE_UINT8, "remver" },
+ { CSR_PSKEY_HOSTIO_MAP_SCO_PCM, CSR_TYPE_UINT16, "mapsco" },
+ { CSR_PSKEY_UART_BAUDRATE, CSR_TYPE_UINT16, "baudrate" },
+ { CSR_PSKEY_HOST_INTERFACE, CSR_TYPE_UINT16, "hostintf" },
+ { CSR_PSKEY_USB_VENDOR_ID, CSR_TYPE_UINT16, "usbvid" },
+ { CSR_PSKEY_USB_PRODUCT_ID, CSR_TYPE_UINT16, "usbpid" },
+ { CSR_PSKEY_USB_DFU_PRODUCT_ID, CSR_TYPE_UINT16, "dfupid" },
+ { CSR_PSKEY_INITIAL_BOOTMODE, CSR_TYPE_UINT16, "bootmode" },
{ 0x0000, CSR_TYPE_NULL, NULL },
};