Bluetooth: Fix flags of mgmt_device_found event
authorJefferson Delfes <jefferson.delfes@openbossa.org>
Mon, 11 Jun 2012 13:18:51 +0000 (09:18 -0400)
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>
Wed, 13 Jun 2012 02:19:21 +0000 (23:19 -0300)
Change flags field to matches userspace structure.
This field needs to be converted to little endian before forward it.

Signed-off-by: Jefferson Delfes <jefferson.delfes@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
include/net/bluetooth/mgmt.h
net/bluetooth/mgmt.c

index 23fd0546fccbc1bd127b215bdb8c7150f08cfcb3..4348ee8bda6993a15193a4e1e6adb640c9512e1f 100644 (file)
@@ -444,7 +444,7 @@ struct mgmt_ev_auth_failed {
 struct mgmt_ev_device_found {
        struct mgmt_addr_info addr;
        __s8    rssi;
-       __u8    flags[4];
+       __le32  flags;
        __le16  eir_len;
        __u8    eir[0];
 } __packed;
index c72307cc25fc7af2fc679203ef19f29142d17a2f..b4816632d72472a32636538ce9fafd5f7c45841d 100644 (file)
@@ -3546,9 +3546,9 @@ int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
        ev->addr.type = link_to_bdaddr(link_type, addr_type);
        ev->rssi = rssi;
        if (cfm_name)
-               ev->flags[0] |= MGMT_DEV_FOUND_CONFIRM_NAME;
+               ev->flags |= MGMT_DEV_FOUND_CONFIRM_NAME;
        if (!ssp)
-               ev->flags[0] |= MGMT_DEV_FOUND_LEGACY_PAIRING;
+               ev->flags |= MGMT_DEV_FOUND_LEGACY_PAIRING;
 
        if (eir_len > 0)
                memcpy(ev->eir, eir, eir_len);
@@ -3558,6 +3558,7 @@ int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
                                          dev_class, 3);
 
        ev->eir_len = cpu_to_le16(eir_len);
+       ev->flags = cpu_to_le32(ev->flags);
 
        ev_size = sizeof(*ev) + eir_len;