Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCHv2] Bluetooth: new sockopt to enter active state when sending data
@ 2010-08-10 13:48 Emeltchenko Andrei
  2010-08-12 11:31 ` Marcel Holtmann
  0 siblings, 1 reply; 4+ messages in thread
From: Emeltchenko Andrei @ 2010-08-10 13:48 UTC (permalink / raw)
  To: linux-bluetooth

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

Patch adds new socket option to enter active state when sending
data. Modified version of Fabien Chevalier patch (Sep/2008).
Discussions:
http://www.spinics.net/lists/bluez-devel/msg00567.html
http://www.spinics.net/lists/linux-bluetooth/msg03765.html

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>
---
 include/net/bluetooth/hci_core.h |    1 +
 include/net/bluetooth/l2cap.h    |    2 ++
 net/bluetooth/hci_conn.c         |    7 ++++++-
 net/bluetooth/l2cap.c            |   15 +++++++++++++++
 4 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index e42f6ed..477a492 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -178,6 +178,7 @@ struct hci_conn {
 	__u8             auth_type;
 	__u8             sec_level;
 	__u8             power_save;
+	__u8             force_active;
 	__u16            disc_timeout;
 	unsigned long	 pend;
 
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 7c695bf..540cca7 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -74,6 +74,8 @@ struct l2cap_conninfo {
 #define L2CAP_LM_RELIABLE	0x0010
 #define L2CAP_LM_SECURE		0x0020
 
+#define L2CAP_FORCE_ACTIVE_MODE	0x04
+
 /* L2CAP command codes */
 #define L2CAP_COMMAND_REJ	0x01
 #define L2CAP_CONN_REQ		0x02
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 800b6b9..11fc44a 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -214,6 +214,8 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst)
 	conn->auth_type = HCI_AT_GENERAL_BONDING;
 
 	conn->power_save = 1;
+	/* Do not enter active state by default */ 
+	conn->force_active = 0;
 	conn->disc_timeout = HCI_DISCONN_TIMEOUT;
 
 	switch (type) {
@@ -505,7 +507,10 @@ void hci_conn_enter_active_mode(struct hci_conn *conn)
 	if (test_bit(HCI_RAW, &hdev->flags))
 		return;
 
-	if (conn->mode != HCI_CM_SNIFF || !conn->power_save)
+	if (conn->mode != HCI_CM_SNIFF)
+		goto timer;
+
+	if (!conn->power_save && !conn->force_active)
 		goto timer;
 
 	if (!test_and_set_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->pend)) {
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index cf3c407..5328e82 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -1909,6 +1909,15 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __us
 		l2cap_pi(sk)->force_reliable = (opt & L2CAP_LM_RELIABLE);
 		break;
 
+	case L2CAP_FORCE_ACTIVE_MODE:
+		if (get_user(opt, (u32 __user *) optval)) {
+			err = -EFAULT;
+			break;
+		}
+		
+		l2cap_pi(sk)->conn->hcon->force_active = opt;
+		break;
+
 	default:
 		err = -ENOPROTOOPT;
 		break;
@@ -2058,6 +2067,12 @@ static int l2cap_sock_getsockopt_old(struct socket *sock, int optname, char __us
 
 		break;
 
+	case L2CAP_FORCE_ACTIVE_MODE:
+		if (put_user(l2cap_pi(sk)->conn->hcon->force_active,
+					(u32 __user *) optval))
+			err = -EFAULT;
+		break;
+
 	default:
 		err = -ENOPROTOOPT;
 		break;
-- 
1.7.0.4


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

* Re: [PATCHv2] Bluetooth: new sockopt to enter active state when sending data
  2010-08-10 13:48 [PATCHv2] Bluetooth: new sockopt to enter active state when sending data Emeltchenko Andrei
@ 2010-08-12 11:31 ` Marcel Holtmann
  2010-08-12 12:25   ` Andrei Emeltchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Marcel Holtmann @ 2010-08-12 11:31 UTC (permalink / raw)
  To: Emeltchenko Andrei; +Cc: linux-bluetooth

Hi Andrei,

> Patch adds new socket option to enter active state when sending
> data. Modified version of Fabien Chevalier patch (Sep/2008).
> Discussions:
> http://www.spinics.net/lists/bluez-devel/msg00567.html
> http://www.spinics.net/lists/linux-bluetooth/msg03765.html
> 
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>
> ---
>  include/net/bluetooth/hci_core.h |    1 +
>  include/net/bluetooth/l2cap.h    |    2 ++
>  net/bluetooth/hci_conn.c         |    7 ++++++-
>  net/bluetooth/l2cap.c            |   15 +++++++++++++++
>  4 files changed, 24 insertions(+), 1 deletions(-)
> 
> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> index e42f6ed..477a492 100644
> --- a/include/net/bluetooth/hci_core.h
> +++ b/include/net/bluetooth/hci_core.h
> @@ -178,6 +178,7 @@ struct hci_conn {
>  	__u8             auth_type;
>  	__u8             sec_level;
>  	__u8             power_save;
> +	__u8             force_active;
>  	__u16            disc_timeout;
>  	unsigned long	 pend;
>  
> diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
> index 7c695bf..540cca7 100644
> --- a/include/net/bluetooth/l2cap.h
> +++ b/include/net/bluetooth/l2cap.h
> @@ -74,6 +74,8 @@ struct l2cap_conninfo {
>  #define L2CAP_LM_RELIABLE	0x0010
>  #define L2CAP_LM_SECURE		0x0020
>  
> +#define L2CAP_FORCE_ACTIVE_MODE	0x04
> +
>  /* L2CAP command codes */
>  #define L2CAP_COMMAND_REJ	0x01
>  #define L2CAP_CONN_REQ		0x02
> diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
> index 800b6b9..11fc44a 100644
> --- a/net/bluetooth/hci_conn.c
> +++ b/net/bluetooth/hci_conn.c
> @@ -214,6 +214,8 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst)
>  	conn->auth_type = HCI_AT_GENERAL_BONDING;
>  
>  	conn->power_save = 1;
> +	/* Do not enter active state by default */ 
> +	conn->force_active = 0;
>  	conn->disc_timeout = HCI_DISCONN_TIMEOUT;
>  
>  	switch (type) {
> @@ -505,7 +507,10 @@ void hci_conn_enter_active_mode(struct hci_conn *conn)
>  	if (test_bit(HCI_RAW, &hdev->flags))
>  		return;
>  
> -	if (conn->mode != HCI_CM_SNIFF || !conn->power_save)
> +	if (conn->mode != HCI_CM_SNIFF)
> +		goto timer;
> +
> +	if (!conn->power_save && !conn->force_active)
>  		goto timer;
>  
>  	if (!test_and_set_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->pend)) {
> diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
> index cf3c407..5328e82 100644
> --- a/net/bluetooth/l2cap.c
> +++ b/net/bluetooth/l2cap.c
> @@ -1909,6 +1909,15 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __us
>  		l2cap_pi(sk)->force_reliable = (opt & L2CAP_LM_RELIABLE);
>  		break;
>  
> +	case L2CAP_FORCE_ACTIVE_MODE:
> +		if (get_user(opt, (u32 __user *) optval)) {
> +			err = -EFAULT;
> +			break;
> +		}
> +		
> +		l2cap_pi(sk)->conn->hcon->force_active = opt;
> +		break;
> +
>  	default:
>  		err = -ENOPROTOOPT;
>  		break;
> @@ -2058,6 +2067,12 @@ static int l2cap_sock_getsockopt_old(struct socket *sock, int optname, char __us
>  
>  		break;
>  
> +	case L2CAP_FORCE_ACTIVE_MODE:
> +		if (put_user(l2cap_pi(sk)->conn->hcon->force_active,
> +					(u32 __user *) optval))
> +			err = -EFAULT;
> +		break;
> +
>  	default:
>  		err = -ENOPROTOOPT;
>  		break;

I think that I said this before. Why do you think that adding a new
socket option to something called _old is a good idea? I made it pretty
clear in the code that it is an OLD interface.

I want this on the SOL_BLUETOOTH level with a proper new socket option.
And we might even consider doing it like BT_SECURITY where create the
struct to potentially add other flags later.

So why not doing BT_POWER or something like that.

And in addition you need to store these values on a per L2CAP or RFCOMM
socket. You can not just go ahead and mess inside hci_conn via an L2CAP
socket option.

Regards

Marcel




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

* Re: [PATCHv2] Bluetooth: new sockopt to enter active state when sending data
  2010-08-12 11:31 ` Marcel Holtmann
@ 2010-08-12 12:25   ` Andrei Emeltchenko
  2010-08-12 13:07     ` Marcel Holtmann
  0 siblings, 1 reply; 4+ messages in thread
From: Andrei Emeltchenko @ 2010-08-12 12:25 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

Hi Marcel,

On Thu, Aug 12, 2010 at 2:31 PM, Marcel Holtmann <marcel@holtmann.org> wrot=
e:
> Hi Andrei,
>
>> Patch adds new socket option to enter active state when sending
>> data. Modified version of Fabien Chevalier patch (Sep/2008).
>> Discussions:
>> http://www.spinics.net/lists/bluez-devel/msg00567.html
>> http://www.spinics.net/lists/linux-bluetooth/msg03765.html
>>
>> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>
>> ---
>> =A0include/net/bluetooth/hci_core.h | =A0 =A01 +
>> =A0include/net/bluetooth/l2cap.h =A0 =A0| =A0 =A02 ++
>> =A0net/bluetooth/hci_conn.c =A0 =A0 =A0 =A0 | =A0 =A07 ++++++-
>> =A0net/bluetooth/l2cap.c =A0 =A0 =A0 =A0 =A0 =A0| =A0 15 +++++++++++++++
>> =A04 files changed, 24 insertions(+), 1 deletions(-)
>>
>> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hc=
i_core.h
>> index e42f6ed..477a492 100644
>> --- a/include/net/bluetooth/hci_core.h
>> +++ b/include/net/bluetooth/hci_core.h
>> @@ -178,6 +178,7 @@ struct hci_conn {
>> =A0 =A0 =A0 __u8 =A0 =A0 =A0 =A0 =A0 =A0 auth_type;
>> =A0 =A0 =A0 __u8 =A0 =A0 =A0 =A0 =A0 =A0 sec_level;
>> =A0 =A0 =A0 __u8 =A0 =A0 =A0 =A0 =A0 =A0 power_save;
>> + =A0 =A0 __u8 =A0 =A0 =A0 =A0 =A0 =A0 force_active;
>> =A0 =A0 =A0 __u16 =A0 =A0 =A0 =A0 =A0 =A0disc_timeout;
>> =A0 =A0 =A0 unsigned long =A0 =A0pend;
>>
>> diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap=
.h
>> index 7c695bf..540cca7 100644
>> --- a/include/net/bluetooth/l2cap.h
>> +++ b/include/net/bluetooth/l2cap.h
>> @@ -74,6 +74,8 @@ struct l2cap_conninfo {
>> =A0#define L2CAP_LM_RELIABLE =A0 =A00x0010
>> =A0#define L2CAP_LM_SECURE =A0 =A0 =A0 =A0 =A0 =A0 =A00x0020
>>
>> +#define L2CAP_FORCE_ACTIVE_MODE =A0 =A0 =A00x04
>> +
>> =A0/* L2CAP command codes */
>> =A0#define L2CAP_COMMAND_REJ =A0 =A00x01
>> =A0#define L2CAP_CONN_REQ =A0 =A0 =A0 =A0 =A0 =A0 =A0 0x02
>> diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
>> index 800b6b9..11fc44a 100644
>> --- a/net/bluetooth/hci_conn.c
>> +++ b/net/bluetooth/hci_conn.c
>> @@ -214,6 +214,8 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, =
int type, bdaddr_t *dst)
>> =A0 =A0 =A0 conn->auth_type =3D HCI_AT_GENERAL_BONDING;
>>
>> =A0 =A0 =A0 conn->power_save =3D 1;
>> + =A0 =A0 /* Do not enter active state by default */
>> + =A0 =A0 conn->force_active =3D 0;
>> =A0 =A0 =A0 conn->disc_timeout =3D HCI_DISCONN_TIMEOUT;
>>
>> =A0 =A0 =A0 switch (type) {
>> @@ -505,7 +507,10 @@ void hci_conn_enter_active_mode(struct hci_conn *co=
nn)
>> =A0 =A0 =A0 if (test_bit(HCI_RAW, &hdev->flags))
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 return;
>>
>> - =A0 =A0 if (conn->mode !=3D HCI_CM_SNIFF || !conn->power_save)
>> + =A0 =A0 if (conn->mode !=3D HCI_CM_SNIFF)
>> + =A0 =A0 =A0 =A0 =A0 =A0 goto timer;
>> +
>> + =A0 =A0 if (!conn->power_save && !conn->force_active)
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto timer;
>>
>> =A0 =A0 =A0 if (!test_and_set_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->pend=
)) {
>> diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
>> index cf3c407..5328e82 100644
>> --- a/net/bluetooth/l2cap.c
>> +++ b/net/bluetooth/l2cap.c
>> @@ -1909,6 +1909,15 @@ static int l2cap_sock_setsockopt_old(struct socke=
t *sock, int optname, char __us
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 l2cap_pi(sk)->force_reliable =3D (opt & L2CA=
P_LM_RELIABLE);
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
>>
>> + =A0 =A0 case L2CAP_FORCE_ACTIVE_MODE:
>> + =A0 =A0 =A0 =A0 =A0 =A0 if (get_user(opt, (u32 __user *) optval)) {
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 err =3D -EFAULT;
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
>> + =A0 =A0 =A0 =A0 =A0 =A0 }
>> +
>> + =A0 =A0 =A0 =A0 =A0 =A0 l2cap_pi(sk)->conn->hcon->force_active =3D opt=
;
>> + =A0 =A0 =A0 =A0 =A0 =A0 break;
>> +
>> =A0 =A0 =A0 default:
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 err =3D -ENOPROTOOPT;
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
>> @@ -2058,6 +2067,12 @@ static int l2cap_sock_getsockopt_old(struct socke=
t *sock, int optname, char __us
>>
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
>>
>> + =A0 =A0 case L2CAP_FORCE_ACTIVE_MODE:
>> + =A0 =A0 =A0 =A0 =A0 =A0 if (put_user(l2cap_pi(sk)->conn->hcon->force_a=
ctive,
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 (u32 __user *) optval))
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 err =3D -EFAULT;
>> + =A0 =A0 =A0 =A0 =A0 =A0 break;
>> +
>> =A0 =A0 =A0 default:
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 err =3D -ENOPROTOOPT;
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
>
> I think that I said this before. Why do you think that adding a new
> socket option to something called _old is a good idea? I made it pretty
> clear in the code that it is an OLD interface.
>
> I want this on the SOL_BLUETOOTH level with a proper new socket option.
> And we might even consider doing it like BT_SECURITY where create the
> struct to potentially add other flags later.

This can be done.

> So why not doing BT_POWER or something like that.
>
> And in addition you need to store these values on a per L2CAP or RFCOMM
> socket. You can not just go ahead and mess inside hci_conn via an L2CAP
> socket option.

I felt that Sniff Mode is a property of ACL link and not L2CAP or RFCOMM so=
cket.

There is already code in the same functions which use the same
technique to access
following hci_conn fields:

l2cap_pi(sk)->conn->hcon->handle
l2cap_pi(sk)->conn->hcon->dev_class

Regards,
Andrei

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

* Re: [PATCHv2] Bluetooth: new sockopt to enter active state when sending data
  2010-08-12 12:25   ` Andrei Emeltchenko
@ 2010-08-12 13:07     ` Marcel Holtmann
  0 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2010-08-12 13:07 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

Hi Andrei,

> >> Patch adds new socket option to enter active state when sending
> >> data. Modified version of Fabien Chevalier patch (Sep/2008).
> >> Discussions:
> >> http://www.spinics.net/lists/bluez-devel/msg00567.html
> >> http://www.spinics.net/lists/linux-bluetooth/msg03765.html
> >>
> >> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>
> >> ---
> >>  include/net/bluetooth/hci_core.h |    1 +
> >>  include/net/bluetooth/l2cap.h    |    2 ++
> >>  net/bluetooth/hci_conn.c         |    7 ++++++-
> >>  net/bluetooth/l2cap.c            |   15 +++++++++++++++
> >>  4 files changed, 24 insertions(+), 1 deletions(-)
> >>
> >> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> >> index e42f6ed..477a492 100644
> >> --- a/include/net/bluetooth/hci_core.h
> >> +++ b/include/net/bluetooth/hci_core.h
> >> @@ -178,6 +178,7 @@ struct hci_conn {
> >>       __u8             auth_type;
> >>       __u8             sec_level;
> >>       __u8             power_save;
> >> +     __u8             force_active;
> >>       __u16            disc_timeout;
> >>       unsigned long    pend;
> >>
> >> diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
> >> index 7c695bf..540cca7 100644
> >> --- a/include/net/bluetooth/l2cap.h
> >> +++ b/include/net/bluetooth/l2cap.h
> >> @@ -74,6 +74,8 @@ struct l2cap_conninfo {
> >>  #define L2CAP_LM_RELIABLE    0x0010
> >>  #define L2CAP_LM_SECURE              0x0020
> >>
> >> +#define L2CAP_FORCE_ACTIVE_MODE      0x04
> >> +
> >>  /* L2CAP command codes */
> >>  #define L2CAP_COMMAND_REJ    0x01
> >>  #define L2CAP_CONN_REQ               0x02
> >> diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
> >> index 800b6b9..11fc44a 100644
> >> --- a/net/bluetooth/hci_conn.c
> >> +++ b/net/bluetooth/hci_conn.c
> >> @@ -214,6 +214,8 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst)
> >>       conn->auth_type = HCI_AT_GENERAL_BONDING;
> >>
> >>       conn->power_save = 1;
> >> +     /* Do not enter active state by default */
> >> +     conn->force_active = 0;
> >>       conn->disc_timeout = HCI_DISCONN_TIMEOUT;
> >>
> >>       switch (type) {
> >> @@ -505,7 +507,10 @@ void hci_conn_enter_active_mode(struct hci_conn *conn)
> >>       if (test_bit(HCI_RAW, &hdev->flags))
> >>               return;
> >>
> >> -     if (conn->mode != HCI_CM_SNIFF || !conn->power_save)
> >> +     if (conn->mode != HCI_CM_SNIFF)
> >> +             goto timer;
> >> +
> >> +     if (!conn->power_save && !conn->force_active)
> >>               goto timer;
> >>
> >>       if (!test_and_set_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->pend)) {
> >> diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
> >> index cf3c407..5328e82 100644
> >> --- a/net/bluetooth/l2cap.c
> >> +++ b/net/bluetooth/l2cap.c
> >> @@ -1909,6 +1909,15 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __us
> >>               l2cap_pi(sk)->force_reliable = (opt & L2CAP_LM_RELIABLE);
> >>               break;
> >>
> >> +     case L2CAP_FORCE_ACTIVE_MODE:
> >> +             if (get_user(opt, (u32 __user *) optval)) {
> >> +                     err = -EFAULT;
> >> +                     break;
> >> +             }
> >> +
> >> +             l2cap_pi(sk)->conn->hcon->force_active = opt;
> >> +             break;
> >> +
> >>       default:
> >>               err = -ENOPROTOOPT;
> >>               break;
> >> @@ -2058,6 +2067,12 @@ static int l2cap_sock_getsockopt_old(struct socket *sock, int optname, char __us
> >>
> >>               break;
> >>
> >> +     case L2CAP_FORCE_ACTIVE_MODE:
> >> +             if (put_user(l2cap_pi(sk)->conn->hcon->force_active,
> >> +                                     (u32 __user *) optval))
> >> +                     err = -EFAULT;
> >> +             break;
> >> +
> >>       default:
> >>               err = -ENOPROTOOPT;
> >>               break;
> >
> > I think that I said this before. Why do you think that adding a new
> > socket option to something called _old is a good idea? I made it pretty
> > clear in the code that it is an OLD interface.
> >
> > I want this on the SOL_BLUETOOTH level with a proper new socket option.
> > And we might even consider doing it like BT_SECURITY where create the
> > struct to potentially add other flags later.
> 
> This can be done.
> 
> > So why not doing BT_POWER or something like that.
> >
> > And in addition you need to store these values on a per L2CAP or RFCOMM
> > socket. You can not just go ahead and mess inside hci_conn via an L2CAP
> > socket option.
> 
> I felt that Sniff Mode is a property of ACL link and not L2CAP or RFCOMM socket.
> 
> There is already code in the same functions which use the same
> technique to access
> following hci_conn fields:
> 
> l2cap_pi(sk)->conn->hcon->handle
> l2cap_pi(sk)->conn->hcon->dev_class

that is for pure read-only access. If multiple L2CAP sockets are open
you have to be smart about the policy you put onto your ACL link.

Regards

Marcel



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

end of thread, other threads:[~2010-08-12 13:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-10 13:48 [PATCHv2] Bluetooth: new sockopt to enter active state when sending data Emeltchenko Andrei
2010-08-12 11:31 ` Marcel Holtmann
2010-08-12 12:25   ` Andrei Emeltchenko
2010-08-12 13:07     ` Marcel Holtmann

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