linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC 1/2] Bluetooth: Allow to change type for virtual HCI
@ 2011-11-11 14:14 Emeltchenko Andrei
  2011-11-11 14:14 ` [RFC 2/2] Bluetooth: Do not set HCI_RAW when HS enabled Emeltchenko Andrei
  2011-11-11 14:28 ` [RFC 1/2] Bluetooth: Allow to change type for virtual HCI Marcel Holtmann
  0 siblings, 2 replies; 5+ messages in thread
From: Emeltchenko Andrei @ 2011-11-11 14:14 UTC (permalink / raw)
  To: linux-bluetooth

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

Type can be changed during module loading.
---
 drivers/bluetooth/hci_vhci.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
index 2e302a1..4c4aec3 100644
--- a/drivers/bluetooth/hci_vhci.c
+++ b/drivers/bluetooth/hci_vhci.c
@@ -41,6 +41,8 @@
 
 #define VERSION "1.3"
 
+static ushort type;
+
 struct vhci_data {
 	struct hci_dev *hdev;
 
@@ -239,6 +241,11 @@ static int vhci_open(struct inode *inode, struct file *file)
 	hdev->bus = HCI_VIRTUAL;
 	hdev->driver_data = data;
 
+	if (type > HCI_AMP)
+		type = HCI_BREDR;
+
+	hdev->dev_type = type;
+
 	hdev->open     = vhci_open_dev;
 	hdev->close    = vhci_close_dev;
 	hdev->flush    = vhci_flush;
@@ -303,6 +310,9 @@ static void __exit vhci_exit(void)
 module_init(vhci_init);
 module_exit(vhci_exit);
 
+module_param(type, ushort, 0444);
+MODULE_PARM_DESC(type, "HCI device type");
+
 MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
 MODULE_DESCRIPTION("Bluetooth virtual HCI driver ver " VERSION);
 MODULE_VERSION(VERSION);
-- 
1.7.4.1


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

* [RFC 2/2] Bluetooth: Do not set HCI_RAW when HS enabled
  2011-11-11 14:14 [RFC 1/2] Bluetooth: Allow to change type for virtual HCI Emeltchenko Andrei
@ 2011-11-11 14:14 ` Emeltchenko Andrei
  2011-11-11 14:29   ` Marcel Holtmann
  2011-11-11 14:28 ` [RFC 1/2] Bluetooth: Allow to change type for virtual HCI Marcel Holtmann
  1 sibling, 1 reply; 5+ messages in thread
From: Emeltchenko Andrei @ 2011-11-11 14:14 UTC (permalink / raw)
  To: linux-bluetooth

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

---
 net/bluetooth/hci_core.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 189bada..1b08e4b 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -51,6 +51,7 @@
 
 #include <net/bluetooth/bluetooth.h>
 #include <net/bluetooth/hci_core.h>
+#include <net/bluetooth/l2cap.h>
 
 #define AUTO_OFF_TIMEOUT 2000
 
@@ -570,8 +571,9 @@ int hci_dev_open(__u16 dev)
 	if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks))
 		set_bit(HCI_RAW, &hdev->flags);
 
-	/* Treat all non BR/EDR controllers as raw devices for now */
-	if (hdev->dev_type != HCI_BREDR)
+	/* Treat all non BR/EDR controllers as raw devices if
+	   enable_hs is not set */
+	if (hdev->dev_type != HCI_BREDR && !enable_hs)
 		set_bit(HCI_RAW, &hdev->flags);
 
 	if (hdev->open(hdev)) {
-- 
1.7.4.1


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

* Re: [RFC 1/2] Bluetooth: Allow to change type for virtual HCI
  2011-11-11 14:14 [RFC 1/2] Bluetooth: Allow to change type for virtual HCI Emeltchenko Andrei
  2011-11-11 14:14 ` [RFC 2/2] Bluetooth: Do not set HCI_RAW when HS enabled Emeltchenko Andrei
@ 2011-11-11 14:28 ` Marcel Holtmann
  1 sibling, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2011-11-11 14:28 UTC (permalink / raw)
  To: Emeltchenko Andrei; +Cc: linux-bluetooth

Hi Andrei,

> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> 
> Type can be changed during module loading.

why not just use a bool amp=true/false.

Regards

Marcel



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

* Re: [RFC 2/2] Bluetooth: Do not set HCI_RAW when HS enabled
  2011-11-11 14:14 ` [RFC 2/2] Bluetooth: Do not set HCI_RAW when HS enabled Emeltchenko Andrei
@ 2011-11-11 14:29   ` Marcel Holtmann
  2011-11-11 14:43     ` Emeltchenko Andrei
  0 siblings, 1 reply; 5+ messages in thread
From: Marcel Holtmann @ 2011-11-11 14:29 UTC (permalink / raw)
  To: Emeltchenko Andrei; +Cc: linux-bluetooth

Hi Andrei,

>  net/bluetooth/hci_core.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index 189bada..1b08e4b 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -51,6 +51,7 @@
>  
>  #include <net/bluetooth/bluetooth.h>
>  #include <net/bluetooth/hci_core.h>
> +#include <net/bluetooth/l2cap.h>
>  
>  #define AUTO_OFF_TIMEOUT 2000
>  
> @@ -570,8 +571,9 @@ int hci_dev_open(__u16 dev)
>  	if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks))
>  		set_bit(HCI_RAW, &hdev->flags);
>  
> -	/* Treat all non BR/EDR controllers as raw devices for now */
> -	if (hdev->dev_type != HCI_BREDR)
> +	/* Treat all non BR/EDR controllers as raw devices if
> +	   enable_hs is not set */
> +	if (hdev->dev_type != HCI_BREDR && !enable_hs)
>  		set_bit(HCI_RAW, &hdev->flags);

