All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen Bin <binch@mobilesoft.com.cn>
To: bluez-devel@lists.sourceforge.net
Subject: Re: [Bluez-devel] Prepare patch bluez for the CoD in hci_conn
Date: Mon, 06 Dec 2004 23:53:25 +0800	[thread overview]
Message-ID: <1102348405.3281.4.camel@debian> (raw)
In-Reply-To: <1102317505.8510.66.camel@pegasus>

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

The attachment is my patch, the comments and the debug info can be
removed as soon as this patch is tested fully.

Chen
在 2004-12-06一的 08:18 +0100,Marcel Holtmann写道:
> Hi Chen,
> 
> > I have done this. I searched the BT spec and find two places which will
> > let us know the CoD value, and I simply test it, it works find.
> > 
> > Ok, next step is to make an interface(maybe ioctl) to let the user get
> > the CoD value, is it needed(if there has been a interface which can get
> > the entire hci_conn structure)? If it is not needed, I will send you the
> > patch now.
> 
> step by step. Send your patch now and don't forget the Signed-off-by
> statement.
> 
> Regards
> 
> Marcel
> 
> 
> 
> 
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now. 
> http://productguide.itmanagersjournal.com/
> _______________________________________________
> Bluez-devel mailing list
> Bluez-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bluez-devel

[-- Attachment #2: patch-2.6.9-CoD --]
[-- Type: text/x-patch, Size: 3397 bytes --]

diff -ruN linux-2.6.9/include/net/bluetooth/hci_core.h linux-2.6.9-my/include/net/bluetooth/hci_core.h
--- linux-2.6.9/include/net/bluetooth/hci_core.h	Tue Oct 19 05:54:30 2004
+++ linux-2.6.9-my/include/net/bluetooth/hci_core.h	Mon Dec  6 23:39:24 2004
@@ -20,6 +20,9 @@
    ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 
    COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 
    SOFTWARE IS DISCLAIMED.
+
+ * Add some code for CoD value, 06/12/04, Chen Bin 
+ *     binch@mobilesoft.com.cn
 */
 
 #ifndef __HCI_CORE_H
@@ -143,6 +146,11 @@
 	__u8		 out;
 	__u32		 link_mode;
 	unsigned long	 pend;
+
+	/* 
+	 * added by Chen Bin.
+	 */
+	__u8     dev_class[3];
 	
 	unsigned int	 sent;
 	
diff -ruN linux-2.6.9/net/bluetooth/hci_conn.c linux-2.6.9-my/net/bluetooth/hci_conn.c
--- linux-2.6.9/net/bluetooth/hci_conn.c	Tue Oct 19 05:55:29 2004
+++ linux-2.6.9-my/net/bluetooth/hci_conn.c	Mon Dec  6 23:14:59 2004
@@ -20,6 +20,9 @@
    ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 
    COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 
    SOFTWARE IS DISCLAIMED.
+
+ * Add some code for CoD value, 06/12/04, Chen Bin 
+ *     binch@mobilesoft.com.cn
 */
 
 /* Bluetooth HCI connection handling. */
@@ -143,6 +146,7 @@
 struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst)
 {
 	struct hci_conn *conn;
+	struct inquiry_entry *ie;
 
 	BT_DBG("%s dst %s", hdev->name, batostr(dst));
 
@@ -154,6 +158,31 @@
 	conn->type   = type;
 	conn->hdev   = hdev;
 	conn->state  = BT_OPEN;
+
+	/*
+	 * added by Chen Bin for CoD value.
+	 */
+
+	if ((ie = hci_inquiry_cache_lookup(hdev, dst)) &&
+			inquiry_entry_age(ie) <= INQUIRY_ENTRY_AGE_MAX) {
+		/*
+		 * Found a valid entry
+		 * copy the CoD value to the hci_conn
+		 */
+		conn->dev_class[0] = ie->info.dev_class[0];
+		conn->dev_class[1] = ie->info.dev_class[1];
+		conn->dev_class[2] = ie->info.dev_class[2];
+
+	} else {
+		conn->dev_class[0] = 0x00;
+		conn->dev_class[1] = 0x00;
+		conn->dev_class[2] = 0x00; 
+	}
+	
+	printk("hci_conn_add: the dev_class = %x %x %x\n", conn->dev_class[0], conn->dev_class[1], conn->dev_class[2]);
+
+	//---------------------------------------------------------
+
 
 	skb_queue_head_init(&conn->data_q);
 	hci_conn_init_timer(conn);
diff -ruN linux-2.6.9/net/bluetooth/hci_event.c linux-2.6.9-my/net/bluetooth/hci_event.c
--- linux-2.6.9/net/bluetooth/hci_event.c	Tue Oct 19 05:53:06 2004
+++ linux-2.6.9-my/net/bluetooth/hci_event.c	Mon Dec  6 23:15:06 2004
@@ -20,6 +20,9 @@
    ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 
    COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 
    SOFTWARE IS DISCLAIMED.
+
+ * Add some code for CoD value, 06/12/04, Chen Bin 
+ *     binch@mobilesoft.com.cn
 */
 
 /* Bluetooth HCI event handling. */
@@ -539,6 +542,15 @@
 			}
 		}
 		conn->state = BT_CONNECT;
+		/*
+		 * added by Chen Bin
+		 * if the remote ba address is in the cache, hci_conn_add will add the
+		 * dev_class field in conn.
+		 * So the following two lines is useless.
+		 */
+		memcpy(conn->dev_class, &ev->dev_class, 3);
+		printk("hci_conn_request_evt:the dev_class = %x %x %x\n", conn->dev_class[0], conn->dev_class[1], conn->dev_class[2]);
+		//--------------------------------------------------------
 		hci_dev_unlock(hdev);
 
 		bacpy(&cp.bdaddr, &ev->bdaddr);

  parent reply	other threads:[~2004-12-06 15:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-06 13:34 [Bluez-devel] Prepare patch bluez for the CoD in hci_conn Chen Bin
2004-12-06  6:40 ` Marcel Holtmann
2004-12-06 15:11   ` Chen Bin
2004-12-06  7:18     ` Marcel Holtmann
2004-12-06 15:50       ` Chen Bin
2004-12-06  8:07         ` Marcel Holtmann
2004-12-06 15:53       ` Chen Bin [this message]
2004-12-06  8:41         ` Marcel Holtmann
2004-12-06 16:54           ` Chen Bin
2004-12-06  9:04             ` Marcel Holtmann
2004-12-06 17:40               ` Chen Bin
2004-12-06  9:56                 ` Marcel Holtmann
2004-12-06 17:05           ` Chen Bin
2004-12-06  9:14             ` Marcel Holtmann
2004-12-06 17:21               ` Chen Bin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1102348405.3281.4.camel@debian \
    --to=binch@mobilesoft.com.cn \
    --cc=bluez-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.