linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Process Read Local AMP Info in hciemu
@ 2011-12-07 13:03 Emeltchenko Andrei
  2011-12-07 13:03 ` [PATCH 2/2] Print features for AMP devices Emeltchenko Andrei
  2011-12-08  8:11 ` [PATCH 1/2] Process Read Local AMP Info in hciemu Marcel Holtmann
  0 siblings, 2 replies; 5+ messages in thread
From: Emeltchenko Andrei @ 2011-12-07 13:03 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 |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/test/hciemu.c b/test/hciemu.c
index 38918f5..1022eb5 100644
--- a/test/hciemu.c
+++ b/test/hciemu.c
@@ -44,6 +44,7 @@
 #include <bluetooth/bluetooth.h>
 #include <bluetooth/hci.h>
 #include <bluetooth/hci_lib.h>
+#include <bluetooth/l2cap.h>
 
 #define VHCI_DEV		"/dev/vhci"
 
@@ -777,6 +778,35 @@ static void hci_info_param(uint16_t ocf, int plen, uint8_t *data)
 		break;
 	}
 }
+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)
 {
@@ -807,6 +837,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] 5+ messages in thread

* [PATCH 2/2] Print features for AMP devices
  2011-12-07 13:03 [PATCH 1/2] Process Read Local AMP Info in hciemu Emeltchenko Andrei
@ 2011-12-07 13:03 ` Emeltchenko Andrei
  2011-12-08  8:11 ` [PATCH 1/2] Process Read Local AMP Info in hciemu Marcel Holtmann
  1 sibling, 0 replies; 5+ messages in thread
From: Emeltchenko Andrei @ 2011-12-07 13:03 UTC (permalink / raw)
  To: linux-bluetooth

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

Check for HCI device type, the magic shift is due to dev type is packed
to dev_info type.
---
 tools/hciconfig.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/hciconfig.c b/tools/hciconfig.c
index 35b80b1..a7249db 100644
--- a/tools/hciconfig.c
+++ b/tools/hciconfig.c
@@ -1870,7 +1870,7 @@ static void print_dev_info(int ctl, struct hci_dev_info *di)
 		st->byte_tx, st->acl_tx, st->sco_tx, st->cmd_tx, st->err_tx);
 
 	if (all && !hci_test_bit(HCI_RAW, &di->flags) &&
-			bacmp(&di->bdaddr, BDADDR_ANY)) {
+			(bacmp(&di->bdaddr, BDADDR_ANY) || (di->type >> 4))) {
 		print_dev_features(di, 0);
 		print_pkt_type(di);
 		print_link_policy(di);
-- 
1.7.4.1


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

* Re: [PATCH 1/2] Process Read Local AMP Info in hciemu
  2011-12-07 13:03 [PATCH 1/2] Process Read Local AMP Info in hciemu Emeltchenko Andrei
  2011-12-07 13:03 ` [PATCH 2/2] Print features for AMP devices Emeltchenko Andrei
@ 2011-12-08  8:11 ` Marcel Holtmann
  2011-12-08  8:32   ` Emeltchenko Andrei
  1 sibling, 1 reply; 5+ messages in thread
From: Marcel Holtmann @ 2011-12-08  8:11 UTC (permalink / raw)
  To: Emeltchenko Andrei; +Cc: linux-bluetooth

Hi Andrei,

> Add processing of Read Local AMP Info in hciemu, the values returned are
> used to emulate AMP HCI.
> ---
>  test/hciemu.c |   34 ++++++++++++++++++++++++++++++++++
>  1 files changed, 34 insertions(+), 0 deletions(-)
> 
> diff --git a/test/hciemu.c b/test/hciemu.c
> index 38918f5..1022eb5 100644
> --- a/test/hciemu.c
> +++ b/test/hciemu.c
> @@ -44,6 +44,7 @@
>  #include <bluetooth/bluetooth.h>
>  #include <bluetooth/hci.h>
>  #include <bluetooth/hci_lib.h>
> +#include <bluetooth/l2cap.h>
>  
>  #define VHCI_DEV		"/dev/vhci"
>  
> @@ -777,6 +778,35 @@ static void hci_info_param(uint16_t ocf, int plen, uint8_t *data)
>  		break;
>  	}
>  }
> +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:

one too many indentation here.

Regards

Marcel



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

* Re: [PATCH 1/2] Process Read Local AMP Info in hciemu
  2011-12-08  8:11 ` [PATCH 1/2] Process Read Local AMP Info in hciemu Marcel Holtmann
@ 2011-12-08  8:32   ` Emeltchenko Andrei
  2011-12-08  8:41     ` Marcel Holtmann
  0 siblings, 1 reply; 5+ messages in thread
From: Emeltchenko Andrei @ 2011-12-08  8:32 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

Hi Marcel,

On Thu, Dec 08, 2011 at 10:11:51AM +0200, Marcel Holtmann wrote:
> Hi Andrei,
> 
> > Add processing of Read Local AMP Info in hciemu, the values returned are
> > used to emulate AMP HCI.
> > ---
> >  test/hciemu.c |   34 ++++++++++++++++++++++++++++++++++
> >  1 files changed, 34 insertions(+), 0 deletions(-)
> > 
> > diff --git a/test/hciemu.c b/test/hciemu.c
> > index 38918f5..1022eb5 100644
> > --- a/test/hciemu.c
> > +++ b/test/hciemu.c
> > @@ -44,6 +44,7 @@
> >  #include <bluetooth/bluetooth.h>
> >  #include <bluetooth/hci.h>
> >  #include <bluetooth/hci_lib.h>
> > +#include <bluetooth/l2cap.h>
> >  
> >  #define VHCI_DEV		"/dev/vhci"
> >  
> > @@ -777,6 +778,35 @@ static void hci_info_param(uint16_t ocf, int plen, uint8_t *data)
> >  		break;
> >  	}
> >  }
> > +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:
> 
> one too many indentation here.

will fix this. BTW: What do you think about current approach that in this
test tool I always reply for this AMP-specific command. Shall we have
command-line parameter for controller type?

Best regards 
Andrei Emeltchenko 

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

* Re: [PATCH 1/2] Process Read Local AMP Info in hciemu
  2011-12-08  8:32   ` Emeltchenko Andrei
@ 2011-12-08  8:41     ` Marcel Holtmann
  0 siblings, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2011-12-08  8:41 UTC (permalink / raw)
  To: Emeltchenko Andrei; +Cc: linux-bluetooth

Hi Andrei,

> > > Add processing of Read Local AMP Info in hciemu, the values returned are
> > > used to emulate AMP HCI.
> > > ---
> > >  test/hciemu.c |   34 ++++++++++++++++++++++++++++++++++
> > >  1 files changed, 34 insertions(+), 0 deletions(-)
> > > 
> > > diff --git a/test/hciemu.c b/test/hciemu.c
> > > index 38918f5..1022eb5 100644
> > > --- a/test/hciemu.c
> > > +++ b/test/hciemu.c
> > > @@ -44,6 +44,7 @@
> > >  #include <bluetooth/bluetooth.h>
> > >  #include <bluetooth/hci.h>
> > >  #include <bluetooth/hci_lib.h>
> > > +#include <bluetooth/l2cap.h>
> > >  
> > >  #define VHCI_DEV		"/dev/vhci"
> > >  
> > > @@ -777,6 +778,35 @@ static void hci_info_param(uint16_t ocf, int plen, uint8_t *data)
> > >  		break;
> > >  	}
> > >  }
> > > +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:
> > 
> > one too many indentation here.
> 
> will fix this. BTW: What do you think about current approach that in this
> test tool I always reply for this AMP-specific command. Shall we have
> command-line parameter for controller type?

for now this might be fine, but yes, we should have some command line
options to tell us to emulate a BR/EDR controller vs AMP controller.

Regards

Marcel



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

end of thread, other threads:[~2011-12-08  8:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-07 13:03 [PATCH 1/2] Process Read Local AMP Info in hciemu Emeltchenko Andrei
2011-12-07 13:03 ` [PATCH 2/2] Print features for AMP devices Emeltchenko Andrei
2011-12-08  8:11 ` [PATCH 1/2] Process Read Local AMP Info in hciemu Marcel Holtmann
2011-12-08  8:32   ` Emeltchenko Andrei
2011-12-08  8:41     ` Marcel Holtmann

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).