All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bluez-devel] Support for Clock offset event
       [not found] ` <5.1.0.14.2.20030307165419.01bb5668@mail1.qualcomm.com>
@ 2003-03-11 17:53   ` Wolfgang Heidrich
  2003-03-12  0:15     ` Marcel Holtmann
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Heidrich @ 2003-03-11 17:53 UTC (permalink / raw)
  To: BlueZ Mailing List

[-- Attachment #1: Type: text/plain, Size: 735 bytes --]

Hello,

I added support for the clock offset event to bluez-kernel. The
attached patch is very simple and applies cleanly to bluez-kernel-2.3.
If you like, you can commit it. Then bluez gets one more step more
complete.
The clock information in the corresponding
entry of the inquiry cache is updated in case of a clock offset event.

Clock offset is important for very fast connection establishment.

Regards

-- 
Fraunhofer Einrichtung für Systeme der Kommunikationstechnik (ESK)

Wolfgang Heidrich        	  	Hansastraße 32
Dipl.-Ing.                      	80686 München / Germany
                                  	Phone :  +49(0)89-547088-376
E-Mail: wolfgang.heidrich@esk.fhg.de   	Fax   :  +49(0)89-547088-221

[-- Attachment #2: patch_clk_offset --]
[-- Type: text/plain, Size: 1840 bytes --]

diff -Naur bluez-kernel-2.3/core/hci_event.c bluez-kernel-2.3-new/core/hci_event.c
--- bluez-kernel-2.3/core/hci_event.c	Fri Nov  1 18:48:51 2002
+++ bluez-kernel-2.3-new/core/hci_event.c	Tue Mar 11 18:28:31 2003
@@ -711,6 +711,28 @@
 	hci_dev_unlock(hdev);
 }
 
+/* New clock offset */
+static inline void hci_clock_offset_evt(struct hci_dev *hdev, struct sk_buff *skb)
+{
+	evt_clock_offset *eco=(evt_clock_offset *) skb->data;
+	struct hci_conn *conn = NULL;
+	__u16 handle = __le16_to_cpu(eco->handle);
+        struct inquiry_entry *e;
+
+	BT_DBG("%s status %d", hdev->name, eco->status);
+
+	hci_dev_lock(hdev);
+
+	conn = conn_hash_lookup_handle(hdev, handle);
+	if (conn && (!eco->status) && ( e = inquiry_cache_lookup(hdev, &conn->dst) ) ) {
+	/* update only existing entries, because we only get the clock offset without further information */
+		e->info.clock_offset=eco->offset;
+		e->timestamp = jiffies;
+	}
+
+	hci_dev_unlock(hdev);
+}
+
 void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
 {
 	hci_event_hdr *he = (hci_event_hdr *) skb->data;
@@ -757,6 +779,10 @@
 
 	case EVT_ENCRYPT_CHANGE:
 		hci_encrypt_change_evt(hdev, skb);
+		break;
+
+	case EVT_CLOCK_OFFSET:
+		hci_clock_offset_evt(hdev, skb);
 		break;
 
 	case EVT_CMD_STATUS:
diff -Naur bluez-kernel-2.3/include/hci.h bluez-kernel-2.3-new/include/hci.h
--- bluez-kernel-2.3/include/hci.h	Fri Nov  1 18:48:51 2002
+++ bluez-kernel-2.3-new/include/hci.h	Tue Mar 11 18:30:15 2003
@@ -567,6 +567,14 @@
 } __attribute__ ((packed)) evt_link_key_notify;
 #define EVT_LINK_KEY_NOTIFY_SIZE 23
 
+#define EVT_CLOCK_OFFSET	0x1C
+typedef struct {
+	__u8	status;
+	__u16	handle;
+	__u16	offset;
+} __attribute__ ((packed)) evt_clock_offset;
+#define EVT_CLOCK_OFFSET_SIZE 5
+
 #define EVT_READ_REMOTE_FEATURES_COMPLETE 0x0B
 typedef struct {
 	__u8    status;

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

* Re: [Bluez-devel] Support for Clock offset event
  2003-03-11 17:53   ` [Bluez-devel] Support for Clock offset event Wolfgang Heidrich
@ 2003-03-12  0:15     ` Marcel Holtmann
  2003-03-12  9:18       ` Wolfgang Heidrich
  0 siblings, 1 reply; 4+ messages in thread
From: Marcel Holtmann @ 2003-03-12  0:15 UTC (permalink / raw)
  To: Wolfgang Heidrich; +Cc: BlueZ Mailing List

Hi Wolfgang,

> I added support for the clock offset event to bluez-kernel. The
> attached patch is very simple and applies cleanly to bluez-kernel-2.3.
> If you like, you can commit it. Then bluez gets one more step more
> complete.
> The clock information in the corresponding
> entry of the inquiry cache is updated in case of a clock offset event.
> 
> Clock offset is important for very fast connection establishment.

