mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-28 22:54:14 +08:00
mgmt: Add support for remote_name event
This commit is contained in:
parent
c76086fd59
commit
56fe067384
@ -281,3 +281,9 @@ struct mgmt_ev_device_found {
|
||||
int8_t rssi;
|
||||
uint8_t eir[HCI_MAX_EIR_LENGTH];
|
||||
} __packed;
|
||||
|
||||
#define MGMT_EV_REMOTE_NAME 0x0013
|
||||
struct mgmt_ev_remote_name {
|
||||
bdaddr_t bdaddr;
|
||||
uint8_t name[MGMT_MAX_NAME_LENGTH];
|
||||
} __packed;
|
||||
|
@ -1292,6 +1292,30 @@ static void mgmt_device_found(int sk, uint16_t index, void *buf, size_t len)
|
||||
btd_event_device_found(&info->bdaddr, &ev->bdaddr, cls, ev->rssi, eir);
|
||||
}
|
||||
|
||||
static void mgmt_remote_name(int sk, uint16_t index, void *buf, size_t len)
|
||||
{
|
||||
struct mgmt_ev_remote_name *ev = buf;
|
||||
struct controller_info *info;
|
||||
char addr[18];
|
||||
|
||||
if (len < sizeof(*ev)) {
|
||||
error("Too small mgmt_remote_name packet");
|
||||
return;
|
||||
}
|
||||
|
||||
if (index > max_index) {
|
||||
error("Unexpected index %u in remote_name event", index);
|
||||
return;
|
||||
}
|
||||
|
||||
info = &controllers[index];
|
||||
|
||||
ba2str(&ev->bdaddr, addr);
|
||||
DBG("hci%u addr %s, name %s", index, addr, ev->name);
|
||||
|
||||
btd_event_remote_name(&info->bdaddr, &ev->bdaddr, 0, (char *) ev->name);
|
||||
}
|
||||
|
||||
static gboolean mgmt_event(GIOChannel *io, GIOCondition cond, gpointer user_data)
|
||||
{
|
||||
char buf[MGMT_BUF_SIZE];
|
||||
@ -1390,6 +1414,9 @@ static gboolean mgmt_event(GIOChannel *io, GIOCondition cond, gpointer user_data
|
||||
case MGMT_EV_DEVICE_FOUND:
|
||||
mgmt_device_found(sk, index, buf + MGMT_HDR_SIZE, len);
|
||||
break;
|
||||
case MGMT_EV_REMOTE_NAME:
|
||||
mgmt_remote_name(sk, index, buf + MGMT_HDR_SIZE, len);
|
||||
break;
|
||||
default:
|
||||
error("Unknown Management opcode %u (index %u)", opcode, index);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user