diff --git a/client/mgmt.c b/client/mgmt.c
index 6fd4388..6216772 100644
--- a/client/mgmt.c
+++ b/client/mgmt.c
for (i = 0; i < count; i++) {
uint16_t index = le16_to_cpu(rp->entry[i].index);
- char *busstr = hci_bustostr(rp->entry[i].bus);
+ const char *busstr = hci_bustostr(rp->entry[i].bus);
switch (rp->entry[i].type) {
case 0x00:
diff --git a/lib/hci.c b/lib/hci.c
index bd735a4..937e65d 100644
--- a/lib/hci.c
+++ b/lib/hci.c
unsigned int val;
} hci_map;
-static char *hci_bit2str(hci_map *m, unsigned int val)
+static char *hci_bit2str(const hci_map *m, unsigned int val)
{
char *str = malloc(120);
char *ptr = str;
return str;
}
-static int hci_str2bit(hci_map *map, char *str, unsigned int *val)
+static int hci_str2bit(const hci_map *map, char *str, unsigned int *val)
{
char *t, *ptr;
- hci_map *m;
+ const hci_map *m;
int set;
if (!str || !(str = ptr = strdup(str)))
return set;
}
-static char *hci_uint2str(hci_map *m, unsigned int val)
+static char *hci_uint2str(const hci_map *m, unsigned int val)
{
char *str = malloc(50);
char *ptr = str;
return str;
}
-static int hci_str2uint(hci_map *map, char *str, unsigned int *val)
+static int hci_str2uint(const hci_map *map, char *str, unsigned int *val)
{
char *t, *ptr;
- hci_map *m;
+ const hci_map *m;
int set = 0;
if (!str)
return set;
}
-char *hci_bustostr(int bus)
+const char *hci_bustostr(int bus)
{
switch (bus) {
case HCI_VIRTUAL:
}
}
-char *hci_dtypetostr(int type)
+const char *hci_dtypetostr(int type)
{
return hci_bustostr(type & 0x0f);
}
}
/* HCI dev flags mapping */
-static hci_map dev_flags_map[] = {
+static const hci_map dev_flags_map[] = {
{ "UP", HCI_UP },
{ "INIT", HCI_INIT },
{ "RUNNING", HCI_RUNNING },
{
char *str = bt_malloc(50);
char *ptr = str;
- hci_map *m = dev_flags_map;
+ const hci_map *m = dev_flags_map;
if (!str)
return NULL;
}
/* HCI packet type mapping */
-static hci_map pkt_type_map[] = {
+static const hci_map pkt_type_map[] = {
{ "DM1", HCI_DM1 },
{ "DM3", HCI_DM3 },
{ "DM5", HCI_DM5 },
{ NULL }
};
-static hci_map sco_ptype_map[] = {
+static const hci_map sco_ptype_map[] = {
{ "HV1", 0x0001 },
{ "HV2", 0x0002 },
{ "HV3", 0x0004 },
}
/* Link policy mapping */
-static hci_map link_policy_map[] = {
+static const hci_map link_policy_map[] = {
{ "NONE", 0 },
{ "RSWITCH", HCI_LP_RSWITCH },
{ "HOLD", HCI_LP_HOLD },
}
/* Link mode mapping */
-static hci_map link_mode_map[] = {
+static const hci_map link_mode_map[] = {
{ "NONE", 0 },
{ "ACCEPT", HCI_LM_ACCEPT },
{ "CENTRAL", HCI_LM_MASTER },
}
/* Command mapping */
-static hci_map commands_map[] = {
+static const hci_map commands_map[] = {
{ "Inquiry", 0 },
{ "Inquiry Cancel", 1 },
{ "Periodic Inquiry Mode", 2 },
char *hci_commandstostr(uint8_t *commands, char *pref, int width)
{
unsigned int maxwidth = width - 3;
- hci_map *m;
+ const hci_map *m;
char *off, *ptr, *str;
int size = 10;
}
/* Version mapping */
-static hci_map ver_map[] = {
+static const hci_map ver_map[] = {
{ "1.0b", 0x00 },
{ "1.1", 0x01 },
{ "1.2", 0x02 },
return hci_str2uint(ver_map, str, ver);
}
-static hci_map pal_map[] = {
+static const hci_map pal_map[] = {
{ "3.0", 0x01 },
{ NULL }
};
}
/* LMP features mapping */
-static hci_map lmp_features_map[8][9] = {
+static const hci_map lmp_features_map[8][9] = {
{ /* Byte 0 */
{ "<3-slot packets>", LMP_3SLOT }, /* Bit 0 */
{ "<5-slot packets>", LMP_5SLOT }, /* Bit 1 */
int i, size = 10;
for (i = 0; i < 8; i++) {
- hci_map *m = lmp_features_map[i];
+ const hci_map *m = lmp_features_map[i];
while (m->str) {
if (m->val & features[i])
off = ptr;
for (i = 0; i < 8; i++) {
- hci_map *m = lmp_features_map[i];
+ const hci_map *m = lmp_features_map[i];
while (m->str) {
if (m->val & features[i]) {
diff --git a/lib/hci_lib.h b/lib/hci_lib.h
index 6b1a548..baf3d3e 100644
--- a/lib/hci_lib.h
+++ b/lib/hci_lib.h
int hci_for_each_dev(int flag, int(*func)(int dd, int dev_id, long arg), long arg);
int hci_get_route(bdaddr_t *bdaddr);
-char *hci_bustostr(int bus);
+const char *hci_bustostr(int bus);
char *hci_typetostr(int type);
-char *hci_dtypetostr(int type);
+const char *hci_dtypetostr(int type);
char *hci_dflagstostr(uint32_t flags);
char *hci_ptypetostr(unsigned int ptype);
int hci_strtoptype(char *str, unsigned int *val);