Return-Path: Message-ID: <4D0B92A5.9010503@aircable.net> Date: Fri, 17 Dec 2010 13:41:09 -0300 From: Manuel Naranjo MIME-Version: 1.0 To: Marcel Holtmann CC: BlueZ Subject: [RFC][PATCH] Re: EDR support References: <4D03DC83.8010200@aircable.net> <1292585241.2658.0.camel@aeonflux> In-Reply-To: <1292585241.2658.0.camel@aeonflux> Content-Type: multipart/mixed; boundary="------------080607070206090300040402" List-ID: This is a multi-part message in MIME format. --------------080607070206090300040402 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Marcel, > Hi Manuel, > >> I was checking the latest BlueZ source code and the kernel source code, >> and I noticed that by default EDR is disabled, when a dongle is detected >> net/bluetooth/hci_core.c initializes the packet types with DM1, DH1 and >> HV1, and then net/bluetooth/hci_event.c does it for DM3-5 DH3-5 and >> HV3-5, but it never initializes the 2DHx or 3DHx. Was it made on purpose >> or is it a bug in the code? > you have read the specification and realized that EDR uses inverse > values? I can't find that, but still I could find that according to the 2.1 specs + EDR when you want to enable EDR is up to the master or slave to ask for the package type switch, that means as far as I understand ask the other side to enable 2-DH1,2-DH3,2-DH5,3-DH1,3-DH3,3-DH5. I get from this that from the BlueZ point of view is either the kernel that should do that, or the BlueZ daemon or just rely that to the user application. But I think there are a few of non covered issues here, first when you attach an EDR dongle which has the EDR (this means is capable of doing 2mbps and 3mbps acl connections the kernel side doesn't show this to the userland (hciconfig), I made a patch that does exactly that, during the device recognition of the kernel just read the features provided and or that to the pkt_type flag. This helps a lot, now my dongle shows it can do EDR: EDR compatible: Features: 0xff 0xff 0x8f 0xfe 0x9b 0xff 0x59 0x83 Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 2-DH1 2-DH3 2-DH5 3-DH1 3-DH3 3-DH5 EDR not compatible: Features: 0xff 0xff 0x8f 0xf8 0x1b 0xf8 0x00 0x80 Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 If you think the patch is sane to be included then I format it properly so far I made it against compat-wireless-2.6.36-4 but it wouldn't be an issue to make it against the current kernel source. Next thing was playing with hcitool cpt and that did work, I get speed improvements, from ~ 60KBs I get up to 100KBs to the same device, just by forcing it to only do 3-DH5 (which I know is not a good idea, because it's best for both radios to adapt, based on the environment). I think it's a good idea to rely EDR "enabling" to the user space, otherwise connection complexity on the kernel well be way harder to keep. I think the best would be to add some stuff to the DBUS so first let the user know which packet types are available, second to allow it to change on a new connection. Please let me know what you think about it, Manuel --------------080607070206090300040402 Content-Type: text/plain; name="enableEDR.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="enableEDR.patch" ZGlmZiAtdXByTiBjb21wYXQtd2lyZWxlc3MtMi42LjM2LTQvaW5jbHVkZS9uZXQvYmx1ZXRv b3RoL2hjaS5oIGNvbXBhdC13aXJlbGVzcy0yLjYuMzYtNC5taW5lLy9pbmNsdWRlL25ldC9i bHVldG9vdGgvaGNpLmgKLS0tIGNvbXBhdC13aXJlbGVzcy0yLjYuMzYtNC9pbmNsdWRlL25l dC9ibHVldG9vdGgvaGNpLmgJMjAxMC0xMS0wOCAyMjowMDo1MS4wMDAwMDAwMDAgLTAzMDAK KysrIGNvbXBhdC13aXJlbGVzcy0yLjYuMzYtNC5taW5lLy9pbmNsdWRlL25ldC9ibHVldG9v dGgvaGNpLmgJMjAxMC0xMi0xMSAxOToxMzoxNC4wMDAwMDAwMDAgLTAzMDAKQEAgLTEsNiAr MSw3IEBACiAvKiAKICAgIEJsdWVaIC0gQmx1ZXRvb3RoIHByb3RvY29sIHN0YWNrIGZvciBM aW51eAogICAgQ29weXJpZ2h0IChDKSAyMDAwLTIwMDEgUXVhbGNvbW0gSW5jb3Jwb3JhdGVk CisgICBDb3B5cmlnaHQgKEMpIDIwMTAgTmFyYW5qbyBNYW51ZWwgRnJhbmNpc2NvIDxtYW51 ZWxAYWlyY2FibGUubmV0PgogCiAgICBXcml0dGVuIDIwMDAsMjAwMSBieSBNYXhpbSBLcmFz bnlhbnNreSA8bWF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