aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorSzymon Janc <szymon.janc@tieto.com>2012-03-28 12:03:16 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2012-03-28 13:16:02 +0300
commitd5f15eac21c2795a2b0163cca15524e2a013803b (patch)
tree08628c698e9143d1036c8907ad9a96f40b7e7daf /plugins
parent97b4ceb85cabb22a94422fc8b993da090a2b0574 (diff)
downloadbluez-d5f15eac21c2795a2b0163cca15524e2a013803b.tar.gz
bluez-d5f15eac21c2795a2b0163cca15524e2a013803b.tar.xz
bluez-d5f15eac21c2795a2b0163cca15524e2a013803b.zip
mgmtops: Add support for setting Device ID
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mgmtops.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
index c24757c9..c08117f8 100644
--- a/plugins/mgmtops.c
+++ b/plugins/mgmtops.c
@@ -1426,6 +1426,9 @@ static void mgmt_cmd_complete(int sk, uint16_t index, void *buf, size_t len)
case MGMT_OP_STOP_DISCOVERY:
DBG("stop_discovery complete");
break;
+ case MGMT_OP_SET_DEVICE_ID:
+ DBG("set_did complete");
+ break;
default:
error("Unknown command complete for opcode %u", opcode);
break;
@@ -2118,9 +2121,27 @@ static int mgmt_encrypt_link(int index, bdaddr_t *dst, bt_hci_result_t cb,
static int mgmt_set_did(int index, uint16_t vendor, uint16_t product,
uint16_t version, uint16_t source)
{
- DBG("index %d vendor %u product %u version %u source %u",
- index, vendor, product, version, source);
- return -ENOSYS;
+ char buf[MGMT_HDR_SIZE + sizeof(struct mgmt_cp_set_device_id)];
+ struct mgmt_hdr *hdr = (void *) buf;
+ struct mgmt_cp_set_device_id *cp = (void *) &buf[sizeof(*hdr)];
+
+ DBG("index %d source %x vendor %x product %x version %x",
+ index, source, vendor, product, version);
+
+ memset(buf, 0, sizeof(buf));
+ hdr->opcode = htobs(MGMT_OP_SET_DEVICE_ID);
+ hdr->len = htobs(sizeof(*cp));
+ hdr->index = htobs(index);
+
+ cp->source = htobs(source);
+ cp->vendor = htobs(vendor);
+ cp->product = htobs(product);
+ cp->version = htobs(version);
+
+ if (write(mgmt_sock, buf, sizeof(buf)) < 0)
+ return -errno;
+
+ return 0;
}
static int mgmt_disable_cod_cache(int index)