* Re: [PATCH v2 1/4] Fix constness of att_get_u{8,16,32}() functions
From: Johan Hedberg @ 2010-10-04 19:17 UTC (permalink / raw)
To: Anderson Lizardo; +Cc: linux-bluetooth
In-Reply-To: <1286219584-8199-1-git-send-email-anderson.lizardo@openbossa.org>
Hi Anderson,
All four patches have been pushed upstream. Thanks.
Johan
^ permalink raw reply
* Re: Pull request: git://git.infradead.org/users/cktakahasi/bluez.git for-upstream
From: Johan Hedberg @ 2010-10-04 20:43 UTC (permalink / raw)
To: Claudio Takahasi; +Cc: BlueZ development
In-Reply-To: <AANLkTinF1OWKMzuArUS6ptWiDTtvQuXxxW9B5ks3tebW@mail.gmail.com>
Hi Claudio,
On Mon, Oct 04, 2010, Claudio Takahasi wrote:
> The following changes since commit 19c8e310329bb6b369f11501afec9ff4223c2971:
>
> Allow errors to propagate from connection callback (2010-10-04 17:06:49 +0200)
>
> are available in the git repository at:
> git://git.infradead.org/users/cktakahasi/bluez.git for-upstream
>
> Claudio Takahasi (23):
> Add LE start and stop scanning
> Remove RSSI field from the advertising report event
> Decoding the RSSI parameter from the advertising report event
> Send Discovering property "FALSE" when the interleave finishes
> Add length argument on hciops start discovery function
> Stop inquiry using the length parameter
> Fix remote name resolution for interleave discovery
> Add Write LE host supported function
> Set the LE host supported and disable simultaneous LE and BR/EDR flags
> Add extended feature mask constants definition
> Read the local extended features
> Stop LE scanning when discovery is suspended
> Rename hciops {start, stop}_discovery to {start, stop}_inquiry
> Don't enter on interleave mode if there isn't active sessions
> Code cleanup: improving inquiry logic
> Clear the remote device found list in the state transition
> Fix periodic inquiry signals
> Fixing DeviceDisappeared signal
> Postpone discovery if still resolving names
> Add adapter discovery type function
> Do not send another Discovering TRUE signal if still resolving names
> Forcing periodic inquiry exit
> Fix interleave scanning
>
> Vinicius Costa Gomes (1):
> Add BR/EDR LE interleaved discovery
>
> lib/hci.c | 29 +++++
> lib/hci.h | 17 +++-
> lib/hci_lib.h | 1 +
> plugins/hciops.c | 69 +++++++++++-
> src/adapter.c | 301 +++++++++++++++++++++++++++++++++++++-----------------
> src/adapter.h | 38 ++++---
> src/dbus-hci.c | 45 +++++++--
> src/dbus-hci.h | 1 +
> src/security.c | 131 ++++++++++++++----------
> 9 files changed, 449 insertions(+), 183 deletions(-)
Thanks. Pushed upstream.
Johan
^ permalink raw reply
* Re: [PATCH] Bluetooth: Replace hard code of configuration continuous flag
From: Gustavo F. Padovan @ 2010-10-04 21:00 UTC (permalink / raw)
To: haijun liu; +Cc: linux-bluetooth@vger.kernel.org, dan.tian, suraj, Ville Tervo
In-Reply-To: <AANLkTi=-4yF2qew7YVnESPd_jt7g8bvS12XYkhx27ko8@mail.gmail.com>
Hi Haijun,
* haijun liu <liuhaijun.er@gmail.com> [2010-10-01 22:43:52 +0800]:
> Replace hard code of configuration continuous flag with
> self-commented macro L2CAP_CONF_FLAG_CONT in functions
> l2cap_config_req() and l2cap_config_rsp().
>
> Signed-off-by: Haijun.Liu <haijun.liu@atheros.com>
Put a ' ' instead of '.' to separate your surname.
> ---
> include/net/bluetooth/l2cap.h | 2 ++
> net/bluetooth/l2cap_core.c | 6 +++---
> 2 files changed, 5 insertions(+), 3 deletions(-)
Patch is corrupted again, please check where you are screwing up on
sending patches to the mailing list, then we can save my time and your
time. ;)
Applying: Bluetooth: Replace hard code of configuration continuous flag
fatal: corrupt patch at line 11
Patch failed at 0001 Bluetooth: Replace hard code of configuration
continuous flag
Regards,
--
Gustavo F. Padovan
ProFUSION embedded systems - http://profusion.mobi
^ permalink raw reply
* Re: pull-request: bluetooth-2.6 2010-09-27
From: Gustavo F. Padovan @ 2010-10-04 22:35 UTC (permalink / raw)
To: David Miller; +Cc: linville, marcel, linux-bluetooth, netdev
In-Reply-To: <20101001012203.GE3048@vigoh>
Hi Dave,
* Gustavo F. Padovan <padovan@profusion.mobi> [2010-09-30 22:22:03 -0300]:
> Hi Dave,
>
> * David Miller <davem@davemloft.net> [2010-09-30 17:26:57 -0700]:
>
> > From: "Gustavo F. Padovan" <padovan@profusion.mobi>
> > Date: Tue, 28 Sep 2010 19:49:41 -0300
> >
> > > Actually sk_stream_wait_memory is another point why it's safe to release
> > > the lock and block waiting for memory. We've been doing that safely in
> > > protocols like TCP, SCTP and DCCP for a long time.
> >
> > Do you notice what TCP does when sk_stream_wait_memory() returns?
> >
> > It reloads all volatile state that might have changed in the socket
> > while the lock was dropped.
> >
> > For example, TCP will reload the current MSS that can change
> > asynchronously while we don't have the socket lock.
>
> I got your point. And what I tried to say in the last e-mail is that
> ERTM doesn't have such volatile states that need to restore after get
> the lock back. The others code path it affect are very simple and also
> doesn't have such problem. So we are safe against asynchronous changes.
> We obvious have volatiles states, but the code paths where
> bt_skb_send_alloc() is used doesn't rely on that states. I'm seeing no
> problem on release the lock, alloc memory, and lock it again.
I did a proper audit of the code paths:
sco_send_frame(): after bt_skb_send_alloc() returns the function doesn't
touch any sk state anymore, it just picks the skb and sends it to the
HCI.
l2cap_create_connless_pdu(): after bt_skb_send_alloc() returns the
function only reads l2cap_pi(sk)->dcid and l2cap_pi(sk)->psm, those
value are static and don't change with the connection alive
l2cap_create_connless_pdu(): after bt_skb_send_alloc() returns the
function only reads l2cap_pi(sk)->dcid, that value is static and doesn't
change with the connection alive.
l2cap_create_iframe_pdu(): after bt_skb_send_alloc() returns, we only
reads l2cap_pi(sk)->dcid and l2cap_pi(sk)->fcs which doesn change with
the connection alive, l2cap_create_iframe_pdu() returns the skb to
l2cap_sar_segment_sdu(), which changes only the TX_QUEUE(sk), but it
only appends in the end while the rest of the L2CAP code reads from
the begin. After that we have the process of sending of ERTM and
Streaming Mode, this process is independent from the skb alloc process,
so no problem here.
Other point already discussed are the check after get the lock again,
they guarantee that the socket is still connected, otherwise returns
error.
An extra check will be added to setsockopt() just to make sure that
l2cap_pi(sk)->fcs won't change while the sk_state is BT_CONNECTED. That
was an issue even before this backlog queue issue.
Follow the output of git show for that change, if we agree on the change I
can append it to the bluetooth pull request.
Author: Gustavo F. Padovan <padovan@profusion.mobi>
Date: Mon Oct 4 19:28:52 2010 -0300
Bluetooth: Disallow to change L2CAP_OPTIONS values when connected
L2CAP doesn't permit change like MTU, FCS, TxWindow values while the
connection is alive, we can only set that before the
connection/configuration process. That can lead to bugs in the L2CAP
operation.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index 44a8fb0..0b54b7d 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -1950,6 +1950,11 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __us
switch (optname) {
case L2CAP_OPTIONS:
+ if (sk->sk_state == BT_CONNECTED) {
+ err = -EINVAL;
+ break;
+ }
+
opts.imtu = l2cap_pi(sk)->imtu;
opts.omtu = l2cap_pi(sk)->omtu;
opts.flush_to = l2cap_pi(sk)->flush_to;
--
Gustavo F. Padovan
ProFUSION embedded systems - http://profusion.mobi
^ permalink raw reply related
* RE: How add support of LLMNR for PAN
From: Chetankumar Manjegowda @ 2010-10-05 4:47 UTC (permalink / raw)
To: Arun Kumar; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <AANLkTimguxTRuPB2Dgqm4w5k-MeOxDdCYDn-T_UvOFRL@mail.gmail.com>
SGkgQXJ1biwNClRoYW5rcyBmb3IgeW91ciByZXBseS4NCg0KSSBhbSBuZXcgdG8gbmV0d29ya2lu
ZyBJIGFtIG5vdCBzdXJlIGFib3V0IHRoYXQuDQoNCkkgd2FudCB0byBzZW5kIExMTU5SIHF1ZXJ5
IHNvIGkgYW0gcGxhbm5pbmcgdG8gdXNlIGF2YWhpLTAuNi4yNyhhdmFoaS1hdXRvaXBkKSBpcyB0
aGlzIGlzIGZpbmUgb3IgYW55IG90aGVyIGlzIGF2YWlsYWJsZSA/DQoNClJnZHMNCkNoZXRhbg0K
DQoNCi0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tDQpGcm9tOiBBcnVuIEt1bWFyIFttYWlsdG86
YXJ1bmthdEBnbWFpbC5jb21dIA0KU2VudDogTW9uZGF5LCBPY3RvYmVyIDA0LCAyMDEwIDk6MDYg
UE0NClRvOiBDaGV0YW5rdW1hciBNYW5qZWdvd2RhDQpDYzogbGludXgtYmx1ZXRvb3RoQHZnZXIu
a2VybmVsLm9yZw0KU3ViamVjdDogUmU6IEhvdyBhZGQgc3VwcG9ydCBvZiBMTE1OUiBmb3IgUEFO
DQoNClNob3VsZG4ndCB0aGlzIHN1cHBvcnQgY29tZSBmcm9tIGxpbnV4IGlwIHN0YWNrIHJhdGhl
ciB0aGFuIGJsdWV6Pw0KDQoNCkJlc3QgUmVnYXJkcywNCkFydW4gS3VtYXIgU2luZ2gNCnd3dy5j
cmF6eWRha3MuY29tDQoNCg0KT24gTW9uLCBPY3QgNCwgMjAxMCBhdCA2OjE1IFBNLCBDaGV0YW5r
dW1hciBNYW5qZWdvd2RhDQo8Q2hldGFua3VtYXJfTWFuamVnb3dkYUBtaW5kdHJlZS5jb20+IHdy
b3RlOg0KPg0KPiBIaSBBbGwsDQo+DQo+IEkgd2FudCB0byBrbm93IGhvdyB0byBlbmFibGUvSW50
ZWdyYXRlIExMTU5SIGZvciBQQU4gcHJvZmlsZS4NCj4NCj4gQ2FuIGFueW9uZSBnaXZlIHNvbWUg
c3VnZ2VzdGlvbnMgb3IgbGluayB3aGVyZSBJIGNhbiByZWZlciB0aGUgc2FtZSA/Pw0KPg0KPiBS
Z2RzDQo+IENoZXRhbg0KPg0KPiBfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXw0KPg0K
PiBodHRwOi8vd3d3Lm1pbmR0cmVlLmNvbS9lbWFpbC9kaXNjbGFpbWVyLmh0bWwNCj4gLS0NCj4g
VG8gdW5zdWJzY3JpYmUgZnJvbSB0aGlzIGxpc3Q6IHNlbmQgdGhlIGxpbmUgInVuc3Vic2NyaWJl
IGxpbnV4LWJsdWV0b290aCIgaW4NCj4gdGhlIGJvZHkgb2YgYSBtZXNzYWdlIHRvIG1ham9yZG9t
b0B2Z2VyLmtlcm5lbC5vcmcNCj4gTW9yZSBtYWpvcmRvbW8gaW5mbyBhdCDCoGh0dHA6Ly92Z2Vy
Lmtlcm5lbC5vcmcvbWFqb3Jkb21vLWluZm8uaHRtbA0KDQoNCg0KLS0NCg==
^ permalink raw reply
* [PATCH] Bluetooth: Support for new firmware for ath3k USB Bluetooth device
From: Suraj Sumangala @ 2010-10-05 6:17 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Jothikumar.Mothilal, Suraj Sumangala
This patch add support for new ath3k USB Bluetooth device firmare.
The firmware implements shared antenna support and
fixes few critical bugs.
Signed-off-by: Suraj Sumangala <suraj@atheros.com>
---
drivers/bluetooth/ath3k.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 128cae4..eb79a8f 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -103,6 +103,9 @@ error:
return err;
}
+#define FW_COUNT 2
+#define FW_PREFIX "ath3k-"
+#define MAXPATHLEN 30
static int ath3k_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
@@ -110,6 +113,8 @@ static int ath3k_probe(struct usb_interface *intf,
struct usb_device *udev = interface_to_usbdev(intf);
struct ath3k_data *data;
int size;
+ int i;
+ char fw_file[MAXPATHLEN];
BT_DBG("intf %p id %p", intf, id);
@@ -122,7 +127,16 @@ static int ath3k_probe(struct usb_interface *intf,
data->udev = udev;
- if (request_firmware(&firmware, "ath3k-1.fw", &udev->dev) < 0) {
+ for (i = FW_COUNT; i > 0; i--) {
+ snprintf(fw_file, MAXPATHLEN - 1, "%s%d.fw", FW_PREFIX, i);
+
+ if (request_firmware(&firmware, fw_file,
+ &udev->dev) >= 0)
+ break;
+
+ }
+
+ if (!i) {
kfree(data);
return -EIO;
}
--
1.7.0.4
^ permalink raw reply related
* Re: [PATCH] Bluetooth: Add support to specify patch download location
From: Johan Hedberg @ 2010-10-05 6:56 UTC (permalink / raw)
To: Suraj Sumangala; +Cc: linux-bluetooth, Jothikumar.Mothilal
In-Reply-To: <1286175976-20477-1-git-send-email-suraj@atheros.com>
Hi,
On Mon, Oct 04, 2010, Suraj Sumangala wrote:
> This patch add support for specifying patch download address for
> AR300x patch download logic.
>
> ---
> tools/hciattach_ath3k.c | 52 +++++++++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 50 insertions(+), 2 deletions(-)
The patch has been pushed upstream. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH] Bluetooth: Support for new firmware for ath3k USB Bluetooth device
From: David Vrabel @ 2010-10-05 7:01 UTC (permalink / raw)
To: Suraj Sumangala; +Cc: linux-bluetooth, Jothikumar.Mothilal
In-Reply-To: <1286259436-25424-1-git-send-email-suraj@atheros.com>
On 05/10/2010 07:17, Suraj Sumangala wrote:
> This patch add support for new ath3k USB Bluetooth device firmare.
> The firmware implements shared antenna support and
> fixes few critical bugs.
[...]
> static int ath3k_probe(struct usb_interface *intf,
> const struct usb_device_id *id)
> {
> @@ -110,6 +113,8 @@ static int ath3k_probe(struct usb_interface *intf,
> struct usb_device *udev = interface_to_usbdev(intf);
> struct ath3k_data *data;
> int size;
> + int i;
> + char fw_file[MAXPATHLEN]
Suggest FW_PATH_LEN here to avoid confusion as most people would expect
MAXPATHLEN to be enormous.
> BT_DBG("intf %p id %p", intf, id);
>
> @@ -122,7 +127,16 @@ static int ath3k_probe(struct usb_interface *intf,
>
> data->udev = udev;
>
> - if (request_firmware(&firmware, "ath3k-1.fw", &udev->dev) < 0) {
Why not request ath3k-1.fw (for backward compatibility) and ath3k.fw and
symlink this name to ath3k-2.fw or any future version of firmware?
I think users should be able to update firmware without a kernel update
where possible.
David
^ permalink raw reply
* Re: pull-request: bluetooth-2.6 2010-09-27
From: David Miller @ 2010-10-05 7:06 UTC (permalink / raw)
To: padovan; +Cc: linville, marcel, linux-bluetooth, netdev
In-Reply-To: <20101004223513.GB3234@vigoh>
From: "Gustavo F. Padovan" <padovan@profusion.mobi>
Date: Mon, 4 Oct 2010 19:35:13 -0300
> Follow the output of git show for that change, if we agree on the change I
> can append it to the bluetooth pull request.
That makes sense to me, thanks for doing this audit.
Append that commit and send a new pull request.
Thanks!
^ permalink raw reply
* Re: Inquiry_with_RSSI compatible dongles
From: Marcel Holtmann @ 2010-10-05 7:36 UTC (permalink / raw)
To: Giedo Mak; +Cc: linux-bluetooth
In-Reply-To: <AANLkTi=uuyRQ-9Qj1THDvOroE3yLU7ZBJS_tX26h0O4y@mail.gmail.com>
Hi Giedo,
> I'm working on a bluetooth program with some sort of distance sensing/tracking.
> To make this easier I came across a feature called inquiry_with_RSSI.
> Could somebody tell me what kind of dongles support this feature. I
> mean, does every 2.1 BT dongle support it, or can you only find out
> once you get one in your hands?
in general every Bluetooth 1.2 dongle and later should support Inquiry
with RSSI. I still have to come across a 2.1 dongle that doesn't.
Regards
Marcel
^ permalink raw reply
* Re: [PATCH] Bluetooth: Support for new firmware for ath3k USB Bluetooth device
From: Marcel Holtmann @ 2010-10-05 7:38 UTC (permalink / raw)
To: David Vrabel; +Cc: Suraj Sumangala, linux-bluetooth, Jothikumar.Mothilal
In-Reply-To: <4CAACD5A.8040304@csr.com>
Hi David,
> > This patch add support for new ath3k USB Bluetooth device firmare.
> > The firmware implements shared antenna support and
> > fixes few critical bugs.
> [...]
> > static int ath3k_probe(struct usb_interface *intf,
> > const struct usb_device_id *id)
> > {
> > @@ -110,6 +113,8 @@ static int ath3k_probe(struct usb_interface *intf,
> > struct usb_device *udev = interface_to_usbdev(intf);
> > struct ath3k_data *data;
> > int size;
> > + int i;
> > + char fw_file[MAXPATHLEN]
>
> Suggest FW_PATH_LEN here to avoid confusion as most people would expect
> MAXPATHLEN to be enormous.
>
> > BT_DBG("intf %p id %p", intf, id);
> >
> > @@ -122,7 +127,16 @@ static int ath3k_probe(struct usb_interface *intf,
> >
> > data->udev = udev;
> >
> > - if (request_firmware(&firmware, "ath3k-1.fw", &udev->dev) < 0) {
>
> Why not request ath3k-1.fw (for backward compatibility) and ath3k.fw and
> symlink this name to ath3k-2.fw or any future version of firmware?
>
> I think users should be able to update firmware without a kernel update
> where possible.
yes, it is mandatory to support at least the last two firmware version.
Just forcing a firmware update with a new kernel is not going to work.
So NAK on this patch.
Regards
Marcel
^ permalink raw reply
* [PATCH] Fix use of uninitialised variable on legacy pairing
From: Luiz Augusto von Dentz @ 2010-10-05 7:40 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
Regression caused by e7daece858070d71cecf6ade4f0e3c93272c53ac:
==23899== Use of uninitialised value of size 4
==23899== at 0x49CD888: _itoa_word (_itoa.c:196)
==23899== by 0x49D1109: vfprintf (vfprintf.c:1613)
==23899== by 0x4A7506C: __vsprintf_chk (vsprintf_chk.c:86)
==23899== by 0x4A74FAC: __sprintf_chk (sprintf_chk.c:33)
==23899== by 0x4830E08: ba2str (stdio2.h:34)
==23899== by 0x1496B3: set_pin_length (security.c:514)
==23899== by 0x168399: pincode_cb (dbus-hci.c:179)
==23899== by 0x162E0D: pincode_cb (device.c:2135)
==23899== by 0x15AD55: pincode_reply (agent.c:416)
==23899== by 0x49467E0: ??? (in /lib/libdbus-1.so.3.5.2)
==23899== by 0x4934975: ??? (in /lib/libdbus-1.so.3.5.2)
==23899== by 0x4937B81: dbus_connection_dispatch (in /lib/libdbus-1.so.3.5.2)
==23899==
==23899== Conditional jump or move depends on uninitialised value(s)
==23899== at 0x49CD893: _itoa_word (_itoa.c:196)
==23899== by 0x49D1109: vfprintf (vfprintf.c:1613)
==23899== by 0x4A7506C: __vsprintf_chk (vsprintf_chk.c:86)
==23899== by 0x4A74FAC: __sprintf_chk (sprintf_chk.c:33)
==23899== by 0x4830E08: ba2str (stdio2.h:34)
==23899== by 0x1496B3: set_pin_length (security.c:514)
==23899== by 0x168399: pincode_cb (dbus-hci.c:179)
==23899== by 0x162E0D: pincode_cb (device.c:2135)
==23899== by 0x15AD55: pincode_reply (agent.c:416)
==23899== by 0x49467E0: ??? (in /lib/libdbus-1.so.3.5.2)
==23899== by 0x4934975: ??? (in /lib/libdbus-1.so.3.5.2)
==23899== by 0x4937B81: dbus_connection_dispatch (in /lib/libdbus-1.so.3.5.2)
---
src/dbus-hci.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/dbus-hci.c b/src/dbus-hci.c
index b93dbcd..7309883 100644
--- a/src/dbus-hci.c
+++ b/src/dbus-hci.c
@@ -167,6 +167,7 @@ static void pincode_cb(struct agent *agent, DBusError *derr,
bdaddr_t sba, dba;
int err;
+ adapter_get_address(adapter, &sba);
device_get_address(device, &dba);
err = btd_adapter_pincode_reply(adapter, &dba, derr ? NULL : pincode);
--
1.7.1
^ permalink raw reply related
* Re: [PATCH] Added firmware load patch to crap directory.
From: Marcel Holtmann @ 2010-10-05 7:46 UTC (permalink / raw)
To: Bala Shanmugam; +Cc: linux-wireless, linux-bluetooth, linux-kernel
In-Reply-To: <1286118002-2354-1-git-send-email-sbalashanmugam@atheros.com>
Hi Bala,
> This patch in crap directory enables btusb to load firmware
> to device RAM when it is plugged in.
> Signed-off-by: Bala Shanmugam <sbalashanmugam@atheros.com>
> ---
> crap/0003-btusb-Add-fw-load-support.patch | 424 +++++++++++++++++++++++++++++
> 1 files changed, 424 insertions(+), 0 deletions(-)
> create mode 100644 crap/0003-btusb-Add-fw-load-support.patch
>
> diff --git a/crap/0003-btusb-Add-fw-load-support.patch b/crap/0003-btusb-Add-fw-load-support.patch
> new file mode 100644
> index 0000000..6642d6b
> --- /dev/null
> +++ b/crap/0003-btusb-Add-fw-load-support.patch
> @@ -0,0 +1,424 @@
> +Reason for not yet publishing: Marcel feels that Atheros sflash based BT device
> +doesn't follow bluetooth H:2 specification and HCI commands should be supported
> +in firmware if it is detected as bluetooth device. Using HCI command, firmware
> +should be loaded.
> +
> +In sflash based device there is not enough memory to support HCI commands in firmware.
> +So load firmware from btusb when the device comes up.
and why are you just not fixing this properly. You can have a custom
firmware loader with a different product ID. Load the firmware and then
on reset it brings it up with proper Bluetooth USB class identifiers.
Nothing demands that the firmware loading happens via HCI. You can
invent your own protocol easily. See bcm203x firmware loader driver that
has been around since the beginning of Bluetooth.
Regards
Marcel
^ permalink raw reply
* Re: [PATCHv1 0/5] Bluetooth: experimental support for pm_limits
From: Marcel Holtmann @ 2010-10-05 7:49 UTC (permalink / raw)
To: Emeltchenko Andrei; +Cc: linux-bluetooth
In-Reply-To: <1285937230-547-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
> First version of using power constraints interface to achieve
> maximum bluetooth transfer speed. Otherwise HW goes to idle mode
> and speed decreases 3 times.
>
> Use empirical power management analyzer (TM) to define amount
> of time device set high power constraints for.
>
> May include hacks :-)
please send these as [RFC] and not as [PATCH] if they are meant for
review.
Regards
Marcel
^ permalink raw reply
* Re: [PATCH] Added firmware load patch to crap directory. This patch loads firmware from btusb when device is plugged in.
From: Marcel Holtmann @ 2010-10-05 7:52 UTC (permalink / raw)
To: Luis R. Rodriguez
Cc: Bala Shanmugam, linux-wireless, linux-bluetooth, linux-kernel
In-Reply-To: <AANLkTinjiJ6FyoAi4aP=8pr9EwV0wpV7LtwQx-hwaOFs@mail.gmail.com>
Hi Luis,
> > Marcel feels that Atheros sflash based BT device
> > +doesn't follow bluetooth H:2 specification and HCI commands should be supported
> > +in firmware if it is detected as bluetooth device. Using HCI command, firmware
> > +should be loaded.
> > +
> > +In sfash based device we don't have enough memory to support HCI commands in firmware.
> > +So load firmware from btusb when the device comes up.
> > +
>
> You should still ask the maintainer for an alternative, otherwise the
> device unusable. Did you submit the patch first in [PATCH] form? If
> not please submit the patch, all I saw as an RFC and no followup at
> all.
I think it is pretty clear how these devices should be designed when it
comes to firmware loading. Just having different USB PIDs for firmware
loading stage and fully functional Bluetooth device stage is not that
hard to do. Other companies have done this.
If you device claims Bluetooth USB class descriptors, then it should
behave like that and offer HCI protocol running on it.
Regards
Marcel
^ permalink raw reply
* Re: [PATCH] Bluetooth: clean up rfcomm code
From: Marcel Holtmann @ 2010-10-05 7:53 UTC (permalink / raw)
To: Emeltchenko Andrei; +Cc: linux-bluetooth
In-Reply-To: <1285923911-12902-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
> Remove dead code and unused rfcomm thread events
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>
> ---
> include/net/bluetooth/rfcomm.h | 5 -----
> net/bluetooth/rfcomm/core.c | 29 ++++++++++++++---------------
> 2 files changed, 14 insertions(+), 20 deletions(-)
>
> diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
> index a140847..71047bc 100644
> --- a/include/net/bluetooth/rfcomm.h
> +++ b/include/net/bluetooth/rfcomm.h
> @@ -213,11 +213,6 @@ struct rfcomm_dlc {
> #define RFCOMM_DEFER_SETUP 8
>
> /* Scheduling flags and events */
> -#define RFCOMM_SCHED_STATE 0
> -#define RFCOMM_SCHED_RX 1
> -#define RFCOMM_SCHED_TX 2
> -#define RFCOMM_SCHED_TIMEO 3
> -#define RFCOMM_SCHED_AUTH 4
> #define RFCOMM_SCHED_WAKEUP 31
we had some big ambition to use these, but never did in the end or
realized that they are not needed. So I am fine with removing these.
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply
* Re: Sim Access profile server implementation
From: Marcel Holtmann @ 2010-10-05 8:02 UTC (permalink / raw)
To: suraj; +Cc: linux-bluetooth@vger.kernel.org, Jothikumar Mothilal
In-Reply-To: <1285657515.12097.7.camel@atheros013-desktop>
Hi Suraj,
> Please find the Git tree for the Sim access profile server role
> implementation I have been working on at
>
> git://gitorious.org/sap-server/sap-server.git
>
> Not sure it could be directly used with Bluez. Nevertheless, it has the
> parser implementation of Bluetooth SAP packet. Someone could possibly
> reuse it in their implementation.
have you actually tested this with real SAP server capable hardware? I
am still not convinced at all to push APDU over D-Bus. First, there is
potential security issue here and second the latency that D-Bus
introduces seems not be acceptable. So what I am getting it, can this be
actually used in a product that seriously wants to support SAP server?
Regards
Marcel
^ permalink raw reply
* Re: [PATCH] Fix use of uninitialised variable on legacy pairing
From: Johan Hedberg @ 2010-10-05 8:20 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1286264425-24281-1-git-send-email-luiz.dentz@gmail.com>
Hi Luiz,
On Tue, Oct 05, 2010, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
>
> Regression caused by e7daece858070d71cecf6ade4f0e3c93272c53ac:
>
> ==23899== Use of uninitialised value of size 4
> ==23899== at 0x49CD888: _itoa_word (_itoa.c:196)
> ==23899== by 0x49D1109: vfprintf (vfprintf.c:1613)
> ==23899== by 0x4A7506C: __vsprintf_chk (vsprintf_chk.c:86)
> ==23899== by 0x4A74FAC: __sprintf_chk (sprintf_chk.c:33)
> ==23899== by 0x4830E08: ba2str (stdio2.h:34)
> ==23899== by 0x1496B3: set_pin_length (security.c:514)
> ==23899== by 0x168399: pincode_cb (dbus-hci.c:179)
> ==23899== by 0x162E0D: pincode_cb (device.c:2135)
> ==23899== by 0x15AD55: pincode_reply (agent.c:416)
> ==23899== by 0x49467E0: ??? (in /lib/libdbus-1.so.3.5.2)
> ==23899== by 0x4934975: ??? (in /lib/libdbus-1.so.3.5.2)
> ==23899== by 0x4937B81: dbus_connection_dispatch (in /lib/libdbus-1.so.3.5.2)
> ==23899==
> ==23899== Conditional jump or move depends on uninitialised value(s)
> ==23899== at 0x49CD893: _itoa_word (_itoa.c:196)
> ==23899== by 0x49D1109: vfprintf (vfprintf.c:1613)
> ==23899== by 0x4A7506C: __vsprintf_chk (vsprintf_chk.c:86)
> ==23899== by 0x4A74FAC: __sprintf_chk (sprintf_chk.c:33)
> ==23899== by 0x4830E08: ba2str (stdio2.h:34)
> ==23899== by 0x1496B3: set_pin_length (security.c:514)
> ==23899== by 0x168399: pincode_cb (dbus-hci.c:179)
> ==23899== by 0x162E0D: pincode_cb (device.c:2135)
> ==23899== by 0x15AD55: pincode_reply (agent.c:416)
> ==23899== by 0x49467E0: ??? (in /lib/libdbus-1.so.3.5.2)
> ==23899== by 0x4934975: ??? (in /lib/libdbus-1.so.3.5.2)
> ==23899== by 0x4937B81: dbus_connection_dispatch (in /lib/libdbus-1.so.3.5.2)
> ---
> src/dbus-hci.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
Thanks for the patch. It's now upstream along with another patch to
clean up the logic in this function. Strange that the compiler didn't
catch this issue. Unfortunately we just made a 4.74 release so I guess
there'll be a 4.75 out soonish.
Johan
^ permalink raw reply
* Re: RFC: btusb firmware load help
From: Marcel Holtmann @ 2010-10-05 8:23 UTC (permalink / raw)
To: Luis R. Rodriguez
Cc: linux-bluetooth, linux-kernel, linux-wireless, Deepak Dhamdhere,
Sree Durbha
In-Reply-To: <20100924230730.GB6566@tux>
Hi Luis,
> Marcel, I was just poked about this thread:
>
> http://www.spinics.net/lists/linux-bluetooth/msg06087.html
>
> The hack is required because our BT hardware does not accept HCI commands
> when the device is plugged in. If I understood your position you did not
> want to accept the patch because our BT USB devices are violating the
> specification by not acceping HCI commands and yet claiming to be BT
> devices, is that right?
you don't have to accept HCI commands when your device has no firmware
loaded. That is just fine. However at that point you should not claim to
be a Bluetooth H:2 device with USB Bluetooth descriptors.
Just having different USB PIDs for without firmware and with firmware
stages would have been fine. The ancient Broadcom 203x devices even got
that part right.
So what about sticking with the current VID:PID for the device without
firmware and we blacklist it in btusb driver. And then the firmware
loading ensures that after reset it uses a different PID for the device
with valid HCI firmware.
Regards
Marcel
^ permalink raw reply
* Re: [PATCH 6/6] This patch adds support for using the ST-Ericsson CG2900
From: Marcel Holtmann @ 2010-10-05 8:27 UTC (permalink / raw)
To: Par-Gunnar Hjalmdahl
Cc: Gustavo F. Padovan, linux-bluetooth, linux-kernel, linus.walleij,
Pavan Savoy
In-Reply-To: <AANLkTimdAxaF2gyXXXgYtjQ5+3eXuTpnpQ5n2KFtDwth@mail.gmail.com>
Hi Par-Gunnar,
> > * Par-Gunnar Hjalmdahl <par-gunnar.p.hjalmdahl@stericsson.com> [2010-09-24 15:52:16 +0200]:
> >
> >> This patch adds support for using the ST-Ericsson CG2900
> >> connectivity controller as a driver for the BlueZ Bluetooth
> >> stack.
> >> This patch registers as a driver into the BlueZ framework and, when
> >> opened by BlueZ, it registers as user for bt_cmd, bt_acl, and bt_evt
> >> channels.
> >
> > First of all your your commit message and subject should be improved.
> > The subject should bee something like:
> >
> > "Bluetooth: Add support for ST-Ericsson CG2900"
> >
> > and in the commit message you explain the details of the patch.
> > And normally we do not use the BlueZ word in kernelspace.
> >
>
> OK. This is the first patch I've created within the community and of
> course there are bound to be errors... ;-)
> Since it was part of a big patch delivery I used quite similar names
> across the different patches and I understand that this is an error
> since the different patches are targeting different communities.
>
> >>
> >> Signed-off-by: Par-Gunnar Hjalmdahl <par-gunnar.p.hjalmdahl@stericsson.com>
> >> ---
> >> drivers/bluetooth/Kconfig | 7 +
> >> drivers/bluetooth/Makefile | 2 +
> >> drivers/bluetooth/cg2900_hci.c | 896 ++++++++++++++++++++++++++++++++++++++++
> >> 3 files changed, 905 insertions(+), 0 deletions(-)
> >> create mode 100644 drivers/bluetooth/cg2900_hci.c
> >
> > Your patch looks a way complicated to a UART driver. Look at the others
> > drivers at drivers/bluetooth/ and see how we implemented other UART
> > drivers.
> >
>
> Well, mainly that's because it is not a UART driver. It is a driver
> against CG2900 which currently have only UART as transport but quite
> soon will get SPI as transport as well. For this Bluetooth driver the
> actual physical transport used is not known. It just knows it has a
> reliable transport below which delivers complete Bluetooth packets.
inside the Bluetooth driver please just use BT_DBG. That is hooked up
into dynamic_debug feature of the kernel and you can do whatever you
need for debugging.
I will not accept huge debug frameworks in the Bluetooth subsystem. Use
what the kernel offers you. You selective control based on every single
debug statement. It doesn't get better than that.
Regards
Marcel
^ permalink raw reply
* Re: Sim Access profile server implementation
From: Suraj Sumangala @ 2010-10-05 9:08 UTC (permalink / raw)
To: Marcel Holtmann
Cc: Suraj Sumangala, linux-bluetooth@vger.kernel.org,
Jothikumar Mothilal
In-Reply-To: <1286265730.17473.29.camel@aeonflux>
Hi Marcel,
On 10/5/2010 1:32 PM, Marcel Holtmann wrote:
> Hi Suraj,
>
>> Please find the Git tree for the Sim access profile server role
>> implementation I have been working on at
>>
>> git://gitorious.org/sap-server/sap-server.git
>>
>> Not sure it could be directly used with Bluez. Nevertheless, it has the
>> parser implementation of Bluetooth SAP packet. Someone could possibly
>> reuse it in their implementation.
>
> have you actually tested this with real SAP server capable hardware? I
> am still not convinced at all to push APDU over D-Bus. First, there is
> potential security issue here and second the latency that D-Bus
> introduces seems not be acceptable. So what I am getting it, can this be
> actually used in a product that seriously wants to support SAP server?
No, This was tested with a dummy Agent and PTS. I am yet to get hold of
a hardware.
The reason for sharing the source code was because any later SAP server
implementation can re-use the SAP packet parser implementation I have
already done.
I think we should be able to change the interface later depending on the
actual hardware/system requirement. But, I believe the internal
implementation could stay the same.
>
> Regards
>
> Marcel
>
>
Regards
Suraj
^ permalink raw reply
* Re: [PATCH 6/6] This patch adds support for using the ST-Ericsson CG2900
From: Marcel Holtmann @ 2010-10-05 9:20 UTC (permalink / raw)
To: pghatwork; +Cc: linux-bluetooth, linux-kernel, linus.walleij, Pavan Savoy
In-Reply-To: <AANLkTimOai9_92VuJUZMo26es9Wsu_6d+z36Sv_Q4i+L@mail.gmail.com>
Hi Par-Gunnar,
> This patch adds support for using the ST-Ericsson CG2900
> connectivity controller as a driver for the BlueZ Bluetooth
> stack.
> This patch registers as a driver into the BlueZ framework and, when
> opened by BlueZ, it registers as user for bt_cmd, bt_acl, and bt_evt
> channels.
>
> Signed-off-by: Par-Gunnar Hjalmdahl <par-gunnar.p.hjalmdahl@stericsson.com>
> ---
> drivers/bluetooth/Kconfig | 7 +
> drivers/bluetooth/Makefile | 2 +
> drivers/bluetooth/cg2900_hci.c | 896 ++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 905 insertions(+), 0 deletions(-)
> create mode 100644 drivers/bluetooth/cg2900_hci.c
>
> diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
> index 02deef4..9ca8d69 100644
> --- a/drivers/bluetooth/Kconfig
> +++ b/drivers/bluetooth/Kconfig
> @@ -219,4 +219,11 @@ config BT_ATH3K
> Say Y here to compile support for "Atheros firmware download driver"
> into the kernel or say M to compile it as module (ath3k).
>
> +config BT_CG2900
> + tristate "ST-Ericsson CG2900 driver"
> + depends on MFD_CG2900 && BT
> + help
> + Select if ST-Ericsson CG2900 Connectivity controller shall be used as
> + Bluetooth controller for BlueZ.
> +
> endmenu
> diff --git a/drivers/bluetooth/Makefile b/drivers/bluetooth/Makefile
> index 71bdf13..a479c16 100644
> --- a/drivers/bluetooth/Makefile
> +++ b/drivers/bluetooth/Makefile
> @@ -19,6 +19,8 @@ obj-$(CONFIG_BT_ATH3K) += ath3k.o
> obj-$(CONFIG_BT_MRVL) += btmrvl.o
> obj-$(CONFIG_BT_MRVL_SDIO) += btmrvl_sdio.o
>
> +obj-$(CONFIG_BT_CG2900) += cg2900_hci.o
> +
Please sort this after ath3k and before btmvrl config.
And for the name either just use cg2900 if it uniquely identifies the
Bluetooth chip used in the combo or use btcg2900.o as module name if it
is the name of the combo module.
We clearly moved into the direction of either unique hardware names
without bt prefix or we have the bt prefix in front of it. The fully
generic term hci will be phased out of the driver names.
> btmrvl-y := btmrvl_main.o
> btmrvl-$(CONFIG_DEBUG_FS) += btmrvl_debugfs.o
>
> diff --git a/drivers/bluetooth/cg2900_hci.c b/drivers/bluetooth/cg2900_hci.c
> new file mode 100644
> index 0000000..de1ada8
> --- /dev/null
> +++ b/drivers/bluetooth/cg2900_hci.c
> @@ -0,0 +1,896 @@
> +/*
> + * drivers/bluetooth/cg2900_hci.c
> + *
> + * Copyright (C) ST-Ericsson SA 2010
> + * Authors:
> + * Par-Gunnar Hjalmdahl (par-gunnar.p.hjalmdahl@stericsson.com) for
> ST-Ericsson.
> + * Henrik Possung (henrik.possung@stericsson.com) for ST-Ericsson.
> + * Josef Kindberg (josef.kindberg@stericsson.com) for ST-Ericsson.
> + * Dariusz Szymszak (dariusz.xd.szymczak@stericsson.com) for ST-Ericsson.
> + * Kjell Andersson (kjell.k.andersson@stericsson.com) for ST-Ericsson.
> + * License terms: GNU General Public License (GPL), version 2
> + *
> + * Linux Bluetooth HCI H:4 Driver for ST-Ericsson CG2900 connectivity
> controller
> + * towards the BlueZ Bluetooth stack.
> + */
Drop the filename in this header and don't bother with the description
towards BlueZ or Bluetooth subsystem. That is clear from the location of
the file.
Also what is up with the "for ST-Ericsson"?
> +
> +#include <linux/module.h>
> +#include <linux/types.h>
> +#include <linux/skbuff.h>
> +#include <asm/byteorder.h>
> +#include <net/bluetooth/bluetooth.h>
> +#include <net/bluetooth/hci.h>
> +#include <net/bluetooth/hci_core.h>
> +
> +#include <linux/workqueue.h>
> +#include <linux/wait.h>
> +#include <linux/time.h>
> +#include <linux/jiffies.h>
> +#include <linux/sched.h>
> +#include <linux/timer.h>
> +
> +#include <linux/mfd/cg2900.h>
> +#include <mach/cg2900_devices.h>
> +
> +/* module_param declared in cg2900_core.c */
> +extern int cg2900_debug_level;
> +
> +#define NAME "CG2900 HCI"
> +
> +/* Debug defines */
> +#define CG2900_DBG_DATA(fmt, arg...) \
> +do { \
> + if (cg2900_debug_level >= 25) \
> + printk(KERN_DEBUG NAME " %s: " fmt "\n" , __func__ , ## arg); \
> +} while (0)
> +
> +#define CG2900_DBG(fmt, arg...) \
> +do { \
> + if (cg2900_debug_level >= 20) \
> + printk(KERN_DEBUG NAME " %s: " fmt "\n" , __func__ , ## arg); \
> +} while (0)
> +
> +#define CG2900_INFO(fmt, arg...) \
> +do { \
> + if (cg2900_debug_level >= 10) \
> + printk(KERN_INFO NAME ": " fmt "\n" , ## arg); \
> +} while (0)
> +
> +#define CG2900_ERR(fmt, arg...) \
> +do { \
> + if (cg2900_debug_level >= 1) \
> + printk(KERN_ERR NAME " %s: " fmt "\n" , __func__ , ## arg); \
> +} while (0)
Remove all this debug stuff. Use BT_DBG, BT_ERR etc.
> +#define CG2900_SET_STATE(__name, __var, __new_state) \
> +do { \
> + CG2900_DBG("New %s: 0x%X", __name, (uint32_t)__new_state); \
> + __var = __new_state; \
> +} while (0)
What is this for? Please don't do that. It just obfuscates the code.
> +/* HCI device type */
> +#define HCI_CG2900 HCI_VIRTUAL
This is the wrong type. Don't do that. And don't create a new define for
it. Use the standard types. I assume that HCI_UART is most likely what
you want here.
> +/* Wait for 5 seconds for a response to our requests */
> +#define RESP_TIMEOUT 5000
> +
> +/* State-setting defines */
> +#define SET_RESET_STATE(__hci_reset_new_state) \
> + CG2900_SET_STATE("reset_state", hci_info->reset_state, \
> + __hci_reset_new_state)
> +#define SET_ENABLE_STATE(__hci_enable_new_state) \
> + CG2900_SET_STATE("enable_state", hci_info->enable_state, \
> + __hci_enable_new_state)
Don't do this. It is just highly obfuscating the code flow.
> +/* Bluetooth error codes */
> +#define HCI_ERR_NO_ERROR 0x00
> +#define HCI_ERR_CMD_DISALLOWED 0x0C
> +
> +/**
> + * enum reset_state - RESET-states of the HCI driver.
> + *
> + * @RESET_IDLE: No reset in progress.
> + * @RESET_ACTIVATED: Reset in progress.
> + * @RESET_UNREGISTERED: hdev is unregistered.
> + */
> +
> +enum reset_state {
> + RESET_IDLE,
> + RESET_ACTIVATED,
> + RESET_UNREGISTERED
> +};
> +
> +/**
> + * enum enable_state - ENABLE-states of the HCI driver.
> + *
> + * @ENABLE_IDLE: The HCI driver is loaded but not opened.
> + * @ENABLE_WAITING_BT_ENABLED_CC: The HCI driver is waiting for a command
> + * complete event from the BT chip as a
> + * response to a BT Enable (true) command.
> + * @ENABLE_BT_ENABLED: The BT chip is enabled.
> + * @ENABLE_WAITING_BT_DISABLED_CC: The HCI driver is waiting for a command
> + * complete event from the BT chip as a
> + * response to a BT Enable (false) command.
> + * @ENABLE_BT_DISABLED: The BT chip is disabled.
> + * @ENABLE_BT_ERROR: The HCI driver is in a bad state, some
> + * thing has failed and is not expected to
> + * work properly.
> + */
> +enum enable_state {
> + ENABLE_IDLE,
> + ENABLE_WAITING_BT_ENABLED_CC,
> + ENABLE_BT_ENABLED,
> + ENABLE_WAITING_BT_DISABLED_CC,
> + ENABLE_BT_DISABLED,
> + ENABLE_BT_ERROR
> +};
> +
> +/**
> + * struct hci_info - Specifies HCI driver private data.
> + *
> + * This type specifies CG2900 HCI driver private data.
> + *
> + * @bt_cmd: Device structure for BT command channel.
> + * @bt_evt: Device structure for BT event channel.
> + * @bt_acl: Device structure for BT ACL channel.
> + * @hdev: Device structure for HCI device.
> + * @reset_state: Device enum for HCI driver reset state.
> + * @enable_state: Device enum for HCI driver BT enable state.
> + */
> +struct hci_info {
> + struct cg2900_device *bt_cmd;
> + struct cg2900_device *bt_evt;
> + struct cg2900_device *bt_acl;
> + struct hci_dev *hdev;
> + enum reset_state reset_state;
> + enum enable_state enable_state;
> +};
> +
> +/**
> + * struct dev_info - Specifies private data used when receiving
> callbacks from CPD.
> + *
> + * @hdev: Device structure for HCI device.
> + * @hci_data_type: Type of data according to BlueZ.
> + */
> +struct dev_info {
> + struct hci_dev *hdev;
> + u8 hci_data_type;
> +};
> +
> +/* Variables where LSB and MSB for bt_enable command is stored */
> +static u16 bt_enable_cmd;
> +
> +static struct hci_info *hci_info;
> +
> +/*
> + * hci_wait_queue - Main Wait Queue in HCI driver.
> + */
> +static DECLARE_WAIT_QUEUE_HEAD(hci_wait_queue);
> +
> +/* Internal function declarations */
> +static int register_to_bluez(void);
Don't use bluez in kernel code. Just use bluetooth or bt.
> +/* Internal functions */
> +
> +/**
> + * remove_bt_users() - Unregister and remove any existing BT users.
> + * @info: HCI driver info structure.
> + */
> +static void remove_bt_users(struct hci_info *info)
> +{
> + if (info->bt_cmd) {
> + kfree(info->bt_cmd->user_data);
> + info->bt_cmd->user_data = NULL;
> + cg2900_deregister_user(info->bt_cmd);
> + info->bt_cmd = NULL;
> + }
> +
> + if (info->bt_evt) {
> + kfree(info->bt_evt->user_data);
> + info->bt_evt->user_data = NULL;
> + cg2900_deregister_user(info->bt_evt);
> + info->bt_evt = NULL;
> + }
> +
> + if (info->bt_acl) {
> + kfree(info->bt_acl->user_data);
> + info->bt_acl->user_data = NULL;
> + cg2900_deregister_user(info->bt_acl);
> + info->bt_acl = NULL;
> + }
> +}
> +
> +/**
> + * hci_read_cb() - Callback for handling data received from CG2900 driver.
> + * @dev: Device receiving data.
> + * @skb: Buffer with data coming from device.
> + */
> +static void hci_read_cb(struct cg2900_device *dev, struct sk_buff *skb)
> +{
> + int err = 0;
> + struct dev_info *dev_info;
> + struct hci_event_hdr *evt;
> + struct hci_ev_cmd_complete *cmd_complete;
> + struct hci_ev_cmd_status *cmd_status;
> + u8 status;
> +
> + if (!skb) {
> + CG2900_ERR("NULL supplied for skb");
> + return;
> + }
> +
> + if (!dev) {
> + CG2900_ERR("dev == NULL");
> + goto fin_free_skb;
> + }
> +
> + dev_info = (struct dev_info *)dev->user_data;
> +
> + if (!dev_info) {
> + CG2900_ERR("dev_info == NULL");
> + goto fin_free_skb;
> + }
> +
> + evt = (struct hci_event_hdr *)skb->data;
> + cmd_complete = (struct hci_ev_cmd_complete *)(skb->data + sizeof(*evt));
> + cmd_status = (struct hci_ev_cmd_status *)(skb->data + sizeof(*evt));
> +
> + /*
> + * Check if HCI Driver it self is expecting a Command Complete packet
> + * from the chip after a BT Enable command.
> + */
> + if ((hci_info->enable_state == ENABLE_WAITING_BT_ENABLED_CC ||
> + hci_info->enable_state == ENABLE_WAITING_BT_DISABLED_CC) &&
> + hci_info->bt_evt->h4_channel == dev->h4_channel &&
> + evt->evt == HCI_EV_CMD_COMPLETE &&
> + le16_to_cpu(cmd_complete->opcode) == bt_enable_cmd) {
> + /*
> + * This is the command complete event for
> + * the HCI_Cmd_VS_Bluetooth_Enable.
> + * Check result and update state.
> + *
> + * The BT chip is enabled/disabled. Either it was enabled/
> + * disabled now (status NO_ERROR) or it was already enabled/
> + * disabled (assuming status CMD_DISALLOWED is already enabled/
> + * disabled).
> + */
> + status = *(skb->data + sizeof(*evt) + sizeof(*cmd_complete));
> + if (status != HCI_ERR_NO_ERROR &&
> + status != HCI_ERR_CMD_DISALLOWED) {
> + CG2900_ERR("Could not enable/disable BT core (0x%X)",
> + status);
> + SET_ENABLE_STATE(ENABLE_BT_ERROR);
> + goto fin_free_skb;
> + }
> +
> + if (hci_info->enable_state == ENABLE_WAITING_BT_ENABLED_CC) {
> + SET_ENABLE_STATE(ENABLE_BT_ENABLED);
> + CG2900_INFO("BT core is enabled");
> + } else {
> + SET_ENABLE_STATE(ENABLE_BT_DISABLED);
> + CG2900_INFO("BT core is disabled");
> + }
> +
> + /* Wake up whom ever is waiting for this result. */
> + wake_up_interruptible(&hci_wait_queue);
> + goto fin_free_skb;
> + } else if ((hci_info->enable_state == ENABLE_WAITING_BT_DISABLED_CC ||
> + hci_info->enable_state == ENABLE_WAITING_BT_ENABLED_CC) &&
> + hci_info->bt_evt->h4_channel == dev->h4_channel &&
> + evt->evt == HCI_EV_CMD_STATUS &&
> + le16_to_cpu(cmd_status->opcode) == bt_enable_cmd) {
> + /*
> + * Clear the status events since the Bluez is not expecting
> + * them.
> + */
> + CG2900_DBG("HCI Driver received Command Status(for "
> + "BT enable): 0x%X", cmd_status->status);
> + /*
> + * This is the command status event for
> + * the HCI_Cmd_VS_Bluetooth_Enable.
> + * Just free the packet.
> + */
> + goto fin_free_skb;
> + } else {
> + bt_cb(skb)->pkt_type = dev_info->hci_data_type;
> + skb->dev = (struct net_device *)dev_info->hdev;
> + /* Update BlueZ stats */
> + dev_info->hdev->stat.byte_rx += skb->len;
> + if (bt_cb(skb)->pkt_type == HCI_ACLDATA_PKT)
> + dev_info->hdev->stat.acl_rx++;
> + else
> + dev_info->hdev->stat.evt_rx++;
> +
> + CG2900_DBG_DATA("Data receive %d bytes", skb->len);
> +
> + /* Provide BlueZ with received frame*/
> + err = hci_recv_frame(skb);
> + /* If err, skb have been freed in hci_recv_frame() */
> + if (err)
> + CG2900_ERR("Failed in supplying packet to BlueZ (%d)",
> + err);
> + }
> +
> + return;
> +
> +fin_free_skb:
> + kfree_skb(skb);
> +}
> +
> +/**
> + * hci_reset_cb() - Callback for handling reset from CG2900 driver.
> + * @dev: CPD device resetting.
> + */
> +static void hci_reset_cb(struct cg2900_device *dev)
> +{
> + int err;
> + struct hci_dev *hdev;
> + struct dev_info *dev_info;
> + struct hci_info *info;
> +
> + CG2900_INFO("BluezDriver: hci_reset_cb");
> +
> + if (!dev) {
> + CG2900_ERR("NULL supplied for dev");
> + return;
> + }
> +
> + dev_info = (struct dev_info *)dev->user_data;
> + if (!dev_info) {
> + CG2900_ERR("NULL supplied for dev_info");
> + return;
> + }
> +
> + hdev = dev_info->hdev;
> + if (!hdev) {
> + CG2900_ERR("NULL supplied for hdev");
> + return;
> + }
> +
> + info = (struct hci_info *)hdev->driver_data;
> + if (!info) {
> + CG2900_ERR("NULL supplied for driver_data");
> + return;
> + }
> +
> + switch (dev_info->hci_data_type) {
> +
> + case HCI_EVENT_PKT:
> + info->bt_evt = NULL;
> + break;
> +
> + case HCI_COMMAND_PKT:
> + info->bt_cmd = NULL;
> + break;
> +
> + case HCI_ACLDATA_PKT:
> + info->bt_acl = NULL;
> + break;
> +
> + default:
> + CG2900_ERR("Unknown HCI data type:%d",
> + dev_info->hci_data_type);
> + return;
> + }
> +
> + SET_RESET_STATE(RESET_ACTIVATED);
> +
> + /* Free userdata as device info structure will be freed by CG2900
> + * when this callback returns */
> + kfree(dev->user_data);
> + dev->user_data = NULL;
> +
> + /*
> + * Continue to deregister hdev if all channels has been reset else
> + * return.
> + */
> + if (info->bt_evt || info->bt_cmd || info->bt_acl)
> + return;
> +
> + /*
> + * Deregister HCI device. Close and Destruct functions should
> + * in turn be called by BlueZ.
> + */
> + CG2900_INFO("Deregister HCI device");
> + err = hci_unregister_dev(hdev);
> + if (err)
> + CG2900_ERR("Can not deregister HCI device! (%d)", err);
> + /*
> + * Now we are in trouble. Try to register a new hdev
> + * anyway even though this will cost some memory.
> + */
> +
> + wait_event_interruptible_timeout(hci_wait_queue,
> + (RESET_UNREGISTERED == hci_info->reset_state),
> + msecs_to_jiffies(RESP_TIMEOUT));
> + if (RESET_UNREGISTERED != hci_info->reset_state)
> + /*
> + * Now we are in trouble. Try to register a new hdev
> + * anyway even though this will cost some memory.
> + */
> + CG2900_ERR("Timeout expired. Could not deregister HCI device");
> +
> + /* Init and register hdev */
> + CG2900_INFO("Register HCI device");
> + err = register_to_bluez();
> + if (err)
> + CG2900_ERR("HCI Device registration error (%d).", err);
> +}
> +
> +/*
> + * struct cg2900_cb - Specifies callback structure for CG2900 user.
> + *
> + * @read_cb: Callback function called when data is received from
> + * the controller.
> + * @reset_cb: Callback function called when the controller has been reset.
> + */
> +static struct cg2900_callbacks cg2900_cb = {
> + .read_cb = hci_read_cb,
> + .reset_cb = hci_reset_cb
> +};
> +
> +/**
> + * open_from_hci() - Open HCI interface.
> + * @hdev: HCI device being opened.
> + *
> + * BlueZ callback function for opening HCI interface to device.
> + *
> + * Returns:
> + * 0 if there is no error.
> + * -EINVAL if NULL pointer is supplied.
> + * -EOPNOTSUPP if supplied packet type is not supported.
> + * -EBUSY if device is already opened.
> + * -EACCES if opening of channels failed.
> + */
> +static int open_from_hci(struct hci_dev *hdev)
> +{
> + struct hci_info *info;
> + struct dev_info *dev_info;
> + struct sk_buff *enable_cmd;
> + int err;
> +
> + CG2900_INFO("Open ST-Ericsson connectivity HCI driver");
> +
> + if (!hdev) {
> + CG2900_ERR("NULL supplied for hdev");
> + return -EINVAL;
> + }
> +
> + info = (struct hci_info *)hdev->driver_data;
> + if (!info) {
> + CG2900_ERR("NULL supplied for driver_data");
> + return -EINVAL;
> + }
> +
> + if (test_and_set_bit(HCI_RUNNING, &(hdev->flags))) {
> + CG2900_ERR("Device already opened!");
> + return -EBUSY;
> + }
> +
> + if (!(info->bt_cmd)) {
> + info->bt_cmd = cg2900_register_user(CG2900_BT_CMD,
> + &cg2900_cb);
> + if (info->bt_cmd) {
> + dev_info = kmalloc(sizeof(*dev_info), GFP_KERNEL);
> + if (dev_info) {
> + dev_info->hdev = hdev;
> + dev_info->hci_data_type = HCI_COMMAND_PKT;
> + }
> + info->bt_cmd->user_data = dev_info;
> + } else {
> + CG2900_ERR("Couldn't register CG2900_BT_CMD to CG2900");
> + err = -EACCES;
> + goto handle_error;
> + }
> + }
> +
> + if (!(info->bt_evt)) {
> + info->bt_evt = cg2900_register_user(CG2900_BT_EVT,
> + &cg2900_cb);
> + if (info->bt_evt) {
> + dev_info = kmalloc(sizeof(*dev_info), GFP_KERNEL);
> + if (dev_info) {
> + dev_info->hdev = hdev;
> + dev_info->hci_data_type = HCI_EVENT_PKT;
> + }
> + info->bt_evt->user_data = dev_info;
> + } else {
> + CG2900_ERR("Couldn't register CG2900_BT_EVT to CG2900");
> + err = -EACCES;
> + goto handle_error;
> + }
> + }
> +
> + if (!(info->bt_acl)) {
> + info->bt_acl = cg2900_register_user(CG2900_BT_ACL,
> + &cg2900_cb);
> + if (info->bt_acl) {
> + dev_info = kmalloc(sizeof(*dev_info), GFP_KERNEL);
> + if (dev_info) {
> + dev_info->hdev = hdev;
> + dev_info->hci_data_type = HCI_ACLDATA_PKT;
> + }
> + info->bt_acl->user_data = dev_info;
> + } else {
> + CG2900_ERR("Couldn't register CG2900_BT_ACL to CG2900");
> + err = -EACCES;
> + goto handle_error;
> + }
> + }
> +
> + if (info->reset_state == RESET_ACTIVATED)
> + SET_RESET_STATE(RESET_IDLE);
> +
> + /*
> + * Call platform specific function that returns the chip dependent
> + * bt enable(true) HCI command.
> + * If NULL is returned, then no bt_enable command should be sent to the
> + * chip.
> + */
> + enable_cmd = cg2900_devices_get_bt_enable_cmd(&bt_enable_cmd, true);
> + if (!enable_cmd) {
> + /* The chip is enabled by default */
> + SET_ENABLE_STATE(ENABLE_BT_ENABLED);
> + return 0;
> + }
> +
> + /* Set the HCI state before sending command to chip. */
> + SET_ENABLE_STATE(ENABLE_WAITING_BT_ENABLED_CC);
> +
> + /* Send command to chip */
> + cg2900_write(info->bt_cmd, enable_cmd);
> +
> + /*
> + * Wait for callback to receive command complete and then wake us up
> + * again.
> + */
> + wait_event_interruptible_timeout(hci_wait_queue,
> + (info->enable_state == ENABLE_BT_ENABLED),
> + msecs_to_jiffies(RESP_TIMEOUT));
> + /* Check the current state to se that it worked. */
> + if (info->enable_state != ENABLE_BT_ENABLED) {
> + CG2900_ERR("Could not enable BT core (%d)", info->enable_state);
> + err = -EACCES;
> + SET_ENABLE_STATE(ENABLE_BT_DISABLED);
> + goto handle_error;
> + }
> +
> + return 0;
> +
> +handle_error:
> + remove_bt_users(info);
> + clear_bit(HCI_RUNNING, &(hdev->flags));
> + return err;
> +
> +}
> +
> +/**
> + * flush_from_hci() - Flush HCI interface.
> + * @hdev: HCI device being flushed.
> + *
> + * Returns:
> + * 0 if there is no error.
> + * -EINVAL if NULL pointer is supplied.
> + */
> +static int flush_from_hci(struct hci_dev *hdev)
> +{
> + CG2900_INFO("flush_from_hci");
> +
> + if (!hdev) {
> + CG2900_ERR("NULL supplied for hdev");
> + return -EINVAL;
> + }
> +
> + return 0;
> +}
> +
> +/**
> + * close_from_hci() - Close HCI interface.
> + * @hdev: HCI device being closed.
> + *
> + * BlueZ callback function for closing HCI interface.
> + * It flushes the interface first.
> + *
> + * Returns:
> + * 0 if there is no error.
> + * -EINVAL if NULL pointer is supplied.
> + * -EOPNOTSUPP if supplied packet type is not supported.
> + * -EBUSY if device is not opened.
> + */
> +static int close_from_hci(struct hci_dev *hdev)
> +{
> + struct hci_info *info = NULL;
> + struct sk_buff *enable_cmd;
> +
> + CG2900_INFO("close_from_hci");
> +
> + if (!hdev) {
> + CG2900_ERR("NULL supplied for hdev");
> + return -EINVAL;
> + }
> +
> + info = (struct hci_info *)hdev->driver_data;
> + if (!info) {
> + CG2900_ERR("NULL supplied for driver_data");
> + return -EINVAL;
> + }
> +
> + if (!test_and_clear_bit(HCI_RUNNING, &(hdev->flags))) {
> + CG2900_ERR("Device already closed!");
> + return -EBUSY;
> + }
> +
> + flush_from_hci(hdev);
> +
> + /* Do not do this if there is an reset ongoing */
> + if (hci_info->reset_state == RESET_ACTIVATED)
> + goto remove_users;
> +
> + /*
> + * Get the chip dependent BT Enable HCI command. The command parameter
> + * shall be set to false to disable the BT core.
> + * If NULL is returned, then no BT Enable command should be sent to the
> + * chip.
> + */
> + enable_cmd = cg2900_devices_get_bt_enable_cmd(&bt_enable_cmd, false);
> + if (!enable_cmd) {
> + /*
> + * The chip is enabled by default and we should not disable it.
> + */
> + SET_ENABLE_STATE(ENABLE_BT_ENABLED);
> + goto remove_users;
> + }
> +
> + /* Set the HCI state before sending command to chip */
> + SET_ENABLE_STATE(ENABLE_WAITING_BT_DISABLED_CC);
> +
> + /* Send command to chip */
> + cg2900_write(info->bt_cmd, enable_cmd);
> +
> + /*
> + * Wait for callback to receive command complete and then wake us up
> + * again.
> + */
> + wait_event_interruptible_timeout(hci_wait_queue,
> + (info->enable_state == ENABLE_BT_DISABLED),
> + msecs_to_jiffies(RESP_TIMEOUT));
> + /* Check the current state to se that it worked. */
> + if (info->enable_state != ENABLE_BT_DISABLED) {
> + CG2900_ERR("Could not disable BT core.");
> + SET_ENABLE_STATE(ENABLE_BT_ENABLED);
> + }
> +
> +remove_users:
> + /* Finally deregister all users and free allocated data */
> + remove_bt_users(info);
> + return 0;
> +}
> +
> +/**
> + * send_from_hci() - Send packet to device.
> + * @skb: sk buffer to be sent.
> + *
> + * BlueZ callback function for sending sk buffer.
> + *
> + * Returns:
> + * 0 if there is no error.
> + * -EINVAL if NULL pointer is supplied.
> + * -EOPNOTSUPP if supplied packet type is not supported.
> + * Error codes from cg2900_write.
> + */
> +static int send_from_hci(struct sk_buff *skb)
> +{
> + struct hci_dev *hdev;
> + struct hci_info *info;
> + int err = 0;
> +
> + if (!skb) {
> + CG2900_ERR("NULL supplied for skb");
> + return -EINVAL;
> + }
> +
> + hdev = (struct hci_dev *)(skb->dev);
> + if (!hdev) {
> + CG2900_ERR("NULL supplied for hdev");
> + return -EINVAL;
> + }
> +
> + info = (struct hci_info *)hdev->driver_data;
> + if (!info) {
> + CG2900_ERR("NULL supplied for info");
> + return -EINVAL;
> + }
> +
> + /* Update BlueZ stats */
> + hdev->stat.byte_tx += skb->len;
> +
> + CG2900_DBG_DATA("Data transmit %d bytes", skb->len);
> +
> + switch (bt_cb(skb)->pkt_type) {
> + case HCI_COMMAND_PKT:
> + CG2900_DBG("Sending HCI_COMMAND_PKT");
> + err = cg2900_write(info->bt_cmd, skb);
> + hdev->stat.cmd_tx++;
> + break;
> + case HCI_ACLDATA_PKT:
> + CG2900_DBG("Sending HCI_ACLDATA_PKT");
> + err = cg2900_write(info->bt_acl, skb);
> + hdev->stat.acl_tx++;
> + break;
> + default:
> + CG2900_ERR("Trying to transmit unsupported packet type "
> + "(0x%.2X)", bt_cb(skb)->pkt_type);
> + err = -EOPNOTSUPP;
> + break;
> + };
> +
> + return err;
> +}
> +
> +/**
> + * destruct_from_hci() - Destruct HCI interface.
> + * @hdev: HCI device being destructed.
> + */
> +static void destruct_from_hci(struct hci_dev *hdev)
> +{
> + CG2900_INFO("destruct_from_hci");
> +
> + if (!hci_info)
> + return;
> +
> + /* When being reset, register a new hdev when hdev is deregistered */
> + if (hci_info->reset_state == RESET_ACTIVATED) {
> + if (hci_info->hdev)
> + hci_free_dev(hci_info->hdev);
> + SET_RESET_STATE(RESET_UNREGISTERED);
> + }
> +}
Please name thse cg2900_destruct or btcg2900_destruct. And not from_hci.
Follow how the other Bluetooth drivers do the naming.
And the destruct callback is for freeing memory. I am also not sure how
reset and unregister/re-register HCI is a good idea.
> +/**
> + * notify_from_hci() - Notification from the HCI interface.
> + * @hdev: HCI device notifying.
> + * @evt: Notification event.
> + */
> +static void notify_from_hci(struct hci_dev *hdev, unsigned int evt)
> +{
> + CG2900_INFO("notify_from_hci - evt = 0x%.2X", evt);
> +}
If you don't use it, then just leave it out.
> +/**
> + * ioctl_from_hci() - Handle IOCTL call to the HCI interface.
> + * @hdev: HCI device.
> + * @cmd: IOCTL command.
> + * @arg: IOCTL argument.
> + *
> + * Returns:
> + * -EINVAL if NULL is supplied for hdev.
> + * -EPERM otherwise since current driver supports no IOCTL.
> + */
> +static int ioctl_from_hci(struct hci_dev *hdev, unsigned int cmd,
> + unsigned long arg)
> +{
> + CG2900_INFO("ioctl_from_hci - cmd 0x%X", cmd);
> + CG2900_DBG("DIR: %d, TYPE: %d, NR: %d, SIZE: %d",
> + _IOC_DIR(cmd), _IOC_TYPE(cmd), _IOC_NR(cmd),
> + _IOC_SIZE(cmd));
> +
> + if (!hdev) {
> + CG2900_ERR("NULL supplied for hdev");
> + return -EINVAL;;
> + }
> +
> + return -EPERM;
> +}
Since you are not using anything with the ioctl, just leave it out. The
Bluetooth subsystem will do the right thing.
> +/**
> + * register_to_bluez() - Initialize module.
> + *
> + * Alloc, init, and register HCI device to BlueZ.
> + *
> + * Returns:
> + * 0 if there is no error.
> + * -ENOMEM if allocation fails.
> + * Error codes from hci_register_dev.
> + */
> +static int register_to_bluez(void)
> +{
> + int err;
> +
> + hci_info->hdev = hci_alloc_dev();
> + if (!hci_info->hdev) {
> + CG2900_ERR("Could not allocate mem for HCI driver");
> + return -ENOMEM;
> + }
> +
> + hci_info->hdev->bus = HCI_CG2900;
> + hci_info->hdev->driver_data = hci_info;
> + hci_info->hdev->owner = THIS_MODULE;
> + hci_info->hdev->open = open_from_hci;
> + hci_info->hdev->close = close_from_hci;
> + hci_info->hdev->flush = flush_from_hci;
> + hci_info->hdev->send = send_from_hci;
> + hci_info->hdev->destruct = destruct_from_hci;
> + hci_info->hdev->notify = notify_from_hci;
> + hci_info->hdev->ioctl = ioctl_from_hci;
> +
> + err = hci_register_dev(hci_info->hdev);
> + if (err) {
> + CG2900_ERR("Can not register HCI device (%d)", err);
> + hci_free_dev(hci_info->hdev);
> + }
> +
> + SET_ENABLE_STATE(ENABLE_IDLE);
> + SET_RESET_STATE(RESET_IDLE);
> +
> + return err;
> +}
So whenever the module is loaded it registers the HCI device. That is
not really useful here. This driver needs to be able to be compiled into
the kernel (or as module) and run on hardware that doesn't have this
chip built in.
> +/**
> + * hci_init() - Initialize module.
> + *
> + * Allocate and initialize private data. Register to BlueZ.
> + *
> + * Returns:
> + * 0 if there is no error.
> + * -ENOMEM if allocation fails.
> + * Error codes from register_to_bluez.
> + */
> +static int __init hci_init(void)
> +{
> + int err;
> + CG2900_INFO("hci_init");
> +
> + /* Initialize private data. */
> + hci_info = kzalloc(sizeof(*hci_info), GFP_KERNEL);
> + if (!hci_info) {
> + CG2900_ERR("Could not alloc hci_info struct.");
> + return -ENOMEM;
> + }
> +
> + /* Init and register hdev */
> + err = register_to_bluez();
> + if (err) {
> + CG2900_ERR("HCI Device registration error (%d)", err);
> + kfree(hci_info);
> + hci_info = NULL;
> + return err;
> + }
> +
> + return 0;
> +}
> +
> +/**
> + * hci_exit() - Remove module.
> + *
> + * Remove HCI device from CG2900 driver.
> + */
> +static void __exit hci_exit(void)
> +{
> + int err = 0;
> +
> + CG2900_INFO("hci_exit");
> +
> + if (!hci_info)
> + return;
> +
> + if (!hci_info->hdev)
> + goto finished;
> +
> + err = hci_unregister_dev(hci_info->hdev);
> + if (err)
> + CG2900_ERR("Can not unregister HCI device (%d)", err);
> + hci_free_dev(hci_info->hdev);
> +
> +finished:
> + kfree(hci_info);
> + hci_info = NULL;
> +}
> +
> +module_init(hci_init);
> +module_exit(hci_exit);
Please use more clear names like cg2900_init or similar.
> +MODULE_AUTHOR("Par-Gunnar Hjalmdahl ST-Ericsson");
> +MODULE_AUTHOR("Henrik Possung ST-Ericsson");
> +MODULE_AUTHOR("Josef Kindberg ST-Ericsson");
> +MODULE_LICENSE("GPL v2");
> +MODULE_DESCRIPTION("Linux Bluetooth HCI H:4 Driver for ST-Ericsson
> controller");
Regards
Marcel
^ permalink raw reply
* Re: Support for Device ID profile
From: Marcel Holtmann @ 2010-10-05 9:22 UTC (permalink / raw)
To: Rahul Ruikar
Cc: steven bluez, Jose Antonio Santos Cadenas, Luiz Augusto von Dentz,
linux-bluetooth
In-Reply-To: <AANLkTi=pFRQHOvTXSUuWSCEDxbL+4ET9JFJct6BWK2Lh@mail.gmail.com>
Hi Rahul/Luiz,
> Could you please tell me some pointers in code/document where I can
> know about various profiles
> we support here or about profiles for which support is not added yet.
>
> I would like to contribute towards adding support of profiles.
> http://www.bluetooth.com/English/Technology/Works/Pages/Profiles_Overview.aspx
clear warning here guys. STOP top posting.
Regards
Marcel
^ permalink raw reply
* Re: [PATCH 1/2] Bluetooth: hci open callback for hci UART transport driver
From: Marcel Holtmann @ 2010-10-05 9:27 UTC (permalink / raw)
To: Suraj Sumangala; +Cc: linux-bluetooth, Jothikumar.Mothilal
In-Reply-To: <1285075981-8941-1-git-send-email-suraj@atheros.com>
Hi Suraj,
> This patch provides option for hci transport driver protocol implementation
> to have a callback for hci open.
>
> Signed-off-by: Suraj Sumangala <suraj@atheros.com>
> ---
> drivers/bluetooth/hci_ldisc.c | 5 ++++-
> drivers/bluetooth/hci_uart.h | 1 +
> 2 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
> index 998833d..5e02501 100644
> --- a/drivers/bluetooth/hci_ldisc.c
> +++ b/drivers/bluetooth/hci_ldisc.c
> @@ -162,9 +162,12 @@ restart:
> /* Initialize device */
> static int hci_uart_open(struct hci_dev *hdev)
> {
> + struct hci_uart *hu = (struct hci_uart *) hdev->driver_data;
> +
> BT_DBG("%s %p", hdev->name, hdev);
>
> - /* Nothing to do for UART driver */
> + if (hu->proto->hci_open)
> + hu->proto->hci_open(hu);
>
> set_bit(HCI_RUNNING, &hdev->flags);
>
> diff --git a/drivers/bluetooth/hci_uart.h b/drivers/bluetooth/hci_uart.h
> index 99fb352..d0198ec 100644
> --- a/drivers/bluetooth/hci_uart.h
> +++ b/drivers/bluetooth/hci_uart.h
> @@ -51,6 +51,7 @@ struct hci_uart;
> struct hci_uart_proto {
> unsigned int id;
> int (*open)(struct hci_uart *hu);
> + int (*hci_open)(struct hci_uart *hu);
> int (*close)(struct hci_uart *hu);
> int (*flush)(struct hci_uart *hu);
> int (*recv)(struct hci_uart *hu, void *data, int len);
I don't like this. It is not what any other driver is doing. For me this
is just hacking around something that would need to be solved for all
Bluetooth transport drivers. Just trying to solve this for UART based
drivers is not going to help.
So we talked about adding a setup stage to the HCI driver interface.
That is the way you should proceed if doing this in hciattach is not
enough for you.
Regards
Marcel
^ permalink raw reply
* Re: New Broadcom chip in W510
From: Marcel Holtmann @ 2010-10-05 9:30 UTC (permalink / raw)
To: Lu Ran; +Cc: linux-bluetooth
In-Reply-To: <201009190926.51131.hephooey@gmail.com>
Hi Lu,
> I am having trouble to make my headset work in my new W510, it works fine in an
> T61, with has almost identical software and setup with the new W510. The only
> difference is I am now using a pure 64 bit system, while the old T61 is a 32
> bit one, and the bluetooth chip is different. the id of the chip in T61 is
> 0A5C:2110, while W510 has a chip from Broadcom with id 0A5C:217F. I noticed
> there is a SCO fix for 0A5C:2110 in btusb.c. I tried to copy the line and
> change the id to 0A5C:217F, but nothing changes. The headset can pair with the
> laptop with no problem, but there seems to be no data transmition. And I get a
> lot error messages in dmesg output like this:
>
> btusb_submit_isoc_urb: hci0 urb ffff880060136e00 submission failed (28)
>
> and
>
> btusb_send_frame: hci0 urb ffff8801320e1a00 submission failed
>
> the output of "hciconfig hci0 version" is
>
> hci0: Type: BR/EDR Bus: USB
> BD Address: 70:F3:95:34:2F:29 ACL MTU: 1021:8 SCO MTU: 64:8
> HCI Version: 2.1 (0x4) Revision: 0x168
> LMP Version: 2.1 (0x4) Subversion: 0x4203
> Manufacturer: Broadcom Corporation (15)
>
> And the output of "lsusb -v" is in the attachment. I will try to provide any
> other information you need to analyse the problem.
can you show me the content of /proc/bus/usb/devices (or usbdevices.sh)
for that device.
Regards
Marcel
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox