Add helper functions for controller type string conversion

This commit is contained in:
Marcel Holtmann 2010-02-13 02:21:29 +01:00
parent bbd888d066
commit 4aa4bdb16a
2 changed files with 21 additions and 2 deletions

View File

@ -138,9 +138,9 @@ static int hci_str2uint(hci_map *map, char *str, unsigned int *val)
return set;
}
char *hci_dtypetostr(int type)
char *hci_bustostr(int bus)
{
switch (type) {
switch (bus) {
case HCI_VIRTUAL:
return "VIRTUAL";
case HCI_USB:
@ -160,6 +160,23 @@ char *hci_dtypetostr(int type)
}
}
char *hci_dtypetostr(int type)
{
return hci_bustostr(type & 0x0f);
}
char *hci_typetostr(int type)
{
switch (type) {
case HCI_BREDR:
return "BR/EDR";
case HCI_80211:
return "802.11";
default:
return "UNKNOWN";
}
}
/* HCI dev flags mapping */
static hci_map dev_flags_map[] = {
{ "UP", HCI_UP },

View File

@ -117,6 +117,8 @@ int hci_read_clock(int dd, uint16_t handle, uint8_t which, uint32_t *clock, uint
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);
char *hci_typetostr(int type);
char *hci_dtypetostr(int type);
char *hci_dflagstostr(uint32_t flags);
char *hci_ptypetostr(unsigned int ptype);