this is fine with me. Even while the include of l2cap.h is kinda nasty.
Maybe the enable_hs variable actually needs to be moved into hci_*.c
files and not stay inside L2CAP.

Acked-by: Marcel Holtmann <marcel@holtmann.org>

Regards

Marcel



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

* Re: [RFC 2/2] Bluetooth: Do not set HCI_RAW when HS enabled
  2011-11-11 14:29   ` Marcel Holtmann
@ 2011-11-11 14:43     ` Emeltchenko Andrei
  0 siblings, 0 replies; 5+ messages in thread
From: Emeltchenko Andrei @ 2011-11-11 14:43 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

Hi Marcel,

On Fri, Nov 11, 2011 at 11:29:57PM +0900, Marcel Holtmann wrote:
> Hi Andrei,
> 
> >  net/bluetooth/hci_core.c |    6 ++++--
> >  1 files changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> > index 189bada..1b08e4b 100644
> > --- a/net/bluetooth/hci_core.c
> > +++ b/net/bluetooth/hci_core.c
> > @@ -51,6 +51,7 @@
> >  
> >  #include <net/bluetooth/bluetooth.h>
> >  #include <net/bluetooth/hci_core.h>
> > +#include <net/bluetooth/l2cap.h>
> >  
> >  #define AUTO_OFF_TIMEOUT 2000
> >  
> > @@ -570,8 +571,9 @@ int hci_dev_open(__u16 dev)
> >  	if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks))
> >  		set_bit(HCI_RAW, &hdev->flags);
> >  
> > -	/* Treat all non BR/EDR controllers as raw devices for now */
> > -	if (hdev->dev_type != HCI_BREDR)
> > +	/* Treat all non BR/EDR controllers as raw devices if
> > +	   enable_hs is not set */
> > +	if (hdev->dev_type != HCI_BREDR && !enable_hs)
> >  		set_bit(HCI_RAW, &hdev->flags);
> 
> this is fine with me. Even while the include of l2cap.h is kinda nasty.
> Maybe the enable_hs variable actually needs to be moved into hci_*.c
> files and not stay inside L2CAP.

I agree that moving enable_hs to hci header is better. Will resend with
this change.

Best regards 
Andrei Emeltchenko 

> 
> Acked-by: Marcel Holtmann <marcel@holtmann.org>
> 
> Regards
> 
> Marcel
> 
> 

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

end of thread, other threads:[~2011-11-11 14:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-11 14:14 [RFC 1/2] Bluetooth: Allow to change type for virtual HCI Emeltchenko Andrei
2011-11-11 14:14 ` [RFC 2/2] Bluetooth: Do not set HCI_RAW when HS enabled Emeltchenko Andrei
2011-11-11 14:29   ` Marcel Holtmann
2011-11-11 14:43     ` Emeltchenko Andrei
2011-11-11 14:28 ` [RFC 1/2] Bluetooth: Allow to change type for virtual HCI 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).