diff --git a/lib/mgmt.h b/lib/mgmt.h
index f3bc6da..c9b0f1a 100644
--- a/lib/mgmt.h
+++ b/lib/mgmt.h
struct mgmt_addr_info addr;
} __packed;
+#define MGMT_OP_SET_DEVICE_ID 0x0028
+struct mgmt_cp_set_device_id {
+ uint16_t source;
+ uint16_t vendor;
+ uint16_t product;
+ uint16_t version;
+} __packed;
+
#define MGMT_EV_CMD_COMPLETE 0x0001
struct mgmt_ev_cmd_complete {
uint16_t opcode;
"Confirm Name",
"Block Device",
"Unblock Device",
+ "Set Device ID",
};
static const char *mgmt_ev[] = {
diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
index c24757c..c08117f 100644
--- a/plugins/mgmtops.c
+++ b/plugins/mgmtops.c
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;
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)