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