* Re: [PATCH 00/11] Use devm_kzalloc in bluetooth drivers
From: Marcel Holtmann @ 2012-08-06 16:37 UTC (permalink / raw)
To: Sachin Kamat; +Cc: linux-bluetooth, gustavo, johan.hedberg, patches
In-Reply-To: <CAK9yfHynuNNqYccAp4BC9zAtWE_Ni27tEK-Pq2Ngt6N2PZukRw@mail.gmail.com>
Hi Sachin,
> Any comments regarding this patch set?
I am fine with it.
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply
* Re: [PATCH 00/11] Use devm_kzalloc in bluetooth drivers
From: Gustavo Padovan @ 2012-08-06 17:30 UTC (permalink / raw)
To: Sachin Kamat; +Cc: linux-bluetooth, marcel, johan.hedberg, patches
In-Reply-To: <1343372921-18780-1-git-send-email-sachin.kamat@linaro.org>
Hi Sachin,
* Sachin Kamat <sachin.kamat@linaro.org> [2012-07-27 12:38:30 +0530]:
> devm_kzalloc() is a device managed function which eliminates the need
> to free memory explicitly thereby saving some cleanup code and making
> the exit code simpler.
>
> This series is based on the following tree and is compile tested.
> git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git
>
> Sachin Kamat (11):
> Bluetooth: Use devm_kzalloc in bcm203x.c file.
> Bluetooth: Use devm_kzalloc in bfusb.c file
> Bluetooth: Use devm_kzalloc in bluecard_cs.c file
> Bluetooth: Use devm_kzalloc in bpa10x.c file
> Bluetooth: Use devm_kzalloc in bt3c_cs.c file
> Bluetooth: Use devm_kzalloc in btmrvl_sdio.c file
> Bluetooth: Use devm_kzalloc in btsdio.c file
> Bluetooth: Use devm_kzalloc in btuart_cs.c file
> Bluetooth: Use devm_kzalloc in btusb.c file
> Bluetooth: Use devm_kzalloc in btwilink.c file
> Bluetooth: Use devm_kzalloc in dtl1_cs.c file
>
> drivers/bluetooth/bcm203x.c | 8 +-------
> drivers/bluetooth/bfusb.c | 12 ++++--------
> drivers/bluetooth/bluecard_cs.c | 5 +----
> drivers/bluetooth/bpa10x.c | 8 ++------
> drivers/bluetooth/bt3c_cs.c | 5 +----
> drivers/bluetooth/btmrvl_sdio.c | 15 ++++-----------
> drivers/bluetooth/btsdio.c | 8 ++------
> drivers/bluetooth/btuart_cs.c | 5 +----
> drivers/bluetooth/btusb.c | 13 +++----------
> drivers/bluetooth/btwilink.c | 8 ++------
> drivers/bluetooth/dtl1_cs.c | 3 +--
> 11 files changed, 22 insertions(+), 68 deletions(-)
The whole series have been applied to bluetooth-next. Thanks.
Gustavo
^ permalink raw reply
* Re: [PATCH 7/7] Bluetooth: Refactor in hci_le_conn_complete_evt
From: Gustavo Padovan @ 2012-08-06 18:16 UTC (permalink / raw)
To: Andre Guedes; +Cc: linux-bluetooth
In-Reply-To: <1343412616-25641-7-git-send-email-andre.guedes@openbossa.org>
Hi Andre,
* Andre Guedes <andre.guedes@openbossa.org> [2012-07-27 15:10:16 -0300]:
> This patch moves the hci_conn check to begining of hci_le_conn_
> complete_evt in order to improve code's readability and better
> error handling.
>
> Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
> ---
> net/bluetooth/hci_event.c | 22 +++++++++-------------
> 1 file changed, 9 insertions(+), 13 deletions(-)
All seven patches have been applied to bluetooth-next, Thanks.
Gustavo
^ permalink raw reply
* Re: [PATCH] Bluetooth: add support for atheros 0489:e057
From: Gustavo Padovan @ 2012-08-06 18:33 UTC (permalink / raw)
To: Peng Chen; +Cc: marcel, linux-bluetooth
In-Reply-To: <1343787119-6750-1-git-send-email-pengchen@qca.qualcomm.com>
Hi Peng,
* Peng Chen <pengchen@qca.qualcomm.com> [2012-08-01 10:11:59 +0800]:
> Add support for the AR3012 chip found on Fioxconn.
>
> usb-devices shows:
>
> T: Bus=06 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 44 Spd=12 MxCh= 0
> D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
> P: Vendor=0489 ProdID=e057 Rev= 0.02
> C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
> I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms
> E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
> E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
> I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms
> E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms
> I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms
> E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms
> I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms
> E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms
> I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms
> E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms
> I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms
> E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms
> I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
> E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms
>
> Signed-off-by: Peng Chen <pengchen@qca.qualcomm.com>
> ---
> drivers/bluetooth/ath3k.c | 2 ++
> drivers/bluetooth/btusb.c | 1 +
> 2 files changed, 3 insertions(+)
Patch has been applied to bluetooth.git. Thanks.
Gustavo
^ permalink raw reply
* Re: [PATCH v2] Bluetooth: Another vendor specific ID for BCM20702A0 [0a5c:21f1]
From: Gustavo Padovan @ 2012-08-06 18:40 UTC (permalink / raw)
To: Michal Marek; +Cc: linux-bluetooth, marcel, linux-kernel
In-Reply-To: <1343742454-28019-1-git-send-email-mmarek@suse.cz>
Hi Michal,
* Michal Marek <mmarek@suse.cz> [2012-07-31 15:47:34 +0200]:
> T: Bus=02 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#= 3 Spd=12 MxCh= 0
> D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
> P: Vendor=0a5c ProdID=21f1 Rev= 1.12
> S: Manufacturer=Broadcom Corp
> S: Product=BCM20702A0
> S: SerialNumber=9CB70DCFF833
> C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr= 0mA
> I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
> E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms
> E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
> E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
> I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
> E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms
> E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms
> I: If#= 1 Alt= 1 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
> E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms
> E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms
> I: If#= 1 Alt= 2 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
> E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms
> E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms
> I: If#= 1 Alt= 3 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
> E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms
> E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms
> I: If#= 1 Alt= 4 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
> E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms
> E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms
> I: If#= 1 Alt= 5 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
> E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
> E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms
> I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
> E: Ad=84(I) Atr=02(Bulk) MxPS= 32 Ivl=0ms
> E: Ad=04(O) Atr=02(Bulk) MxPS= 32 Ivl=0ms
> I:* If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)
>
> Signed-off-by: Michal Marek <mmarek@suse.cz>
> ---
> drivers/bluetooth/btusb.c | 1 +
> 1 file changed, 1 insertion(+)
Can you try the following patch on 3.6-rc1? It should fix this by matching
vendor and inteface info.
Gustavo
---
Author: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Date: Mon Aug 6 15:36:49 2012 -0300
Bluetooth: Use USB_VENDOR_AND_INTERFACE_INFO() for Broadcom devices
Many Broadcom devices has a vendor specific devices class, with this rule
we match all existent and future controllers with this behavior.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index cef3bac..504231e 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -104,6 +104,9 @@ static struct usb_device_id btusb_table[] = {
/* Foxconn - Hon Hai */
{ USB_DEVICE(0x0489, 0xe033) },
+ /*Broadcom devices with vendor specific id */
+ { USB_VENDOR_AND_INTERFACE_INFO(0x0a5c, 0xff, 0x01, 0x01) },
+
{ } /* Terminating entry */
};
^ permalink raw reply related
* pull request: bluetooth 2012-08-06
From: Gustavo Padovan @ 2012-08-06 19:04 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, linux-bluetooth, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1841 bytes --]
Hi John,
Here goes some fixes for 3.6-rc1, there are a few fix to thte inquiry code by
Ram Malovany, support for 2 new devices, and few others fixes for NULL
dereference, possible deadlock and a memory leak.
Please pull, or let me know of any problems with this! Thanks.
Gustavo
---
The following changes since commit d4e5979c0da95791aa717c18e162540c7a596360:
ath9k: Add PID/VID support for AR1111 (2012-08-03 10:11:14 -0400)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth master
for you to fetch changes up to 2096ae6ca647302d50a68aa36cb66a00e7dfac70:
Bluetooth: add support for atheros 0489:e057 (2012-08-06 15:33:05 -0300)
----------------------------------------------------------------
Andrei Emeltchenko (1):
Bluetooth: smp: Fix possible NULL dereference
Gustavo Padovan (1):
Bluetooth: Fix possible deadlock in SCO code
Jaganath Kanakkassery (1):
Bluetooth: Fix socket not getting freed if l2cap channel create fails
Manoj Iyer (1):
Bluetooth: btusb: Add vendor specific ID (0a5c:21f4) BCM20702A0
Peng Chen (1):
Bluetooth: add support for atheros 0489:e057
Ram Malovany (3):
Bluetooth: Fix using NULL inquiry entry
Bluetooth: Fix using a NULL inquiry cache entry
Bluetooth: Set name_state to unknown when entry name is empty
Szymon Janc (1):
Bluetooth: Fix legacy pairing with some devices
drivers/bluetooth/ath3k.c | 2 ++
drivers/bluetooth/btusb.c | 2 ++
net/bluetooth/hci_event.c | 28 ++++++++++++++++++++++------
net/bluetooth/l2cap_core.c | 1 +
net/bluetooth/l2cap_sock.c | 2 +-
net/bluetooth/sco.c | 19 +++++++++----------
net/bluetooth/smp.c | 5 ++++-
7 files changed, 41 insertions(+), 18 deletions(-)
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* pull request: bluetooth-next 2012-08-06
From: Gustavo Padovan @ 2012-08-06 19:58 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, linux-bluetooth, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 4687 bytes --]
Hi John,
These are the changes I queued for 3.7. There are a many small
fixes/improvements by Andre Guedes. A l2cap channel refcounting refactor by
Jaganath. Bluetooth sockets now appears in /proc/net, by Masatake Yamato and
Sachin Kamat changes ours drivers to use devm_kzalloc().
Please pull, or let me know any concerns you have. Thanks.
Gustavo
---
The following changes since commit 173f8654746c138a08f51a8a0db7747763a896a2:
Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 (2012-07-27 20:52:25 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next master
for you to fetch changes up to cd17decbd9af41c9548bb108ccf156519f8253ec:
Bluetooth: Refactor in hci_le_conn_complete_evt (2012-08-06 15:08:41 -0300)
----------------------------------------------------------------
Andre Guedes (17):
Bluetooth: Remove missing code
Bluetooth: Use lmp_bredr_capable where applicable
Bluetooth: Use lmp_le_capable where applicable
Bluetooth: Use lmp_ssp_capable where applicable
Bluetooth: Use lmp_esco_capable where applicable
Bluetooth: Use lmp_rswitch_capable where applicable
Bluetooth: Use lmp_sniff_capable where applicable
Bluetooth: Use lmp_sniffsubr_capable where applicable
Bluetooth: Use lmp_no_flush_capable where applicable
Bluetooth: Remove locking in hci_user_passkey_request_evt
Bluetooth: Trivial refactoring
Bluetooth: Fix hci_le_conn_complete_evt
Bluetooth: Remove unneeded code
Bluetooth: Refactor hci_cs_le_create_conn
Bluetooth: Find hci_conn by BT_CONNECT state
Bluetooth: Lookup hci_conn in hci_le_conn_complete_evt
Bluetooth: Refactor in hci_le_conn_complete_evt
Bluetooth: Do not shadow hdr variable
Bluetooth: Fix processing A2MP chan in security_cfm
Bluetooth: Make connect / disconnect cfm functions return void
Jaganath Kanakkassery (2):
Bluetooth: Move l2cap_chan_hold/put to l2cap_core.c
Bluetooth: Free the l2cap channel list only when refcount is zero
Masatake YAMATO (8):
Bluetooth: /proc/net/ entries for bluetooth protocols
Bluetooth: Added /proc/net/bnep via bt_procfs_init()
Bluetooth: Added /proc/net/cmtp via bt_procfs_init()
Bluetooth: Added /proc/net/hci via bt_procfs_init()
Bluetooth: Added /proc/net/hidp via bt_procfs_init()
Bluetooth: Added /proc/net/l2cap via bt_procfs_init()
Bluetooth: Added /proc/net/rfcomm via bt_procfs_init()
Bluetooth: Added /proc/net/sco via bt_procfs_init()
Sachin Kamat (11):
Bluetooth: Use devm_kzalloc in bcm203x.c file.
Bluetooth: Use devm_kzalloc in bfusb.c file
Bluetooth: Use devm_kzalloc in bluecard_cs.c file
Bluetooth: Use devm_kzalloc in bpa10x.c file
Bluetooth: Use devm_kzalloc in bt3c_cs.c file
Bluetooth: Use devm_kzalloc in btmrvl_sdio.c file
Bluetooth: Use devm_kzalloc in btsdio.c file
Bluetooth: Use devm_kzalloc in btuart_cs.c file
Bluetooth: Use devm_kzalloc in btusb.c file
Bluetooth: Use devm_kzalloc in btwilink.c file
Bluetooth: Use devm_kzalloc in dtl1_cs.c file
drivers/bluetooth/bcm203x.c | 8 +--
drivers/bluetooth/bfusb.c | 12 ++--
drivers/bluetooth/bluecard_cs.c | 5 +-
drivers/bluetooth/bpa10x.c | 8 +--
drivers/bluetooth/bt3c_cs.c | 5 +-
drivers/bluetooth/btmrvl_sdio.c | 15 ++---
drivers/bluetooth/btsdio.c | 8 +--
drivers/bluetooth/btuart_cs.c | 5 +-
drivers/bluetooth/btusb.c | 13 +---
drivers/bluetooth/btwilink.c | 8 +--
drivers/bluetooth/dtl1_cs.c | 3 +-
include/net/bluetooth/bluetooth.h | 10 +++
include/net/bluetooth/hci.h | 11 ++++
include/net/bluetooth/hci_core.h | 22 ++-----
include/net/bluetooth/l2cap.h | 17 +----
include/net/bluetooth/smp.h | 8 +--
net/bluetooth/a2mp.c | 16 +++--
net/bluetooth/af_bluetooth.c | 141 ++++++++++++++++++++++++++++++++++++++++
net/bluetooth/bnep/sock.c | 22 ++++++-
net/bluetooth/cmtp/sock.c | 23 ++++++-
net/bluetooth/hci_core.c | 6 +-
net/bluetooth/hci_event.c | 93 +++++++++++---------------
net/bluetooth/hci_sock.c | 13 +++-
net/bluetooth/hidp/sock.c | 22 ++++++-
net/bluetooth/l2cap_core.c | 32 +++++++--
net/bluetooth/l2cap_sock.c | 22 ++++++-
net/bluetooth/mgmt.c | 34 +++++++---
net/bluetooth/rfcomm/sock.c | 14 +++-
net/bluetooth/sco.c | 16 +++--
29 files changed, 415 insertions(+), 197 deletions(-)
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCH v17 01/15] doc: Add telephony interface documents
From: Luiz Augusto von Dentz @ 2012-08-06 20:30 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: Frédéric Danis, linux-bluetooth
In-Reply-To: <1344141450.2083.30.camel@aeonflux>
Hi Marcel,
On Sun, Aug 5, 2012 at 7:37 AM, Marcel Holtmann <marcel@holtmann.org> wrote:
>> +org.bluez.TelephonyAgent using this new interface. This will setup a SDP record
>> +for the profile and a RFCOMM server listening for incoming connection.
>> +
>> +When a new device is connected, NewConnection method of TelephonyAgent is
>> +called. The telephony agent should reply to it after proper communication
>> +establishment (directly for HSP or after SLC setup completes for HFP).
>
> We need to describe on how HFP 1.6 with wideband speech is handled as
> well.
I need to look in detail when the audio configuration is done in HFP
1.6, in any case a the transport object can be used to signal wideband
speech which PulseAudio should be able to catch and setup sbc
encoder/decoder, iirc the parameters are fixed so there is no need to
negotiate parameters with the endpoint as in A2DP so oFono only need
to know if the transport is capable of wideband speech or not.
>> +Interaction with the audio component (i.e. PulseAudio) will be done through the
>> +MediaTransport object (passed to telephony agent during NewConnection call).
>
> This is the one thing that is really unclear to me. How does this
> actually help. The MediaTransport and TelephonyAgent should be
> independent.
They are mostly independent, oFono will never really acquire or
anything like that, but there are some AT commands (+VGS,+VGM) that
does notify PA about volume gain changes and as I said above it could
be useful to notify about wideband speech in the same way.
--
Luiz Augusto von Dentz
^ permalink raw reply
* Re: [PATCH 00/11] Use devm_kzalloc in bluetooth drivers
From: Sachin Kamat @ 2012-08-07 3:25 UTC (permalink / raw)
To: Gustavo Padovan, Sachin Kamat, linux-bluetooth, marcel,
johan.hedberg, patches
In-Reply-To: <20120806173021.GA3146@joana>
Thanks Marcel and Gustavo.
On 6 August 2012 23:00, Gustavo Padovan <gustavo@padovan.org> wrote:
> Hi Sachin,
>
> * Sachin Kamat <sachin.kamat@linaro.org> [2012-07-27 12:38:30 +0530]:
>
>> devm_kzalloc() is a device managed function which eliminates the need
>> to free memory explicitly thereby saving some cleanup code and making
>> the exit code simpler.
>>
>> This series is based on the following tree and is compile tested.
>> git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git
>>
>> Sachin Kamat (11):
>> Bluetooth: Use devm_kzalloc in bcm203x.c file.
>> Bluetooth: Use devm_kzalloc in bfusb.c file
>> Bluetooth: Use devm_kzalloc in bluecard_cs.c file
>> Bluetooth: Use devm_kzalloc in bpa10x.c file
>> Bluetooth: Use devm_kzalloc in bt3c_cs.c file
>> Bluetooth: Use devm_kzalloc in btmrvl_sdio.c file
>> Bluetooth: Use devm_kzalloc in btsdio.c file
>> Bluetooth: Use devm_kzalloc in btuart_cs.c file
>> Bluetooth: Use devm_kzalloc in btusb.c file
>> Bluetooth: Use devm_kzalloc in btwilink.c file
>> Bluetooth: Use devm_kzalloc in dtl1_cs.c file
>>
>> drivers/bluetooth/bcm203x.c | 8 +-------
>> drivers/bluetooth/bfusb.c | 12 ++++--------
>> drivers/bluetooth/bluecard_cs.c | 5 +----
>> drivers/bluetooth/bpa10x.c | 8 ++------
>> drivers/bluetooth/bt3c_cs.c | 5 +----
>> drivers/bluetooth/btmrvl_sdio.c | 15 ++++-----------
>> drivers/bluetooth/btsdio.c | 8 ++------
>> drivers/bluetooth/btuart_cs.c | 5 +----
>> drivers/bluetooth/btusb.c | 13 +++----------
>> drivers/bluetooth/btwilink.c | 8 ++------
>> drivers/bluetooth/dtl1_cs.c | 3 +--
>> 11 files changed, 22 insertions(+), 68 deletions(-)
>
> The whole series have been applied to bluetooth-next. Thanks.
>
> Gustavo
--
With warm regards,
Sachin
^ permalink raw reply
* [PATCH] Bluetooth: Use module_platform_driver() in btwilink.c file
From: Sachin Kamat @ 2012-08-07 5:07 UTC (permalink / raw)
To: linux-bluetooth
Cc: marcel, gustavo, johan.hedberg, raja_mani, sachin.kamat, patches
module_platform_driver() makes the code simpler by eliminating module_init
and module_exit calls.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
This patch is based on bluetooth-next tree and is compile tested.
---
drivers/bluetooth/btwilink.c | 16 +---------------
1 files changed, 1 insertions(+), 15 deletions(-)
diff --git a/drivers/bluetooth/btwilink.c b/drivers/bluetooth/btwilink.c
index 4ad7b35..60abf59 100644
--- a/drivers/bluetooth/btwilink.c
+++ b/drivers/bluetooth/btwilink.c
@@ -358,21 +358,7 @@ static struct platform_driver btwilink_driver = {
},
};
-/* ------- Module Init/Exit interfaces ------ */
-static int __init btwilink_init(void)
-{
- BT_INFO("Bluetooth Driver for TI WiLink - Version %s", VERSION);
-
- return platform_driver_register(&btwilink_driver);
-}
-
-static void __exit btwilink_exit(void)
-{
- platform_driver_unregister(&btwilink_driver);
-}
-
-module_init(btwilink_init);
-module_exit(btwilink_exit);
+module_platform_driver(btwilink_driver);
/* ------ Module Info ------ */
--
1.7.4.1
^ permalink raw reply related
* Re: [PATCH] Bluetooth: Use module_platform_driver() in btwilink.c file
From: Marcel Holtmann @ 2012-08-07 6:12 UTC (permalink / raw)
To: Sachin Kamat; +Cc: linux-bluetooth, gustavo, johan.hedberg, raja_mani, patches
In-Reply-To: <1344316065-2032-1-git-send-email-sachin.kamat@linaro.org>
Hi Sachin,
> module_platform_driver() makes the code simpler by eliminating module_init
> and module_exit calls.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
> This patch is based on bluetooth-next tree and is compile tested.
> ---
> drivers/bluetooth/btwilink.c | 16 +---------------
> 1 files changed, 1 insertions(+), 15 deletions(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply
* Re: [RFCv0 06/21] Bluetooth: Channel move request handling
From: Andrei Emeltchenko @ 2012-08-07 8:31 UTC (permalink / raw)
To: Mat Martineau; +Cc: linux-bluetooth, gustavo, pkrystad
In-Reply-To: <alpine.DEB.2.02.1208060904500.25736@mathewm-linux>
Hi Mat,
On Mon, Aug 06, 2012 at 09:33:50AM -0700, Mat Martineau wrote:
> >>>>+ chan->move_cmd_ident = cmd->ident;
> >>>
> >>>BTW: Why do we handle ident in a special way for channel move?
> >>
> >>At the time I wrote the code, I thought that chan->ident was only
> >>used to store idents of sent requests, not received requests. But
> >>it does look like it is also used for storing received idents for
> >>use in sending responses. chan->ident could be used as long as move
> >>collisions are handled correctly (where a move request is received
> >>when a move response is expected).
> >
> >So can we use chan->ident instead of chan->move_cmd_ident? Is the channel
> >move somehow different from other L2CAP request / response sequence?
>
> Yes, chan->ident can be used. It doesn't seem necessary to assign
> chan->ident when sending a move request, just when receiving one.
>
> Connect and create requests also assign chan->ident when they are
> sent, but I'm not sure why.
My understanding is that ident only used to match responses with requests.
So channel move is not a special case.
Reference: BLUETOOTH SPECIFICATION Version 4.0 [Vol 3] page 56 of 656
Best regards
Andrei Emeltchenko
^ permalink raw reply
* Re: [PATCH] Bluetooth: Add support for Sony Vaio T-Series
From: Mohammed Shafi Shajakhan @ 2012-08-07 10:05 UTC (permalink / raw)
To: Yevgeniy Melnichuk; +Cc: Marcel Holtmann, linux-bluetooth, gustavo
In-Reply-To: <501F5B95.2070001@qca.qualcomm.com>
Hi Yevgeniy,
On Monday 06 August 2012 11:22 AM, Mohammed Shafi Shajakhan wrote:
> Hi Marcel/Yevgeniy,
>
>>
>>> Add Sony Vaio T-Series Bluetooth Module( 0x489:0xE036) to
>>> the blacklist of btusb module and add it to the ath3k module.
>>
>> include part of /sys/kernel/debug/usb/devices in the commit message.
>> This is nothing new to you guys. I requested it multiple times.
>>
>
> I don't have this exact device to be sure, was just helping Yevgeniy to
> send the patch and he has it.
>
> Yevgeniy, please provide the data Marcel had asked for us.
>
>
please provide the output of cat /sys/kernel/debug/usb/devices. I will
snip out the relevant lsusb output for our device send a v2 patch this.
thanks!
--
thanks,
shafi
^ permalink raw reply
* Re: [PATCH] Bluetooth: Add support for Sony Vaio T-Series
From: Mohammed Shafi Shajakhan @ 2012-08-07 13:43 UTC (permalink / raw)
To: Yevgeniy Melnichuk; +Cc: Marcel Holtmann, linux-bluetooth, gustavo
In-Reply-To: <5020E853.3030907@qca.qualcomm.com>
Hi Marcel,
>>>> Add Sony Vaio T-Series Bluetooth Module( 0x489:0xE036) to
>>>> the blacklist of btusb module and add it to the ath3k module.
>>>
>>> include part of /sys/kernel/debug/usb/devices in the commit message.
>>> This is nothing new to you guys. I requested it multiple times.
will soon send a v2 with the information you had asked.
got the relevant information from Yevgeniy. thanks!
--
thanks,
shafi
^ permalink raw reply
* [PATCH v2] Bluetooth: Add support for Sony Vaio T-Series
From: Mohammed Shafi Shajakhan @ 2012-08-07 14:18 UTC (permalink / raw)
To: marcel
Cc: linux-bluetooth, gustavo, yevgeniy.melnichuk,
Mohammed Shafi Shajakhan
From: Yevgeniy Melnichuk <yevgeniy.melnichuk@googlemail.com>
Add Sony Vaio T-Series Bluetooth Module( 0x489:0xE036) to
the blacklist of btusb module and add it to the ath3k module.
output of cat /sys/kernel/debug/usb/devices
T: Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#= 5 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=0489 ProdID=e036 Rev= 0.02
S: Manufacturer=Atheros Communications
S: Product=Bluetooth USB Host Controller
S: SerialNumber=Alaska Day 2006
C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms
E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms
I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms
I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms
I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms
I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms
I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms
Signed-off-by: Yevgeniy Melnichuk <yevgeniy.melnichuk@googlemail.com>
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
---
drivers/bluetooth/ath3k.c | 2 ++
drivers/bluetooth/btusb.c | 1 +
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 10308cd..d1eecc3 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -85,6 +85,7 @@ static struct usb_device_id ath3k_table[] = {
/* Atheros AR5BBU22 with sflash firmware */
{ USB_DEVICE(0x0489, 0xE03C) },
+ { USB_DEVICE(0x0489, 0xE036) },
{ } /* Terminating entry */
};
@@ -107,6 +108,7 @@ static struct usb_device_id ath3k_blist_tbl[] = {
/* Atheros AR5BBU22 with sflash firmware */
{ USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 },
+ { USB_DEVICE(0x0489, 0xE036), .driver_info = BTUSB_ATH3012 },
{ } /* Terminating entry */
};
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index e272214..1c505ee 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -139,6 +139,7 @@ static struct usb_device_id blacklist_table[] = {
/* Atheros AR5BBU12 with sflash firmware */
{ USB_DEVICE(0x0489, 0xe03c), .driver_info = BTUSB_ATH3012 },
+ { USB_DEVICE(0x0489, 0xe036), .driver_info = BTUSB_ATH3012 },
/* Broadcom BCM2035 */
{ USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_WRONG_SCO_MTU },
--
1.7.0.4
^ permalink raw reply related
* [PATCHv1 0/4] Remove unsafe batostr
From: Andrei Emeltchenko @ 2012-08-07 15:05 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Since the patch "vsprintf: add %pMR for Bluetooth MAC address" in in linux-next and wireless-testing
remove batostr.
http://git.kernel.org/?p=linux/kernel/git/linville/wireless-testing.git;a=commitdiff;h=76597ff989a1fbaa9b9a1e54007cd759bf257ab7
Andrei Emeltchenko (4):
Bluetooth: Use %pMR BT addr print spec instead of batostr
Bluetooth: trivial: Shorten variable scope
Bluetooth: Use %pMR instead of baswap in seq_show
Bluetooth: trivial: Use preferred method for NULL check
include/net/bluetooth/bluetooth.h | 1 -
net/bluetooth/af_bluetooth.c | 20 ++++++++------------
net/bluetooth/bnep/core.c | 3 +--
net/bluetooth/cmtp/core.c | 2 +-
net/bluetooth/hci_conn.c | 6 +++---
net/bluetooth/hci_core.c | 22 +++++++++++-----------
net/bluetooth/hci_event.c | 15 +++++++--------
net/bluetooth/hci_sysfs.c | 10 +++++-----
net/bluetooth/hidp/core.c | 8 ++++++--
net/bluetooth/l2cap_core.c | 11 +++++------
net/bluetooth/lib.c | 14 --------------
net/bluetooth/rfcomm/core.c | 15 +++++++--------
net/bluetooth/rfcomm/sock.c | 9 ++++-----
net/bluetooth/rfcomm/tty.c | 6 +++---
net/bluetooth/sco.c | 12 ++++++------
15 files changed, 67 insertions(+), 87 deletions(-)
--
1.7.9.5
^ permalink raw reply
* [PATCHv1 1/4] Bluetooth: Use %pMR BT addr print spec instead of batostr
From: Andrei Emeltchenko @ 2012-08-07 15:05 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1344351906-27563-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Clean up old unsafe batostr function and use %pMR print specifier
for printing Bluetooth addresses.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
include/net/bluetooth/bluetooth.h | 1 -
net/bluetooth/bnep/core.c | 3 +--
net/bluetooth/cmtp/core.c | 2 +-
net/bluetooth/hci_conn.c | 6 +++---
net/bluetooth/hci_core.c | 22 +++++++++++-----------
net/bluetooth/hci_event.c | 15 +++++++--------
net/bluetooth/hci_sysfs.c | 10 +++++-----
net/bluetooth/hidp/core.c | 8 ++++++--
net/bluetooth/l2cap_core.c | 11 +++++------
net/bluetooth/lib.c | 14 --------------
net/bluetooth/rfcomm/core.c | 15 +++++++--------
net/bluetooth/rfcomm/sock.c | 9 ++++-----
net/bluetooth/rfcomm/tty.c | 6 +++---
net/bluetooth/sco.c | 12 ++++++------
14 files changed, 59 insertions(+), 75 deletions(-)
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index ede0369..2554b3f 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -180,7 +180,6 @@ static inline void bacpy(bdaddr_t *dst, bdaddr_t *src)
}
void baswap(bdaddr_t *dst, bdaddr_t *src);
-char *batostr(bdaddr_t *ba);
/* Common socket structures and functions */
diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c
index 4a6620b..a5b6397 100644
--- a/net/bluetooth/bnep/core.c
+++ b/net/bluetooth/bnep/core.c
@@ -182,8 +182,7 @@ static int bnep_ctrl_set_mcfilter(struct bnep_session *s, u8 *data, int len)
a2 = data;
data += ETH_ALEN;
- BT_DBG("mc filter %s -> %s",
- batostr((void *) a1), batostr((void *) a2));
+ BT_DBG("mc filter %pMR -> %pMR", a1, a2);
/* Iterate from a1 to a2 */
set_bit(bnep_mc_hash(a1), (ulong *) &s->mc_filter);
diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c
index 6c9c1fd..e0a6ebf 100644
--- a/net/bluetooth/cmtp/core.c
+++ b/net/bluetooth/cmtp/core.c
@@ -353,7 +353,7 @@ int cmtp_add_connection(struct cmtp_connadd_req *req, struct socket *sock)
BT_DBG("mtu %d", session->mtu);
- sprintf(session->name, "%s", batostr(&bt_sk(sock->sk)->dst));
+ sprintf(session->name, "%pMR", &bt_sk(sock->sk)->dst);
session->sock = sock;
session->state = BT_CONFIG;
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 5ad7da2..3ec5fc2 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -319,7 +319,7 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst)
{
struct hci_conn *conn;
- BT_DBG("%s dst %s", hdev->name, batostr(dst));
+ BT_DBG("%s dst %pMR", hdev->name, dst);
conn = kzalloc(sizeof(struct hci_conn), GFP_KERNEL);
if (!conn)
@@ -436,7 +436,7 @@ struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src)
int use_src = bacmp(src, BDADDR_ANY);
struct hci_dev *hdev = NULL, *d;
- BT_DBG("%s -> %s", batostr(src), batostr(dst));
+ BT_DBG("%pMR -> %pMR", src, dst);
read_lock(&hci_dev_list_lock);
@@ -479,7 +479,7 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst,
struct hci_conn *sco;
struct hci_conn *le;
- BT_DBG("%s dst %s", hdev->name, batostr(dst));
+ BT_DBG("%s dst %pMR", hdev->name, dst);
if (type == LE_LINK) {
le = hci_conn_hash_lookup_ba(hdev, LE_LINK, dst);
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index fa974a1..28bab9d 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -403,7 +403,7 @@ struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev,
struct discovery_state *cache = &hdev->discovery;
struct inquiry_entry *e;
- BT_DBG("cache %p, %s", cache, batostr(bdaddr));
+ BT_DBG("cache %p, %pMR", cache, bdaddr);
list_for_each_entry(e, &cache->all, all) {
if (!bacmp(&e->data.bdaddr, bdaddr))
@@ -419,7 +419,7 @@ struct inquiry_entry *hci_inquiry_cache_lookup_unknown(struct hci_dev *hdev,
struct discovery_state *cache = &hdev->discovery;
struct inquiry_entry *e;
- BT_DBG("cache %p, %s", cache, batostr(bdaddr));
+ BT_DBG("cache %p, %pMR", cache, bdaddr);
list_for_each_entry(e, &cache->unknown, list) {
if (!bacmp(&e->data.bdaddr, bdaddr))
@@ -436,7 +436,7 @@ struct inquiry_entry *hci_inquiry_cache_lookup_resolve(struct hci_dev *hdev,
struct discovery_state *cache = &hdev->discovery;
struct inquiry_entry *e;
- BT_DBG("cache %p bdaddr %s state %d", cache, batostr(bdaddr), state);
+ BT_DBG("cache %p bdaddr %pMR state %d", cache, bdaddr, state);
list_for_each_entry(e, &cache->resolve, list) {
if (!bacmp(bdaddr, BDADDR_ANY) && e->name_state == state)
@@ -473,7 +473,7 @@ bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data,
struct discovery_state *cache = &hdev->discovery;
struct inquiry_entry *ie;
- BT_DBG("cache %p, %s", cache, batostr(&data->bdaddr));
+ BT_DBG("cache %p, %pMR", cache, &data->bdaddr);
if (ssp)
*ssp = data->ssp_mode;
@@ -1255,7 +1255,7 @@ int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key,
list_add(&key->list, &hdev->link_keys);
}
- BT_DBG("%s key for %s type %u", hdev->name, batostr(bdaddr), type);
+ BT_DBG("%s key for %pMR type %u", hdev->name, bdaddr, type);
/* Some buggy controller combinations generate a changed
* combination key for legacy pairing even when there's no
@@ -1334,7 +1334,7 @@ int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr)
if (!key)
return -ENOENT;
- BT_DBG("%s removing %s", hdev->name, batostr(bdaddr));
+ BT_DBG("%s removing %pMR", hdev->name, bdaddr);
list_del(&key->list);
kfree(key);
@@ -1350,7 +1350,7 @@ int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr)
if (bacmp(bdaddr, &k->bdaddr))
continue;
- BT_DBG("%s removing %s", hdev->name, batostr(bdaddr));
+ BT_DBG("%s removing %pMR", hdev->name, bdaddr);
list_del(&k->list);
kfree(k);
@@ -1397,7 +1397,7 @@ int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr)
if (!data)
return -ENOENT;
- BT_DBG("%s removing %s", hdev->name, batostr(bdaddr));
+ BT_DBG("%s removing %pMR", hdev->name, bdaddr);
list_del(&data->list);
kfree(data);
@@ -1436,7 +1436,7 @@ int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash,
memcpy(data->hash, hash, sizeof(data->hash));
memcpy(data->randomizer, randomizer, sizeof(data->randomizer));
- BT_DBG("%s for %s", hdev->name, batostr(bdaddr));
+ BT_DBG("%s for %pMR", hdev->name, bdaddr);
return 0;
}
@@ -2307,8 +2307,8 @@ static void hci_link_tx_to(struct hci_dev *hdev, __u8 type)
/* Kill stalled connections */
list_for_each_entry_rcu(c, &h->list, list) {
if (c->type == type && c->sent) {
- BT_ERR("%s killing stalled connection %s",
- hdev->name, batostr(&c->dst));
+ BT_ERR("%s killing stalled connection %pMR",
+ hdev->name, &c->dst);
hci_acl_disconn(c, HCI_ERROR_REMOTE_USER_TERM);
}
}
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 32e21ad..f3a4568 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1209,7 +1209,7 @@ static void hci_cs_create_conn(struct hci_dev *hdev, __u8 status)
conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr);
- BT_DBG("%s bdaddr %s hcon %p", hdev->name, batostr(&cp->bdaddr), conn);
+ BT_DBG("%s bdaddr %pMR hcon %p", hdev->name, &cp->bdaddr, conn);
if (status) {
if (conn && conn->state == BT_CONNECT) {
@@ -1627,8 +1627,7 @@ static void hci_cs_le_create_conn(struct hci_dev *hdev, __u8 status)
return;
}
- BT_DBG("%s bdaddr %s conn %p", hdev->name, batostr(&conn->dst),
- conn);
+ BT_DBG("%s bdaddr %pMR conn %p", hdev->name, &conn->dst, conn);
conn->state = BT_CLOSED;
mgmt_connect_failed(hdev, &conn->dst, conn->type,
@@ -1805,7 +1804,7 @@ static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
struct hci_ev_conn_request *ev = (void *) skb->data;
int mask = hdev->link_mode;
- BT_DBG("%s bdaddr %s type 0x%x", hdev->name, batostr(&ev->bdaddr),
+ BT_DBG("%s bdaddr %pMR type 0x%x", hdev->name, &ev->bdaddr,
ev->link_type);
mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type);
@@ -2669,13 +2668,13 @@ static void hci_link_key_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
key = hci_find_link_key(hdev, &ev->bdaddr);
if (!key) {
- BT_DBG("%s link key not found for %s", hdev->name,
- batostr(&ev->bdaddr));
+ BT_DBG("%s link key not found for %pMR", hdev->name,
+ &ev->bdaddr);
goto not_found;
}
- BT_DBG("%s found key type %u for %s", hdev->name, key->type,
- batostr(&ev->bdaddr));
+ BT_DBG("%s found key type %u for %pMR", hdev->name, key->type,
+ &ev->bdaddr);
if (!test_bit(HCI_DEBUG_KEYS, &hdev->dev_flags) &&
key->type == HCI_LK_DEBUG_COMBINATION) {
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index a20e61c..55cceee 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -38,7 +38,7 @@ static ssize_t show_link_address(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct hci_conn *conn = to_hci_conn(dev);
- return sprintf(buf, "%s\n", batostr(&conn->dst));
+ return sprintf(buf, "%pMR\n", &conn->dst);
}
static ssize_t show_link_features(struct device *dev,
@@ -224,7 +224,7 @@ static ssize_t show_address(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct hci_dev *hdev = to_hci_dev(dev);
- return sprintf(buf, "%s\n", batostr(&hdev->bdaddr));
+ return sprintf(buf, "%pMR\n", &hdev->bdaddr);
}
static ssize_t show_features(struct device *dev,
@@ -406,8 +406,8 @@ static int inquiry_cache_show(struct seq_file *f, void *p)
list_for_each_entry(e, &cache->all, all) {
struct inquiry_data *data = &e->data;
- seq_printf(f, "%s %d %d %d 0x%.2x%.2x%.2x 0x%.4x %d %d %u\n",
- batostr(&data->bdaddr),
+ seq_printf(f, "%pMR %d %d %d 0x%.2x%.2x%.2x 0x%.4x %d %d %u\n",
+ &data->bdaddr,
data->pscan_rep_mode, data->pscan_period_mode,
data->pscan_mode, data->dev_class[2],
data->dev_class[1], data->dev_class[0],
@@ -440,7 +440,7 @@ static int blacklist_show(struct seq_file *f, void *p)
hci_dev_lock(hdev);
list_for_each_entry(b, &hdev->blacklist, list)
- seq_printf(f, "%s\n", batostr(&b->bdaddr));
+ seq_printf(f, "%pMR\n", &b->bdaddr);
hci_dev_unlock(hdev);
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index ccd985d..0c00284 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -932,8 +932,12 @@ static int hidp_setup_hid(struct hidp_session *session,
hid->country = req->country;
strncpy(hid->name, req->name, 128);
- strncpy(hid->phys, batostr(&bt_sk(session->ctrl_sock->sk)->src), 64);
- strncpy(hid->uniq, batostr(&bt_sk(session->ctrl_sock->sk)->dst), 64);
+
+ snprintf(hid->phys, sizeof(hid->phys), "%pMR",
+ &bt_sk(session->ctrl_sock->sk)->src);
+
+ snprintf(hid->uniq, sizeof(hid->uniq), "%pMR",
+ &bt_sk(session->ctrl_sock->sk)->dst);
hid->dev.parent = &session->conn->dev;
hid->ll_driver = &hidp_hid_driver;
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index c7b7b1f..56b98ba 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1504,7 +1504,7 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
__u8 auth_type;
int err;
- BT_DBG("%s -> %s (type %u) psm 0x%2.2x", batostr(src), batostr(dst),
+ BT_DBG("%pMR -> %pMR (type %u) psm 0x%2.2x", src, dst,
dst_type, __le16_to_cpu(chan->psm));
hdev = hci_get_route(dst, src);
@@ -5382,7 +5382,7 @@ int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr)
int exact = 0, lm1 = 0, lm2 = 0;
struct l2cap_chan *c;
- BT_DBG("hdev %s, bdaddr %s", hdev->name, batostr(bdaddr));
+ BT_DBG("hdev %s, bdaddr %pMR", hdev->name, bdaddr);
/* Find listening sockets and check their link_mode */
read_lock(&chan_list_lock);
@@ -5412,7 +5412,7 @@ void l2cap_connect_cfm(struct hci_conn *hcon, u8 status)
{
struct l2cap_conn *conn;
- BT_DBG("hcon %p bdaddr %s status %d", hcon, batostr(&hcon->dst), status);
+ BT_DBG("hcon %p bdaddr %pMR status %d", hcon, &hcon->dst, status);
if (!status) {
conn = l2cap_conn_add(hcon, status);
@@ -5691,9 +5691,8 @@ static int l2cap_debugfs_show(struct seq_file *f, void *p)
list_for_each_entry(c, &chan_list, global_l) {
struct sock *sk = c->sk;
- seq_printf(f, "%s %s %d %d 0x%4.4x 0x%4.4x %d %d %d %d\n",
- batostr(&bt_sk(sk)->src),
- batostr(&bt_sk(sk)->dst),
+ seq_printf(f, "%pMR %pMR %d %d 0x%4.4x 0x%4.4x %d %d %d %d\n",
+ &bt_sk(sk)->src, &bt_sk(sk)->dst,
c->state, __le16_to_cpu(c->psm),
c->scid, c->dcid, c->imtu, c->omtu,
c->sec_level, c->mode);
diff --git a/net/bluetooth/lib.c b/net/bluetooth/lib.c
index e1c9752..b3fbc73 100644
--- a/net/bluetooth/lib.c
+++ b/net/bluetooth/lib.c
@@ -41,20 +41,6 @@ void baswap(bdaddr_t *dst, bdaddr_t *src)
}
EXPORT_SYMBOL(baswap);
-char *batostr(bdaddr_t *ba)
-{
- static char str[2][18];
- static int i = 1;
-
- i ^= 1;
- sprintf(str[i], "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
- ba->b[5], ba->b[4], ba->b[3],
- ba->b[2], ba->b[1], ba->b[0]);
-
- return str[i];
-}
-EXPORT_SYMBOL(batostr);
-
/* Bluetooth error codes to Unix errno mapping */
int bt_to_errno(__u16 code)
{
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index c75107e..fb1d83d 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -377,8 +377,8 @@ static int __rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst,
int err = 0;
u8 dlci;
- BT_DBG("dlc %p state %ld %s %s channel %d",
- d, d->state, batostr(src), batostr(dst), channel);
+ BT_DBG("dlc %p state %ld %pMR -> %pMR channel %d",
+ d, d->state, src, dst, channel);
if (channel < 1 || channel > 30)
return -EINVAL;
@@ -676,7 +676,7 @@ static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src,
struct socket *sock;
struct sock *sk;
- BT_DBG("%s %s", batostr(src), batostr(dst));
+ BT_DBG("%pMR -> %pMR", src, dst);
*err = rfcomm_l2sock_create(&sock);
if (*err < 0)
@@ -2125,11 +2125,10 @@ static int rfcomm_dlc_debugfs_show(struct seq_file *f, void *x)
list_for_each_entry(d, &s->dlcs, list) {
struct sock *sk = s->sock->sk;
- seq_printf(f, "%s %s %ld %d %d %d %d\n",
- batostr(&bt_sk(sk)->src),
- batostr(&bt_sk(sk)->dst),
- d->state, d->dlci, d->mtu,
- d->rx_credits, d->tx_credits);
+ seq_printf(f, "%pMR %pMR %ld %d %d %d %d\n",
+ &bt_sk(sk)->src, &bt_sk(sk)->dst,
+ d->state, d->dlci, d->mtu,
+ d->rx_credits, d->tx_credits);
}
}
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
index 260821a..867a065 100644
--- a/net/bluetooth/rfcomm/sock.c
+++ b/net/bluetooth/rfcomm/sock.c
@@ -334,7 +334,7 @@ static int rfcomm_sock_bind(struct socket *sock, struct sockaddr *addr, int addr
struct sock *sk = sock->sk;
int err = 0;
- BT_DBG("sk %p %s", sk, batostr(&sa->rc_bdaddr));
+ BT_DBG("sk %p %pMR", sk, &sa->rc_bdaddr);
if (!addr || addr->sa_family != AF_BLUETOOTH)
return -EINVAL;
@@ -973,10 +973,9 @@ static int rfcomm_sock_debugfs_show(struct seq_file *f, void *p)
read_lock(&rfcomm_sk_list.lock);
sk_for_each(sk, node, &rfcomm_sk_list.head) {
- seq_printf(f, "%s %s %d %d\n",
- batostr(&bt_sk(sk)->src),
- batostr(&bt_sk(sk)->dst),
- sk->sk_state, rfcomm_pi(sk)->channel);
+ seq_printf(f, "%pMR %pMR %d %d\n",
+ &bt_sk(sk)->src, &bt_sk(sk)->dst,
+ sk->sk_state, rfcomm_pi(sk)->channel);
}
read_unlock(&rfcomm_sk_list.lock);
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index cb96077..6baf64d 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -166,7 +166,7 @@ static struct device *rfcomm_get_device(struct rfcomm_dev *dev)
static ssize_t show_address(struct device *tty_dev, struct device_attribute *attr, char *buf)
{
struct rfcomm_dev *dev = dev_get_drvdata(tty_dev);
- return sprintf(buf, "%s\n", batostr(&dev->dst));
+ return sprintf(buf, "%pMR\n", &dev->dst);
}
static ssize_t show_channel(struct device *tty_dev, struct device_attribute *attr, char *buf)
@@ -663,8 +663,8 @@ static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp)
if (!dev)
return -ENODEV;
- BT_DBG("dev %p dst %s channel %d opened %d", dev, batostr(&dev->dst),
- dev->channel, dev->port.count);
+ BT_DBG("dev %p dst %pMR channel %d opened %d", dev, &dev->dst,
+ dev->channel, dev->port.count);
spin_lock_irqsave(&dev->port.lock, flags);
if (++dev->port.count > 1) {
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index caa109d..5729f1b 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -163,7 +163,7 @@ static int sco_connect(struct sock *sk)
struct hci_dev *hdev;
int err, type;
- BT_DBG("%s -> %s", batostr(src), batostr(dst));
+ BT_DBG("%pMR -> %pMR", src, dst);
hdev = hci_get_route(dst, src);
if (!hdev)
@@ -451,7 +451,7 @@ static int sco_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_le
struct sock *sk = sock->sk;
int err = 0;
- BT_DBG("sk %p %s", sk, batostr(&sa->sco_bdaddr));
+ BT_DBG("sk %p %pMR", sk, &sa->sco_bdaddr);
if (!addr || addr->sa_family != AF_BLUETOOTH)
return -EINVAL;
@@ -894,7 +894,7 @@ int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr)
struct hlist_node *node;
int lm = 0;
- BT_DBG("hdev %s, bdaddr %s", hdev->name, batostr(bdaddr));
+ BT_DBG("hdev %s, bdaddr %pMR", hdev->name, bdaddr);
/* Find listening sockets */
read_lock(&sco_sk_list.lock);
@@ -915,7 +915,7 @@ int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr)
void sco_connect_cfm(struct hci_conn *hcon, __u8 status)
{
- BT_DBG("hcon %p bdaddr %s status %d", hcon, batostr(&hcon->dst), status);
+ BT_DBG("hcon %p bdaddr %pMR status %d", hcon, &hcon->dst, status);
if (!status) {
struct sco_conn *conn;
@@ -960,8 +960,8 @@ static int sco_debugfs_show(struct seq_file *f, void *p)
read_lock(&sco_sk_list.lock);
sk_for_each(sk, node, &sco_sk_list.head) {
- seq_printf(f, "%s %s %d\n", batostr(&bt_sk(sk)->src),
- batostr(&bt_sk(sk)->dst), sk->sk_state);
+ seq_printf(f, "%pMR %pMR %d\n", &bt_sk(sk)->src,
+ &bt_sk(sk)->dst, sk->sk_state);
}
read_unlock(&sco_sk_list.lock);
--
1.7.9.5
^ permalink raw reply related
* [PATCHv1 2/4] Bluetooth: trivial: Shorten variable scope
From: Andrei Emeltchenko @ 2012-08-07 15:05 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1344351906-27563-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Make code more clear by moving sk and bt vars to the place where
they are actually used.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
net/bluetooth/af_bluetooth.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
index 58f9762..1b88fe4 100644
--- a/net/bluetooth/af_bluetooth.c
+++ b/net/bluetooth/af_bluetooth.c
@@ -567,8 +567,6 @@ static void bt_seq_stop(struct seq_file *seq, void *v)
static int bt_seq_show(struct seq_file *seq, void *v)
{
- struct sock *sk;
- struct bt_sock *bt;
struct bt_seq_state *s = seq->private;
struct bt_sock_list *l = s->l;
bdaddr_t src_baswapped, dst_baswapped;
@@ -583,8 +581,8 @@ static int bt_seq_show(struct seq_file *seq, void *v)
seq_putc(seq, '\n');
} else {
- sk = sk_entry(v);
- bt = bt_sk(sk);
+ struct sock *sk = sk_entry(v);
+ struct bt_sock *bt = bt_sk(sk);
baswap(&src_baswapped, &bt->src);
baswap(&dst_baswapped, &bt->dst);
--
1.7.9.5
^ permalink raw reply related
* [PATCHv1 3/4] Bluetooth: Use %pMR instead of baswap in seq_show
From: Andrei Emeltchenko @ 2012-08-07 15:05 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1344351906-27563-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Use new bluetooth address print specifier %pMR for printing
bluetooth addresses instead of dedicated variable and baswap.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
net/bluetooth/af_bluetooth.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
index 1b88fe4..a724f6c 100644
--- a/net/bluetooth/af_bluetooth.c
+++ b/net/bluetooth/af_bluetooth.c
@@ -569,7 +569,6 @@ static int bt_seq_show(struct seq_file *seq, void *v)
{
struct bt_seq_state *s = seq->private;
struct bt_sock_list *l = s->l;
- bdaddr_t src_baswapped, dst_baswapped;
if (v == SEQ_START_TOKEN) {
seq_puts(seq ,"sk RefCnt Rmem Wmem User Inode Src Dst Parent");
@@ -583,18 +582,17 @@ static int bt_seq_show(struct seq_file *seq, void *v)
} else {
struct sock *sk = sk_entry(v);
struct bt_sock *bt = bt_sk(sk);
- baswap(&src_baswapped, &bt->src);
- baswap(&dst_baswapped, &bt->dst);
- seq_printf(seq, "%pK %-6d %-6u %-6u %-6u %-6lu %pM %pM %-6lu",
+ seq_printf(seq,
+ "%pK %-6d %-6u %-6u %-6u %-6lu %pMR %pMR %-6lu",
sk,
atomic_read(&sk->sk_refcnt),
sk_rmem_alloc_get(sk),
sk_wmem_alloc_get(sk),
sock_i_uid(sk),
sock_i_ino(sk),
- &src_baswapped,
- &dst_baswapped,
+ &bt->src,
+ &bt->dst,
bt->parent? sock_i_ino(bt->parent): 0LU);
if (l->custom_seq_show) {
--
1.7.9.5
^ permalink raw reply related
* [PATCHv1 4/4] Bluetooth: trivial: Use preferred method for NULL check
From: Andrei Emeltchenko @ 2012-08-07 15:05 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1344351906-27563-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Use standard bluetooth way to check NULL pointer !var instead of
var == NULL.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
net/bluetooth/af_bluetooth.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
index a724f6c..a9ad589 100644
--- a/net/bluetooth/af_bluetooth.c
+++ b/net/bluetooth/af_bluetooth.c
@@ -620,7 +620,7 @@ static int bt_seq_open(struct inode *inode, struct file *file)
sk_list = PDE(inode)->data;
s = __seq_open_private(file, &bt_seq_ops,
sizeof(struct bt_seq_state));
- if (s == NULL)
+ if (!s)
return -ENOMEM;
s->l = sk_list;
@@ -642,7 +642,7 @@ int bt_procfs_init(struct module* module, struct net *net, const char *name,
sk_list->fops.release = seq_release_private;
pde = proc_net_fops_create(net, name, 0, &sk_list->fops);
- if (pde == NULL)
+ if (!pde)
return -ENOMEM;
pde->data = sk_list;
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH v2] Bluetooth: Add support for Sony Vaio T-Series
From: Marcel Holtmann @ 2012-08-07 15:43 UTC (permalink / raw)
To: Mohammed Shafi Shajakhan; +Cc: linux-bluetooth, gustavo, yevgeniy.melnichuk
In-Reply-To: <1344349090-4397-1-git-send-email-mohammed@qca.qualcomm.com>
Hi Mohammed,
> Add Sony Vaio T-Series Bluetooth Module( 0x489:0xE036) to
> the blacklist of btusb module and add it to the ath3k module.
>
> output of cat /sys/kernel/debug/usb/devices
>
> T: Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#= 5 Spd=12 MxCh= 0
> D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
> P: Vendor=0489 ProdID=e036 Rev= 0.02
> S: Manufacturer=Atheros Communications
> S: Product=Bluetooth USB Host Controller
> S: SerialNumber=Alaska Day 2006
> C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
> I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms
> E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
> E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
> I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms
> E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms
> I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms
> E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms
> I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms
> E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms
> I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms
> E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms
> I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms
> E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms
> I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
> E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms
>
> Signed-off-by: Yevgeniy Melnichuk <yevgeniy.melnichuk@googlemail.com>
> Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
> ---
> drivers/bluetooth/ath3k.c | 2 ++
> drivers/bluetooth/btusb.c | 1 +
> 2 files changed, 3 insertions(+), 0 deletions(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply
* Re: [PATCHv1 0/4] Remove unsafe batostr
From: Marcel Holtmann @ 2012-08-07 15:45 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1344351906-27563-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
> Since the patch "vsprintf: add %pMR for Bluetooth MAC address" in in linux-next and wireless-testing
> remove batostr.
>
> http://git.kernel.org/?p=linux/kernel/git/linville/wireless-testing.git;a=commitdiff;h=76597ff989a1fbaa9b9a1e54007cd759bf257ab7
>
> Andrei Emeltchenko (4):
> Bluetooth: Use %pMR BT addr print spec instead of batostr
> Bluetooth: trivial: Shorten variable scope
> Bluetooth: Use %pMR instead of baswap in seq_show
> Bluetooth: trivial: Use preferred method for NULL check
>
> include/net/bluetooth/bluetooth.h | 1 -
> net/bluetooth/af_bluetooth.c | 20 ++++++++------------
> net/bluetooth/bnep/core.c | 3 +--
> net/bluetooth/cmtp/core.c | 2 +-
> net/bluetooth/hci_conn.c | 6 +++---
> net/bluetooth/hci_core.c | 22 +++++++++++-----------
> net/bluetooth/hci_event.c | 15 +++++++--------
> net/bluetooth/hci_sysfs.c | 10 +++++-----
> net/bluetooth/hidp/core.c | 8 ++++++--
> net/bluetooth/l2cap_core.c | 11 +++++------
> net/bluetooth/lib.c | 14 --------------
> net/bluetooth/rfcomm/core.c | 15 +++++++--------
> net/bluetooth/rfcomm/sock.c | 9 ++++-----
> net/bluetooth/rfcomm/tty.c | 6 +++---
> net/bluetooth/sco.c | 12 ++++++------
> 15 files changed, 67 insertions(+), 87 deletions(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply
* Re: [PATCH v2 0/9] Add GATT Client Battery Service
From: Joao Paulo Rechi Vita @ 2012-08-07 16:29 UTC (permalink / raw)
To: Chen Ganir; +Cc: Claudio Takahasi, linux-bluetooth
In-Reply-To: <501F5BB9.30406@ti.com>
Hello Chen,
On Mon, Aug 6, 2012 at 2:52 AM, Chen Ganir <chen.ganir@ti.com> wrote:
> Claudio,
>
>
> On 08/03/2012 03:57 PM, Claudio Takahasi wrote:
>>
>> Hi Chen Ganir:
>>
>> On Wed, Aug 1, 2012 at 3:40 AM, Chen Ganir <chen.ganir@ti.com> wrote:
>>>
>>> On 07/25/2012 08:42 AM, Chen Ganir wrote:
>>>>
>>>>
>>>> Add suupport for LE GATT Client Battery Service.
>>>>
>>>> This plugin adds battery list to the btd_device, exposes DBUS API to
>>>> list
>>>> the
>>>> device batteries, and allows querying for battery information. In
>>>> addition
>>>> this
>>>> patch allows getting notifications for battery level changes.
>>>>
>>>> Look at doc/device-api.txt and doc/battery-api.txt for more information.
>>>>
>>>> This is version 2 of this patch set, rebased on top of the latest
>>>> sources
>>>> and
>>>> fixes some issues found during testing and in the ML comments.
>>>>
>>>> Chen Ganir (9):
>>>> Battery: Add Battery Service GATT Client
>>>> Battery: Add connection logic
>>>> Battery: Discover Characteristic Descriptors
>>>> Battery: Get Battery ID
>>>> Battery: Add Battery list to btd_device
>>>> Battery: Add Battery D-BUS API
>>>> Battery: Read Battery level characteristic
>>>> Battery: Add support for notifications
>>>> Battery: Emit property changed on first read
>>>>
>>>> Makefile.am | 10 +-
>>>> doc/battery-api.txt | 38 +++
>>>> doc/device-api.txt | 5 +
>>>> profiles/batterystate/batterystate.c | 518
>>>> ++++++++++++++++++++++++++++++++++
>>>> profiles/batterystate/batterystate.h | 24 ++
>>>> profiles/batterystate/main.c | 67 +++++
>>>> profiles/batterystate/manager.c | 93 ++++++
>>>> profiles/batterystate/manager.h | 24 ++
>>>> src/device.c | 66 +++++
>>>> src/device.h | 3 +
>>>> 10 files changed, 846 insertions(+), 2 deletions(-)
>>>> create mode 100644 doc/battery-api.txt
>>>> create mode 100644 profiles/batterystate/batterystate.c
>>>> create mode 100644 profiles/batterystate/batterystate.h
>>>> create mode 100644 profiles/batterystate/main.c
>>>> create mode 100644 profiles/batterystate/manager.c
>>>> create mode 100644 profiles/batterystate/manager.h
>>>>
>>>
>>> Ping anyone ? Did anyone get to review this ?
>>>
>>> Thanks,
>>> Chen Ganir
>>
>>
>>
>> not yet.
>> We have an INTERNAL release in two weeks, next week we will send
>> comments in the ML.
>>
> Thanks. I'll be waiting.
>
>
I've been reviewing and did some quick tests on your code. It's
working with some minor issues, and I'll comment them on each commit.
But first I have a few more general questions:
1. Any specific reason for calling the plugin directory and files
'batterystate'? I don't see any reference to this name on the
documentation.
2. The spec recommends reading the battery level value with very
little frequency. Quoting the section 3.1.1:
"For example, if the expected battery life is in the order of years,
reading the battery level value more frequently than once a week is
not recommended."
And on the same section:
"The value of the Client Characteristic Configuration descriptor is
persistent for bonded devices when not in a connection."
At the moment the plugin is reading it every time it is probed, which
is a lot more than recommended. What do you think about only enabling
notifications after paring, and not reading the value at all and just
wait for the notifications. If the device doesn't support
notifications (which I *think* should be uncommon) we can read the
value after pairing and refresh it every week or so. For this to work
well we'll need characteristics value storage support, but that will
improve other things as well. While we don't support that, I don't
have other ideas to improve this.
>> BR,
>> Claudio
>>
>
> Chen Ganir.
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth"
> in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
João Paulo Rechi Vita
Openbossa Labs - INdT
^ permalink raw reply
* Re: [PATCH v2 2/9] Battery: Add connection logic
From: Joao Paulo Rechi Vita @ 2012-08-07 16:29 UTC (permalink / raw)
To: Chen Ganir; +Cc: linux-bluetooth
In-Reply-To: <1343194947-13659-3-git-send-email-chen.ganir@ti.com>
On Wed, Jul 25, 2012 at 2:42 AM, Chen Ganir <chen.ganir@ti.com> wrote:
> Add connection logic to the Battery Plugin. When the driver is
> loaded, it will request a connection to the remote device and
> release the connection request when destroyed.
> ---
> profiles/batterystate/batterystate.c | 78 +++++++++++++++++++++++++++++++++-
> profiles/batterystate/batterystate.h | 3 +-
> profiles/batterystate/manager.c | 22 +++++++++-
> 3 files changed, 99 insertions(+), 4 deletions(-)
>
> diff --git a/profiles/batterystate/batterystate.c b/profiles/batterystate/batterystate.c
> index 04c2e5e..40663f6 100644
> --- a/profiles/batterystate/batterystate.c
> +++ b/profiles/batterystate/batterystate.c
> @@ -29,17 +29,29 @@
>
> #include "adapter.h"
> #include "device.h"
> +#include "gattrib.h"
> +#include "attio.h"
> #include "att.h"
> #include "gattrib.h"
> #include "gatt.h"
> #include "batterystate.h"
> +#include "log.h"
>
> struct battery {
> struct btd_device *dev; /* Device reference */
> + GAttrib *attrib; /* GATT connection */
> + guint attioid; /* Att watcher id */
> + struct att_range *svc_range; /* Battery range */
> + GSList *chars; /* Characteristics */
> };
>
> static GSList *servers;
>
> +struct characteristic {
> + struct gatt_char attr; /* Characteristic */
> + struct battery *batt; /* Parent Battery Service */
> +};
> +
> static gint cmp_device(gconstpointer a, gconstpointer b)
> {
> const struct battery *batt = a;
> @@ -55,20 +67,84 @@ static void batterystate_free(gpointer user_data)
> {
> struct battery *batt = user_data;
>
> + if (batt->chars != NULL)
> + g_slist_free_full(batt->chars, g_free);
> +
> + if (batt->attioid > 0)
> + btd_device_remove_attio_callback(batt->dev, batt->attioid);
> +
> + if (batt->attrib != NULL)
> + g_attrib_unref(batt->attrib);
> +
> btd_device_unref(batt->dev);
> g_free(batt);
> }
>
> +static void configure_batterystate_cb(GSList *characteristics, guint8 status,
> + gpointer user_data)
> +{
> + struct battery *batt = user_data;
> + GSList *l;
> +
> + if (status != 0) {
> + error("Discover batterystate characteristics: %s",
> + att_ecode2str(status));
> + return;
> + }
>
> -int batterystate_register(struct btd_device *device)
> + for (l = characteristics; l; l = l->next) {
> + struct gatt_char *c = l->data;
> + struct characteristic *ch;
> +
> + ch = g_new0(struct characteristic, 1);
> + ch->attr.handle = c->handle;
> + ch->attr.properties = c->properties;
> + ch->attr.value_handle = c->value_handle;
> + memcpy(ch->attr.uuid, c->uuid, MAX_LEN_UUID_STR + 1);
> + ch->batt = batt;
> +
> + batt->chars = g_slist_append(batt->chars, ch);
> + }
> +}
> +
> +static void attio_connected_cb(GAttrib *attrib, gpointer user_data)
> +{
> + struct battery *batt = user_data;
> +
> + batt->attrib = g_attrib_ref(attrib);
> +
> + if (batt->chars == NULL) {
> + gatt_discover_char(batt->attrib, batt->svc_range->start,
> + batt->svc_range->end, NULL,
> + configure_batterystate_cb, batt);
> + }
> +}
> +
> +static void attio_disconnected_cb(gpointer user_data)
> +{
> + struct battery *batt = user_data;
> +
> + g_attrib_unref(batt->attrib);
> + batt->attrib = NULL;
> +}
> +
> +int batterystate_register(struct btd_device *device,
> + struct gatt_primary *prim)
> {
> struct battery *batt;
>
> batt = g_new0(struct battery, 1);
> batt->dev = btd_device_ref(device);
>
> + batt->svc_range = g_new0(struct att_range, 1);
> + batt->svc_range->start = prim->range.start;
> + batt->svc_range->end = prim->range.end;
> +
> servers = g_slist_prepend(servers, batt);
>
> + batt->attioid = btd_device_add_attio_callback(device,
> + attio_connected_cb, attio_disconnected_cb,
> + batt);
> return 0;
> }
>
> diff --git a/profiles/batterystate/batterystate.h b/profiles/batterystate/batterystate.h
> index 9aedae7..2d30028 100644
> --- a/profiles/batterystate/batterystate.h
> +++ b/profiles/batterystate/batterystate.h
> @@ -19,6 +19,5 @@
> * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
> *
> */
> -
> -int batterystate_register(struct btd_device *device);
> +int batterystate_register(struct btd_device *device, struct gatt_primary *prim);
> void batterystate_unregister(struct btd_device *device);
> diff --git a/profiles/batterystate/manager.c b/profiles/batterystate/manager.c
> index 6718acf..62076ac 100644
> --- a/profiles/batterystate/manager.c
> +++ b/profiles/batterystate/manager.c
> @@ -34,9 +34,29 @@
>
> #define BATTERY_SERVICE_UUID "0000180f-0000-1000-8000-00805f9b34fb"
>
> +static gint primary_uuid_cmp(gconstpointer a, gconstpointer b)
> +{
> + const struct gatt_primary *prim = a;
> + const char *uuid = b;
> +
> + return g_strcmp0(prim->uuid, uuid);
> +}
> +
> static int batterystate_driver_probe(struct btd_device *device, GSList *uuids)
> {
> - return batterystate_register(device);
> + struct gatt_primary *prim;
> + GSList *primaries, *l;
> +
> + primaries = btd_device_get_primaries(device);
> +
> + l = g_slist_find_custom(primaries, BATTERY_SERVICE_UUID,
> + primary_uuid_cmp);
No need to check for the BATTERY_SERVICE_UUID. If driver has been
probed its because the remote implements this service, since it's
declared on the .uuids field of the plugin struct.
> + if (l == NULL)
> + return -EINVAL;
> +
> + prim = l->data;
> +
> + return batterystate_register(device, prim);
Getting the primary service pointer (manly used for handle range
information could be done from inside batterystate_register() itself
on batterystate.c instead of doing so on the manager code. This way
the plugin keeps more self-contained.
> }
>
> static void batterystate_driver_remove(struct btd_device *device)
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
João Paulo Rechi Vita
Openbossa Labs - INdT
^ permalink raw reply
* Re: [PATCH v2 4/9] Battery: Get Battery ID
From: Joao Paulo Rechi Vita @ 2012-08-07 16:29 UTC (permalink / raw)
To: Chen Ganir; +Cc: linux-bluetooth
In-Reply-To: <1343194947-13659-5-git-send-email-chen.ganir@ti.com>
On Wed, Jul 25, 2012 at 2:42 AM, Chen Ganir <chen.ganir@ti.com> wrote:
> Read the battery level format characteristic descriptor to get the
> unique namespace and description values.
> ---
> profiles/batterystate/batterystate.c | 113 ++++++++++++++++++++++++++--------
> 1 file changed, 86 insertions(+), 27 deletions(-)
>
> diff --git a/profiles/batterystate/batterystate.c b/profiles/batterystate/batterystate.c
> index a7d2f6e..d3a1974 100644
> --- a/profiles/batterystate/batterystate.c
> +++ b/profiles/batterystate/batterystate.c
> @@ -37,6 +37,8 @@
> #include "batterystate.h"
> #include "log.h"
>
> +#define BATTERY_LEVEL_UUID "00002a19-0000-1000-8000-00805f9b34fb"
> +
> struct battery {
> struct btd_device *dev; /* Device reference */
> GAttrib *attrib; /* GATT connection */
> @@ -48,15 +50,18 @@ struct battery {
> static GSList *servers;
>
> struct characteristic {
> - struct gatt_char attr; /* Characteristic */
> - struct battery *batt; /* Parent Battery Service */
> + struct gatt_char attr; /* Characteristic */
> + struct battery *batt; /* Parent Battery Service */
> GSList *desc; /* Descriptors */
> + uint8_t ns; /* Battery Namespace */
> + uint16_t description; /* Battery description */
> + uint8_t level; /* Battery last known level */
The 'level' field it's not being used here. It should be added by the
same commit that uses it.
> };
>
> struct descriptor {
> - struct characteristic *ch; /* Parent Characteristic */
> - uint16_t handle; /* Descriptor Handle */
> - bt_uuid_t uuid; /* UUID */
> + struct characteristic *ch; /* Parent Characteristic */
> + uint16_t handle; /* Descriptor Handle */
> + bt_uuid_t uuid; /* UUID */
> };
>
> static gint cmp_device(gconstpointer a, gconstpointer b)
> @@ -87,6 +92,55 @@ static void batterystate_free(gpointer user_data)
> g_free(batt);
> }
>
> +static void batterylevel_presentation_format_desc_cb(guint8 status,
> + const guint8 *pdu, guint16 len,
> + gpointer user_data)
> +{
> + struct descriptor *desc = user_data;
> + uint8_t value[ATT_MAX_MTU];
> + int vlen;
> +
> + if (status != 0) {
> + error("Presentation Format desc read failed: %s",
> + att_ecode2str(status));
> + return;
> + }
> +
> + vlen = dec_read_resp(pdu, len, value, sizeof(value));
> + if (!vlen) {
> + error("Presentation Format desc read failed: Protocol error\n");
> + return;
> + }
> +
> + if (vlen < 7) {
> + error("Presentation Format desc read failed: Invalid range");
> + return;
> + }
> +
> + desc->ch->ns = value[4];
> + desc->ch->description = att_get_u16(&value[5]);
> +}
> +
> +
> +static void process_batterylevel_desc(struct descriptor *desc)
> +{
> + struct characteristic *ch = desc->ch;
> + char uuidstr[MAX_LEN_UUID_STR];
> + bt_uuid_t btuuid;
> +
> + bt_uuid16_create(&btuuid, GATT_CHARAC_FMT_UUID);
> +
> + if (bt_uuid_cmp(&desc->uuid, &btuuid) == 0) {
> + gatt_read_char(ch->batt->attrib, desc->handle, 0,
> + batterylevel_presentation_format_desc_cb, desc);
> + return;
> + }
> +
> + bt_uuid_to_string(&desc->uuid, uuidstr, MAX_LEN_UUID_STR);
> + DBG("Ignored descriptor %s characteristic %s", uuidstr, ch->attr.uuid);
> +}
> +
> +
> static void discover_desc_cb(guint8 status, const guint8 *pdu, guint16 len,
> gpointer user_data)
> {
> @@ -120,6 +174,7 @@ static void discover_desc_cb(guint8 status, const guint8 *pdu, guint16 len,
> desc->uuid = att_get_uuid128(&value[2]);
>
> ch->desc = g_slist_append(ch->desc, desc);
> + process_batterylevel_desc(desc);
> }
>
> att_data_list_free(list);
> @@ -140,31 +195,35 @@ static void configure_batterystate_cb(GSList *characteristics, guint8 status,
>
> for (l = characteristics; l; l = l->next) {
> struct gatt_char *c = l->data;
> - struct characteristic *ch;
> - uint16_t start, end;
> -
> - ch = g_new0(struct characteristic, 1);
> - ch->attr.handle = c->handle;
> - ch->attr.properties = c->properties;
> - ch->attr.value_handle = c->value_handle;
> - memcpy(ch->attr.uuid, c->uuid, MAX_LEN_UUID_STR + 1);
> - ch->batt = batt;
>
> - batt->chars = g_slist_append(batt->chars, ch);
> -
> - start = c->value_handle + 1;
> -
> - if (l->next != NULL) {
> - struct gatt_char *c = l->next->data;
> - if (start == c->handle)
> + if (g_strcmp0(c->uuid, BATTERY_LEVEL_UUID) == 0) {
> + struct characteristic *ch;
> + uint16_t start, end;
> +
> + ch = g_new0(struct characteristic, 1);
> + ch->attr.handle = c->handle;
> + ch->attr.properties = c->properties;
> + ch->attr.value_handle = c->value_handle;
> + memcpy(ch->attr.uuid, c->uuid, MAX_LEN_UUID_STR + 1);
> + ch->batt = batt;
> +
> + batt->chars = g_slist_append(batt->chars, ch);
> +
> + start = c->value_handle + 1;
> +
> + if (l->next != NULL) {
> + struct gatt_char *c = l->next->data;
> + if (start == c->handle)
> + continue;
> + end = c->handle - 1;
> + } else if (c->value_handle != batt->svc_range->end)
> + end = batt->svc_range->end;
> + else
> continue;
> - end = c->handle - 1;
> - } else if (c->value_handle != batt->svc_range->end)
> - end = batt->svc_range->end;
> - else
> - continue;
>
> - gatt_find_info(batt->attrib, start, end, discover_desc_cb, ch);
> + gatt_find_info(batt->attrib, start, end,
> + discover_desc_cb, ch);
> + }
> }
> }
>
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
João Paulo Rechi Vita
Openbossa Labs - INdT
^ 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