thanks for the patch. Can you please explain how it should help to get a
fast connection establishment. I have been through the spec. and the
clock offset event will only be generated if you request it with the
read clock offset command. This command requires a connection handle of
an ACL link and if you got the connection handle you will already have a
established connection. So I can't see how this patch will give us any
advantages.

Regards

Marcel




-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! 
Get cracking and register here for some mind boggling fun and 
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] Support for Clock offset event
  2003-03-12  0:15     ` Marcel Holtmann
@ 2003-03-12  9:18       ` Wolfgang Heidrich
  2003-03-22  8:14         ` Marcel Holtmann
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Heidrich @ 2003-03-12  9:18 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: BlueZ Mailing List

Hello,

the patch alone doesn't help to accelerate connection establishment.
And of course you are right, that the clock offset event is only
generated
if someone requests it for an existing acl-conenction. But maybe
some people want to do this.
But maybe if you terminate the connection and want to establish it again
without inquiry (just using the inquiry cache), the clock offset event
is 
helpful (why do we have the inquiry cache?). Especially if you want to
do this automatically. For the normal user this has no benefit until
now.

In this context INQUIRY_ENTRY_AGE_MAX should be set to e.g. one hour
(see the mails from 30th. of January, Subject "Connecting with clock
offset").

But the main reason for integrating this event in bluez is: 
The clock offset event exists in the spec
and can be generated if someone wants to do this
and there is no reason to omit these few lines of code.

Regards

Marcel Holtmann schrieb:
> 
> Hi Wolfgang,
> 
> > I added support for the clock offset event to bluez-kernel. The
> > attached patch is very simple and applies cleanly to bluez-kernel-2.3.
> > If you like, you can commit it. Then bluez gets one more step more
> > complete.
> > The clock information in the corresponding
> > entry of the inquiry cache is updated in case of a clock offset event.
> >
> > Clock offset is important for very fast connection establishment.
> 
> thanks for the patch. Can you please explain how it should help to get a
> fast connection establishment. I have been through the spec. and the
> clock offset event will only be generated if you request it with the
> read clock offset command. This command requires a connection handle of
> an ACL link and if you got the connection handle you will already have a
> established connection. So I can't see how this patch will give us any
> advantages.
> 
> Regards
> 
> Marcel

-- 
Fraunhofer Einrichtung für Systeme der Kommunikationstechnik (ESK)

Wolfgang Heidrich        	  	Hansastraße 32
Dipl.-Ing.                      	80686 München / Germany
                                  	Phone :  +49(0)89-547088-376
E-Mail: wolfgang.heidrich@esk.fhg.de   	Fax   :  +49(0)89-547088-221

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

* Re: [Bluez-devel] Support for Clock offset event
  2003-03-12  9:18       ` Wolfgang Heidrich
@ 2003-03-22  8:14         ` Marcel Holtmann
  0 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2003-03-22  8:14 UTC (permalink / raw)
  To: Wolfgang Heidrich; +Cc: BlueZ Mailing List

Hi Wolfgang,

> the patch alone doesn't help to accelerate connection establishment.
> And of course you are right, that the clock offset event is only
> generated
> if someone requests it for an existing acl-conenction. But maybe
> some people want to do this.
> But maybe if you terminate the connection and want to establish it again
> without inquiry (just using the inquiry cache), the clock offset event
> is 
> helpful (why do we have the inquiry cache?). Especially if you want to
> do this automatically. For the normal user this has no benefit until
> now.
> 
> In this context INQUIRY_ENTRY_AGE_MAX should be set to e.g. one hour
> (see the mails from 30th. of January, Subject "Connecting with clock
> offset").
> 
> But the main reason for integrating this event in bluez is: 
> The clock offset event exists in the spec
> and can be generated if someone wants to do this
> and there is no reason to omit these few lines of code.

the reason to omit these few lines is that we don't get any advantages
of it and we should keep the kernel code as small as possible. We don't
put code into the kernel only because it is in the spec. The Bluetooth
spec. is not as good as it seems at some points and this is one of them.
If the clock offset event will be automaticly send on disconnect or
something else I would say "go and include it", but the fact that this
event must be requested and can only be requested with an existing
connection is the reason for me to leave it out.

If you talk about fast reconnection you will see that such a thing is
already in the kernel with the HCI_DISCONN_TIMEOUT. In this time it is
possible to reuse the ACL link.

Anyway, I have included the hci_read_clock_offset() command into the
Bluetooth library for completeness.

Regards

Marcel




-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! 
Get cracking and register here for some mind boggling fun and 
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

end of thread, other threads:[~2003-03-22  8:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <5.1.0.14.2.20030306125429.02687aa0@mail1.qualcomm.com>
     [not found] ` <5.1.0.14.2.20030307165419.01bb5668@mail1.qualcomm.com>
2003-03-11 17:53   ` [Bluez-devel] Support for Clock offset event Wolfgang Heidrich
2003-03-12  0:15     ` Marcel Holtmann
2003-03-12  9:18       ` Wolfgang Heidrich
2003-03-22  8:14         ` Marcel Holtmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.