Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] bdaddr: Add Marvell support
@ 2014-03-07 22:28 Petri Gynther
  2014-03-10 20:30 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Petri Gynther @ 2014-03-07 22:28 UTC (permalink / raw)
  To: linux-bluetooth

---
 tools/bdaddr.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/tools/bdaddr.c b/tools/bdaddr.c
index e3ffa0e..ee9c01c 100644
--- a/tools/bdaddr.c
+++ b/tools/bdaddr.c
@@ -29,6 +29,7 @@
 #include <errno.h>
 #include <stdlib.h>
 #include <getopt.h>
+#include <unistd.h>
 #include <sys/ioctl.h>
 #include <sys/socket.h>
 
@@ -278,6 +279,30 @@ static int zeevo_write_bd_addr(int dd, bdaddr_t *bdaddr)
 	return 0;
 }
 
+#define OCF_MRVL_WRITE_BD_ADDR		0x0022
+typedef struct {
+	uint8_t		parameter_id;
+	uint8_t		bdaddr_len;
+	bdaddr_t	bdaddr;
+} __attribute__ ((packed)) mrvl_write_bd_addr_cp;
+
+static int mrvl_write_bd_addr(int dd, bdaddr_t *bdaddr)
+{
+	mrvl_write_bd_addr_cp cp;
+
+	memset(&cp, 0, sizeof(cp));
+	cp.parameter_id = 0xFE;
+	cp.bdaddr_len = 6;
+	bacpy(&cp.bdaddr, bdaddr);
+
+	if (hci_send_cmd(dd, OGF_VENDOR_CMD, OCF_MRVL_WRITE_BD_ADDR,
+							sizeof(cp), &cp) < 0)
+		return -1;
+
+	sleep(1);
+	return 0;
+}
+
 static int st_write_bd_addr(int dd, bdaddr_t *bdaddr)
 {
 	return ericsson_store_in_flash(dd, 0xfe, 6, (uint8_t *) bdaddr);
@@ -295,6 +320,7 @@ static struct {
 	{ 18,		zeevo_write_bd_addr,	NULL			},
 	{ 48,		st_write_bd_addr,	generic_reset_device	},
 	{ 57,		ericsson_write_bd_addr,	generic_reset_device	},
+	{ 72,		mrvl_write_bd_addr,	generic_reset_device	},
 	{ 65535,	NULL,			NULL			},
 };
 
-- 
1.9.0.279.gdc9e3eb


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-10 20:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-07 22:28 [PATCH] bdaddr: Add Marvell support Petri Gynther
2014-03-10 20:30 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox