Prepare patch bluez for the CoD in hci_conn
Subsystems (2)
Hi Marcel,
Do you remember that I have asked a CoD question in this list and you ask me to do a patch to let the CoD value in hci_conn? Now I have time to do this work and I have something to clarify for I am not a bluez member before and I am not very fimiliar with BlueZ.
This time I just want to keep the remote CoD value in hci_conn when a connection is done. But as you know, sometimes it is impossible for us to get the CoD of the remote class without a prestage inquiry. So, not every CoD value in hci_conn is valid. I will check the BT spec to find a right way to tell the user whether the CoD is valid.
Is it enough that I add a field to hci_conn and when the connection is done I update the field?
Chen
-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel Holtmann
maintainerHi Chen,
Quoted 5 lines
Do you remember that I have asked a CoD question in this list and you ask me to do a patch to let the CoD value in
hci_conn? Now I have time to do this work and I have something to clarify for I am not a bluez member before and I am not very fimiliar with BlueZ.
Quoted 8 lines
This time I just want to keep the remote CoD value in
hci_connwhen a connection is done. But as you know, sometimes it is impossible for us to get the CoD of the remote class without a prestage inquiry. So, not every CoD value inhci_connis valid. I will check the BT spec to find a right way to tell the user whether the CoD is valid.Is it enough that I add a field to
hci_connand when the connection is done I update the field?
you need only to add a "__u8 dev_class[3]" field to the data structure and if you don't know the current value for CoD. For example for an outgoing connection, where the value is not in the inquiry cache, then you simply put 0x000000 in there.
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Hi Marcel,
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.
Chen
=D4=DA 2004-12-06=D2=BB=B5=C4 07:40 +0100=A3=ACMarcel Holtmann=D0=B4=B5=C0= =A3=BA
Quoted 37 lines
=B7=A2=BC=FE=C8=CB:=20 Marcel Holtmann <[email protected]> =BB=D8=B8=B4=D6=C1:=20 [email protected] =CA=D5=BC=FE=C8=CB:=20 BlueZ Mailing List <[email protected]> =D6=F7=CC=E2:=20 Re: [Bluez-devel] Prepare patch bluez for the CoD in hci_conn =C8=D5=C6=DA:=20Mon, 06 Dec 2004 07:40:36 +0100
(14:40 CST)
=20
Hi Chen,
=20Quoted 1 line
Do you remember that I have asked a CoD question in this list and
you
Quoted 1 line
ask me to do a patch to let the CoD value in
hci_conn? Now I havetime
Quoted 4 lines
to do this work and I have something to clarify for I am not a bluez member before and I am not very fimiliar with BlueZ.
=20
This time I just want to keep the remote CoD value inhci_connwhena
Quoted 1 line
connection is done. But as you know, sometimes it is impossible for
us
Quoted 1 line
to get the CoD of the remote class without a prestage inquiry. So,
not
Quoted 1 line
every CoD value in
hci_connis valid. I will check the BT spec tofind a
Quoted 3 lines
right way to tell the user whether the CoD is valid.
=20
Is it enough that I add a field tohci_connand when the connectionis
Quoted 1 line
done I update the field?
Quoted 9 lines
=20
you need only to add a "__u8dev_class[3]" field to the data structure and if you don't know the current value for CoD. For example for an outgoing connection, where the value is not in the inquiry cache, then you simply put0x000000in there.
=20
Regards
=20
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel Holtmann
maintainerHi Chen,
Quoted 7 lines
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Hi Marcel,
I haven't patched for the kernel before, so I don't know what is the Singed-off-by statement.I only added my change log at the header of the file and in the part of the file I modified I have added some comments.
/*
BlueZ - Bluetooth protocol stack for Linux
Copyright (C) 2000-2001 Qualcomm Incorporated
Written 2000,2001 by Maxim Krasnyansky <[email protected]>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation;
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR
ANY
CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY
DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
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
* [email protected]
*/
Sorry for inconvient.
Chen
=D4=DA 2004-12-06=D2=BB=B5=C4 08:18 +0100=A3=ACMarcel Holtmann=D0=B4=B5=C0= =A3=BA
Quoted 3 lines
Hi Chen,
=20Quoted 1 line
I have done this. I searched the BT spec and find two places which wi=
ll
Quoted 3 lines
Quoted 3 lines
let us know the CoD value, and I simply test it, it works find. =20
Ok, next step is to make an interface(maybe ioctl) to let the user ge=
t
Quoted 1 line
Quoted 1 line
the CoD value, is it needed(if there has been a interface which can g=
et
Quoted 1 line
Quoted 1 line
the entire
hci_connstructure)? If it is not needed, I will send you =
the
Quoted 15 lines
Quoted 1 line
patch now.
=20
step by step. Send your patch now and don't forget the Signed-off-by statement.
=20
Regards
=20
Marcel
=20
=20
=20
=20
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users=
.
Quoted 6 lines
Discover which products truly live up to the hype. Start reading now.=20
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel Holtmann
maintainerHi Chen,
Quoted 3 lines
I haven't patched for the kernel before, so I don't know what is the Singed-off-by statement.I only added my change log at the header of the file and in the part of the file I modified I have added some comments.
please prepare an email with the patch and describe briefly what it changes. Then you put a
under it to say that the code is from you. Don't spread all the source code with your name, because this will result in extra work for me to delete it.
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
The attachment is my patch, the comments and the debug info can be removed as soon as this patch is tested fully.
Chen
Quoted 20 lines · 在 2004-12-06一的 08:18 +0100,Marcel Holtmann写道:
Hi Chen,
Quoted 7 lines
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
Quoted 9 lines
-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
include/net/bluetooth/hci_core.h +8 -0
@@ -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 +* [email protected] */ #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;
net/bluetooth/hci_conn.c +29 -0
@@ -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 +* [email protected] */ /* 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);
net/bluetooth/hci_event.c +12 -0
@@ -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 +* [email protected] */ /* 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);
Marcel Holtmann
maintainerHi Chen,
Quoted 2 lines
The attachment is my patch, the comments and the debug info can be removed as soon as this patch is tested fully.
and your patch is quite too complex. Mine consists of three additional lines only.
Regards
Marcel
===== include/net/bluetooth/hci_core.h 1.29 vs edited =====
include/net/bluetooth/hci_core.h +1 -0
@@ -152,6 +152,7 @@__u16 state;__u8 type;__u8 out; +__u8 dev_class[3 ];__u32 link_mode;unsigned long pend;
===== net/bluetooth/hci_conn.c 1.18 vs edited =====
net/bluetooth/hci_conn.c +1 -0
@@ -74,6 +74,7 @@ cp.pscan_rep_mode = ie->data.pscan_rep_mode; cp.pscan_mode = ie->data.pscan_mode; cp.clock_offset = ie->data.clock_offset |__cpu_to_le16 (0x8000 ); +memcpy (conn->dev_class, ie->data.dev_class,3 ); } cp.pkt_type =__cpu_to_le16 (hdev->pkt_type &ACL_PTYPE_MASK );
===== net/bluetooth/hci_event.c 1.20 vs edited =====
net/bluetooth/hci_event.c +1 -0
@@ -555,6 +555,7 @@return ; } } +memcpy (conn->dev_class, ev->dev_class,3 ); conn->state =BT_CONNECT ;hci_dev_unlock (hdev);
Hi Marcel,
Ok, use your patch is ok, if I have find some more info in the Bluetooth Spec, I will send my patch to you:)
Thank you.
BTW: I will remain our company's BT engineer and if the BlueZ have some part not completed, may be I can contribute to do some work:)
Chen
=D4=DA 2004-12-06=D2=BB=B5=C4 09:41 +0100=A3=ACMarcel Holtmann=D0=B4=B5=C0= =A3=BA
Quoted 4 lines
Hi Chen,
=20Quoted 2 lines
The attachment is my patch, the comments and the debug info can be removed as soon as this patch is tested fully.
Quoted 8 lines
=20
and your patch is quite too complex. Mine consists of three additional lines only.
=20
Regards
=20
Marcel
=20
-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel Holtmann
maintainerHi Chen,
Quoted 2 lines
Ok, use your patch is ok, if I have find some more info in the Bluetooth Spec, I will send my patch to you:)
it is only compile tested, but actually from a code review it should do exactly what was requested. If you wanna test it, you must change the ie->data into ie->info, because the inquiry_data change is not yet merged back into mainline. A new -mh patch will follow soon.
Quoted 2 lines
BTW: I will remain our company's BT engineer and if the BlueZ have some part not completed, may be I can contribute to do some work:)
Go ahead, because every patch is welcome.
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
=D4=DA 2004-12-06=D2=BB=B5=C4 10:04 +0100=A3=ACMarcel Holtmann=D0=B4=B5=C0= =A3=BA
Quoted 3 lines
Hi Chen,
=20Quoted 1 line
Ok, use your patch is ok, if I have find some more info in the Blueto=
oth
Quoted 7 lines
Quoted 1 line
Spec, I will send my patch to you:)
=20
it is only compile tested, but actually from a code review it should do exactly what was requested. If you wanna test it, you must change theie->dataintoie->info, because theinquiry_datachange is not yet merged back into mainline. A new -mh patch will follow soon. =20
I have test my patch, and I will test yours too.=20
And I wanna know which kernel version you current work on? Your new -mh patch will only apply to the newest kernel or olders too?
I don't know much about your patch convention.
Quoted 1 line
Quoted 1 line
BTW: I will remain our company's BT engineer and if the BlueZ have so=
me
Quoted 14 lines
Quoted 1 line
part not completed, may be I can contribute to do some work:)
=20
Go ahead, because every patch is welcome.
=20
Regards
=20
Marcel
=20
=20
=20
=20
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users=
.
Quoted 6 lines
Discover which products truly live up to the hype. Start reading now.=20
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel Holtmann
maintainerHi Chen,
Quoted 6 lines
Quoted 5 lines
it is only compile tested, but actually from a code review it should do exactly what was requested. If you wanna test it, you must change the
ie->dataintoie->info, because theinquiry_datachange is not yet merged back into mainline. A new -mh patch will follow soon.
Quoted 6 lines
I have test my patch, and I will test yours too.
And I wanna know which kernel version you current work on? Your new -mh patch will only apply to the newest kernel or olders too?
I don't know much about your patch convention.
if it says patch-2.6.9-mh4 then it applies cleanly against 2.6.9.
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Hi Marcel,
I see your patch that you patch the hci_acl_connect()=A3=ACbut why not hci_conn_add()?
I feel the latter is more appropriate.
Chen
=D4=DA 2004-12-06=D2=BB=B5=C4 09:41 +0100=A3=ACMarcel Holtmann=D0=B4=B5=C0= =A3=BA
Quoted 4 lines
Hi Chen,
=20Quoted 2 lines
The attachment is my patch, the comments and the debug info can be removed as soon as this patch is tested fully.
Quoted 8 lines
=20
and your patch is quite too complex. Mine consists of three additional lines only.
=20
Regards
=20
Marcel
=20
-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel Holtmann
maintainerHi Chen,
Quoted 4 lines
I see your patch that you patch the hci_acl_connect()=81Cbut why not
hci_conn_add()?
=20
I feel the latter is more appropriate.
no, it is not. The hci_conn_add is called at various times. It is called for incoming and outgoing connections. We don't need to do a lookup at the inquiry cache for an incoming connection, because we get the value within the connection request event. The hci_acl_connect() is used to create an outgoing connection and it already have to lookup the other parameters from the inquiry cache. Do see the point?
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
=D4=DA 2004-12-06=D2=BB=B5=C4 10:14 +0100=A3=ACMarcel Holtmann=D0=B4=B5=C0= =A3=BA
Quoted 3 lines
Hi Chen,
=20Quoted 1 line
I see your patch that you patch the hci_acl_connect()=A3=ACbut why no=
t
Quoted 5 lines
Quoted 3 lines
hci_conn_add()?
=20
I feel the latter is more appropriate.=20
no, it is not. Thehci_conn_addis called at various times. It is calle=
d
Quoted 6 lines
for incoming and outgoing connections. We don't need to do a lookup at the inquiry cache for an incoming connection, because we get the value within the connection request event. The
hci_acl_connect()is used to create an outgoing connection and it already have to lookup the other parameters from the inquiry cache. Do see the point?
=20
Ok, got it. Thanks.
Quoted 10 lines
Regards
=20
Marcel
=20
=20
=20
=20
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users=
.
Quoted 6 lines
Discover which products truly live up to the hype. Start reading now.=20
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel