mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-29 23:24:20 +08:00
Add helper functions for controller type string conversion
This commit is contained in:
parent
bbd888d066
commit
4aa4bdb16a
21
lib/hci.c
21
lib/hci.c
@ -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 },
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user