linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH hciemu v2 1/2] Process Read Local AMP Info in hciemu
@ 2011-12-08  8:54 Emeltchenko Andrei
  2011-12-08  8:54 ` [PATCH hciemu v2 2/2] Print features for AMP devices Emeltchenko Andrei
  2011-12-08  9:40 ` [PATCH hciemu v2 1/2] Process Read Local AMP Info in hciemu Johan Hedberg
  0 siblings, 2 replies; 9+ messages in thread
From: Emeltchenko Andrei @ 2011-12-08  8:54 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Add processing of Read Local AMP Info in hciemu, the values returned are
used to emulate AMP HCI.
---
 test/hciemu.c |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/test/hciemu.c b/test/hciemu.c
index f2879ba..ccd6cc3 100644
--- a/test/hciemu.c
+++ b/test/hciemu.c
@@ -45,6 +45,7 @@
 #include <bluetooth/bluetooth.h>
 #include <bluetooth/hci.h>
 #include <bluetooth/hci_lib.h>
+#include <bluetooth/l2cap.h>
 
 #define VHCI_DEV		"/dev/vhci"
 
@@ -779,6 +780,36 @@ static void hci_info_param(uint16_t ocf, int plen, uint8_t *data)
 	}
 }
 
+static void hci_status_param(uint16_t ocf, int plen, uint8_t *data)
+{
+	read_local_amp_info_rp ai;
+	uint8_t status;
+
+	const uint16_t ogf = OGF_STATUS_PARAM;
+
+	switch (ocf) {
+	case OCF_READ_LOCAL_AMP_INFO:
+		memset(&ai, 0, sizeof(ai));
+
+		/* BT only */
+		ai.amp_status = 0x01;
+		ai.max_pdu_size = htobl(L2CAP_DEFAULT_MTU);
+		ai.controller_type = HCI_AMP;
+		ai.max_amp_assoc_length = htobl(HCI_MAX_ACL_SIZE);
+		/* No flushing at all */
+		ai.max_flush_timeout = 0xFFFFFFFF;
+		ai.best_effort_flush_timeout = 0xFFFFFFFF;
+
+		command_complete(ogf, ocf, sizeof(ai), &ai);
+		break;
+
+	default:
+		status = 0x01;
+		command_complete(ogf, ocf, 1, &status);
+		break;
+	}
+}
+
 static void hci_command(uint8_t *data)
 {
 	hci_command_hdr *ch;
@@ -808,6 +839,10 @@ static void hci_command(uint8_t *data)
 	case OGF_INFO_PARAM:
 		hci_info_param(ocf, ch->plen, ptr);
 		break;
+
+	case OGF_STATUS_PARAM:
+		hci_status_param(ocf, ch->plen, ptr);
+		break;
 	}
 }
 
-- 
1.7.4.1


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

end of thread, other threads:[~2011-12-10 15:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-08  8:54 [PATCH hciemu v2 1/2] Process Read Local AMP Info in hciemu Emeltchenko Andrei
2011-12-08  8:54 ` [PATCH hciemu v2 2/2] Print features for AMP devices Emeltchenko Andrei
2011-12-08  9:40 ` [PATCH hciemu v2 1/2] Process Read Local AMP Info in hciemu Johan Hedberg
2011-12-08 14:58   ` Frederic Danis
2011-12-09  8:16     ` Emeltchenko Andrei
2011-12-09  8:42       ` Frederic Danis
2011-12-09  8:48         ` Johan Hedberg
2011-12-10 15:37           ` Syam Sidhardhan
2011-12-09  8:43       ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).