* Re: Bluez 4.101
From: Chan-yeol Park @ 2012-08-16 1:16 UTC (permalink / raw)
To: John Tobias; +Cc: linux-bluetooth
In-Reply-To: <CACUGKYMjKcZZJsYi-SXCd1C=guWtKP3k=SBVPVe=+MR0R=pwHg@mail.gmail.com>
Hi John
On 08/16/2012 09:26 AM, John Tobias wrote:
> Hi All,
>
> I downloaded the latest Bluez 4.101, compiled and installed on my
> machine. After executing the command (/usr/sbin/bluetoothd -n -d), it
> returned "bluetoothd[15067]: mgmt setup failed: Invalid argument."
> I am just wondering what are the missing key on my build?.
It looks like that your kernel doesn't support mgmt interface.
Which version of kernel do you use?
Regards
chanyeol
^ permalink raw reply
* Re: Bluez 4.101
From: John Tobias @ 2012-08-16 2:54 UTC (permalink / raw)
To: Chan-yeol Park; +Cc: linux-bluetooth
In-Reply-To: <CACUGKYOkxtCP_VgYtKWvSYHTb__m2rMCGujOAh6rKDXXYXLWZQ@mail.gmail.com>
Let me take it back. I used the kernel from ubuntu 12.04.
Regards,
john
On Wed, Aug 15, 2012 at 7:19 PM, John Tobias <john.tobias.ph@gmail.com> wrote:
>
> Hi Chanyeol,
>
> I used the kernel wl12xx-2012-07-18 from this release
> http://git.kernel.org/?p=linux/kernel/git/luca/wl12xx.git;a=summary
> May I know what kernel should I use?.
>
> Regards,
>
> John
>
>
> On Wed, Aug 15, 2012 at 6:16 PM, Chan-yeol Park
> <chanyeol.park@samsung.com> wrote:
>>
>> Hi John
>>
>>
>> On 08/16/2012 09:26 AM, John Tobias wrote:
>>>
>>> Hi All,
>>>
>>> I downloaded the latest Bluez 4.101, compiled and installed on my
>>> machine. After executing the command (/usr/sbin/bluetoothd -n -d), it
>>> returned "bluetoothd[15067]: mgmt setup failed: Invalid argument."
>>> I am just wondering what are the missing key on my build?.
>>
>> It looks like that your kernel doesn't support mgmt interface.
>> Which version of kernel do you use?
>>
>> Regards
>> chanyeol
>
>
^ permalink raw reply
* Re: [PATCH] add support bluetooth usb 0489:e046 Foxconn / Hon Hai
From: koko Aborigines @ 2012-08-16 3:12 UTC (permalink / raw)
To: Gustavo Padovan, aborigines, marcel, padovan, linux-bluetooth,
linux-kernel
In-Reply-To: <20120815044111.GG3344@joana>
[-- Attachment #1: Type: text/plain, Size: 2870 bytes --]
Hi, Gustavo
i have error with your patch
CC [M] drivers/bluetooth/btusb.o
drivers/bluetooth/btusb.c:113:2: error: implicit declaration of function
‘USB_VENDOR_AND_INTERFACE_INFO’ [-Werror=implicit-function-declaration]
drivers/bluetooth/btusb.c:113:2: error: initializer element is not constant
drivers/bluetooth/btusb.c:113:2: error: (near initialization for
‘btusb_table[22].match_flags’)
System : Debian Wheezy amd64
Thanks.
On Wed, Aug 15, 2012 at 11:41 AM, Gustavo Padovan <gustavo@padovan.org>wrote:
> * aborigines <7aborigines7@gmail.com> [2012-08-12 14:41:44 +0700]:
>
> > $ usb-deveices
> > T: Bus=01 Lev=02 Prnt=02 Port=02 Cnt=03 Dev#= 5 Spd=12 MxCh= 0
> > D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
> > P: Vendor=0489 ProdID=e046 Rev=01.12
> > S: Manufacturer=Broadcom Corp
> > S: Product=BCM20702A0
> > S: SerialNumber=C01885F67F9E
> > C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=0mA
> > I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
> > I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
> > I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
> > I: If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)
> >
> > $ lsusb
> > Bus 001 Device 005: ID 0489:e046 Foxconn / Hon Hai
> > ---
> > drivers/bluetooth/btusb.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> > index fc4bcd6..fb54c70 100644
> > --- a/drivers/bluetooth/btusb.c
> > +++ b/drivers/bluetooth/btusb.c
> > @@ -110,6 +110,7 @@ static struct usb_device_id btusb_table[] = {
> >
> > /* Foxconn - Hon Hai */
> > { USB_DEVICE(0x0489, 0xe033) },
> > + { USB_DEVICE(0x0489, 0xe046) },
> >
> > { } /* Terminating entry */
> > };
>
> Can you try the following patch and see if it works for you.
>
> Gustavo
>
> ---
> commit 8d2952f43af434f0aa5d109a9ae50c5886a9322c (HEAD, master)
> Author: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> Date: Wed Aug 15 01:38:11 2012 -0300
>
> Bluetooth: Add USB_VENDOR_AND_INTERFACE_INFO() for Broadcom/Foxconn
>
> Foxconn devices has a vendor specific class of device, we will match
> them
> differently now.
>
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index f637c25..f077f4d 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -101,7 +101,7 @@ static struct usb_device_id btusb_table[] = {
> { USB_DEVICE(0x413c, 0x8197) },
>
> /* Foxconn - Hon Hai */
> - { USB_DEVICE(0x0489, 0xe033) },
> + { USB_VENDOR_AND_INTERFACE_INFO(0x0489, 0xff, 0x01, 0x01) },
>
> { } /* Terminating entry */
> };
>
>
[-- Attachment #2: Type: text/html, Size: 3650 bytes --]
^ permalink raw reply
* Re: [PATCH] add support bluetooth usb 0489:e046 Foxconn / Hon Hai
From: Gustavo Padovan @ 2012-08-16 5:10 UTC (permalink / raw)
To: koko Aborigines; +Cc: marcel, padovan, linux-bluetooth, linux-kernel
In-Reply-To: <CA+iwHK1VYJ+G-9aVgkzvAV4C3Unhyz-sqC+_SkUmPhffs1_=CQ@mail.gmail.com>
Hi,
* koko Aborigines <7aborigines7@gmail.com> [2012-08-16 10:12:44 +0700]:
> Hi, Gustavo
>=20
> i have error with your patch
>=20
> CC [M] drivers/bluetooth/btusb.o
> drivers/bluetooth/btusb.c:113:2: error: implicit declaration of function
> =E2=80=98USB_VENDOR_AND_INTERFACE_INFO=E2=80=99 [-Werror=3Dimplicit-funct=
ion-declaration]
> drivers/bluetooth/btusb.c:113:2: error: initializer element is not consta=
nt
> drivers/bluetooth/btusb.c:113:2: error: (near initialization for
> =E2=80=98btusb_table[22].match_flags=E2=80=99)
You need to apply it against the bluetooth-next tree (or linux-next).
Gustavo
^ permalink raw reply
* Re: [PATCH v3 5/7] Bluetooth: Refactor SCO connection into its own function
From: Andrei Emeltchenko @ 2012-08-16 7:14 UTC (permalink / raw)
To: Vinicius Costa Gomes; +Cc: linux-bluetooth
In-Reply-To: <1343428380-32705-6-git-send-email-vinicius.gomes@openbossa.org>
Hi Vinicius,
On Fri, Jul 27, 2012 at 07:32:58PM -0300, Vinicius Costa Gomes wrote:
...
> -/* Create SCO, ACL or LE connection.
> - * Device _must_ be locked */
> -struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst,
> - __u8 dst_type, __u8 sec_level, __u8 auth_type)
> +static struct hci_conn *hci_connect_sco(struct hci_dev *hdev, bdaddr_t *dst,
> + u8 sec_level, u8 auth_type)
Here we use u8
...
> +/* Create SCO, ACL or LE connection. */
> +struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst,
> + __u8 dst_type, __u8 sec_level, __u8 auth_type
...
and here __u8
Shall we agree about those type usage, I thought that we use __u* in
headers and u* in c-files. At least in one file we shall use one type.
Best regards
Andrei Emeltchenko
^ permalink raw reply
* Re: [RFCv0 14/21] Bluetooth: Handle physical link completion
From: Andrei Emeltchenko @ 2012-08-16 7:23 UTC (permalink / raw)
To: Mat Martineau; +Cc: linux-bluetooth, gustavo, pkrystad
In-Reply-To: <alpine.DEB.2.02.1208150951470.30981@mathewm-linux>
Hi Mat,
On Wed, Aug 15, 2012 at 09:56:04AM -0700, Mat Martineau wrote:
...
> >
> >I feel that this function is too big. Maybe we could split channel move
> >and channel create operations?
>
> Sure, the "if (chan->state != BT_CONNECTED)" clause would be clearer
> in a channel create function, and the other clauses can go in a
> channel move function.
Maybe we could define new state BT_MOVING ?
Best regards
Andrei Emeltchenko
^ permalink raw reply
* Re: [PATCH BlueZ 1/2] mgmt: Fix Set LE command complete
From: Johan Hedberg @ 2012-08-16 7:36 UTC (permalink / raw)
To: Andre Guedes; +Cc: linux-bluetooth
In-Reply-To: <1345065240-9250-1-git-send-email-andre.guedes@openbossa.org>
Hi Andre,
On Wed, Aug 15, 2012, Andre Guedes wrote:
> Once we get a Set LE command complete event, we should update
> current_settings from the controller_info. Otherwise, features
> which depend on that, such as device discovery, will not work
> properly.
> ---
> src/mgmt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Both patches have been applied. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH BlueZ] deviceinfo: Remove redundant gattrib include
From: Johan Hedberg @ 2012-08-16 7:38 UTC (permalink / raw)
To: Claudio Takahasi; +Cc: linux-bluetooth
In-Reply-To: <1345040379-17704-1-git-send-email-claudio.takahasi@openbossa.org>
Hi Claudio,
On Wed, Aug 15, 2012, Claudio Takahasi wrote:
> ---
> profiles/deviceinfo/deviceinfo.c | 1 -
> 1 files changed, 0 insertions(+), 1 deletions(-)
Applied. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH BlueZ] lib: Rename GAP UUID
From: Johan Hedberg @ 2012-08-16 7:39 UTC (permalink / raw)
To: Claudio Takahasi; +Cc: linux-bluetooth
In-Reply-To: <1345040379-17704-2-git-send-email-claudio.takahasi@openbossa.org>
Hi Claudio,
On Wed, Aug 15, 2012, Claudio Takahasi wrote:
> Cosmetic patch changing the GAP UUID declaration to follow the same
> standard of the others GATT based services.
> ---
> lib/uuid.h | 2 +-
> src/device.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
Applied. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH BlueZ v0] gdbus: Fix compilation error if macro "error" is defined
From: Johan Hedberg @ 2012-08-16 7:49 UTC (permalink / raw)
To: Jaganath Kanakkassery; +Cc: linux-bluetooth
In-Reply-To: <1343816803-16228-1-git-send-email-jaganath.k@samsung.com>
Hi Jaganath,
On Wed, Aug 01, 2012, Jaganath Kanakkassery wrote:
> The variable "signature" used in error is not defined.
> ---
> v0 -> Made error message as per Lucas's suggestion
>
> gdbus/object.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gdbus/object.c b/gdbus/object.c
> index 900e7ab..9689006 100644
> --- a/gdbus/object.c
> +++ b/gdbus/object.c
> @@ -645,8 +645,8 @@ static dbus_bool_t emit_signal_valist(DBusConnection *conn,
> goto fail;
>
> if (g_dbus_args_have_signature(args, signal) == FALSE) {
> - error("%s.%s: expected signature'%s' but got '%s'",
> - interface, name, args, signature);
> + error("%s.%s: got unexpected signature '%s'", interface, name,
> + dbus_message_get_signature(signal));
> ret = FALSE;
> goto fail;
> }
What's the reason for dropping printing of the value of "args"? I'd
think that's quite useful in figuring out what went wrong. Even if there
is a reason to drop it it has nothing to do with fixing the compilation
error due to undefined "signature" and should therefore be in its own
patch.
Johan
^ permalink raw reply
* Re: [PATCH BlueZ v2 04/14] core: Add a list of LE devices to connect
From: Johan Hedberg @ 2012-08-16 9:20 UTC (permalink / raw)
To: João Paulo Rechi Vita; +Cc: linux-bluetooth
In-Reply-To: <1345042253-15053-5-git-send-email-jprvita@openbossa.org>
Hi João Paulo,
On Wed, Aug 15, 2012, João Paulo Rechi Vita wrote:
> + device_get_address(device, &bdaddr, NULL);
> + if (g_slist_find_custom(adapter->connect_list, &bdaddr,
> + (GCompareFunc) device_bdaddr_cmp)) {
> + DBG("trying to add device %s which is already in the connect "
> + "list, ignoring", device_get_path(device));
> + return;
> + }
Why don't you just use g_slist_find here? If this is the only place
where you need the new device_bdaddr_cmp then patch 03/14 can be
removed.
Johan
^ permalink raw reply
* Re: [PATCH BlueZ v2 04/14] core: Add a list of LE devices to connect
From: Johan Hedberg @ 2012-08-16 9:21 UTC (permalink / raw)
To: João Paulo Rechi Vita; +Cc: linux-bluetooth
In-Reply-To: <1345042253-15053-5-git-send-email-jprvita@openbossa.org>
Hi,
On Wed, Aug 15, 2012, João Paulo Rechi Vita wrote:
> +void adapter_connect_list_add(struct btd_adapter *adapter, struct btd_device *device);
> +void adapter_connect_list_remove(struct btd_adapter *adapter, struct btd_device *device);
These are breaking the "less than 80 chars" rule.
Johan
^ permalink raw reply
* [PATCH v4 0/10] Add GATT Client Battery Service
From: chen.ganir @ 2012-08-16 9:34 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Chen Ganir
From: Chen Ganir <chen.ganir@ti.com>
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 4 of this patch set, rebased on top of the latest sources and
fixes:
Remove namespace and descriptor battery properties
Documentation changes are now in one single patch
reorder some patches
Chen Ganir (10):
Battery: Add Battery Service Gatt Client
Battery: Add Battery Service plugin skeleton
Battery: Add connection logic
Battery: Discover Characteristic Descriptors
Battery: Get Battery ID
Battery: Add Battery list to btd_device
Battery: Read Battery level characteristic
Battery: Add Battery D-BUS API
Battery: Add support for notifications
Battery: Emit property changed on first read
Makefile.am | 10 +-
doc/battery-api.txt | 26 +++
doc/device-api.txt | 5 +
profiles/battery/battery.c | 529 ++++++++++++++++++++++++++++++++++++++++++++
profiles/battery/battery.h | 26 +++
profiles/battery/main.c | 67 ++++++
profiles/battery/manager.c | 71 ++++++
profiles/battery/manager.h | 24 ++
src/device.c | 65 ++++++
src/device.h | 3 +
10 files changed, 824 insertions(+), 2 deletions(-)
create mode 100644 doc/battery-api.txt
create mode 100644 profiles/battery/battery.c
create mode 100644 profiles/battery/battery.h
create mode 100644 profiles/battery/main.c
create mode 100644 profiles/battery/manager.c
create mode 100644 profiles/battery/manager.h
--
1.7.9.5
^ permalink raw reply
* [PATCH v4 01/10] Battery: Add Battery Service Gatt Client
From: chen.ganir @ 2012-08-16 9:34 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Chen Ganir
In-Reply-To: <1345109702-5698-1-git-send-email-chen.ganir@ti.com>
From: Chen Ganir <chen.ganir@ti.com>
Add documentation for new GATT Client Battery service plugin
---
doc/battery-api.txt | 26 ++++++++++++++++++++++++++
doc/device-api.txt | 5 +++++
2 files changed, 31 insertions(+)
create mode 100644 doc/battery-api.txt
diff --git a/doc/battery-api.txt b/doc/battery-api.txt
new file mode 100644
index 0000000..6e20a6a
--- /dev/null
+++ b/doc/battery-api.txt
@@ -0,0 +1,26 @@
+BlueZ D-Bus Battery API description
+****************************************
+
+ Texas Instruments, Inc. <chen.ganir@ti.com>
+
+Battery Service hierarchy
+=====================================
+
+Service org.bluez
+Interface org.bluez.Battery
+Object path [variable prefix]/{hci0,..}/dev_XX_XX_XX_XX_XX_XX/BATT-NN-DDDD
+
+
+Methods dict GetProperties()
+
+ Returns all properties for the interface. See the
+ Properties section for the available properties.
+
+Signals PropertyChanged(string name, variant value)
+
+ This signal indicates a changed value of the given
+ property.
+
+Properties byte Level [readonly]
+
+ Battery level (0-100).
diff --git a/doc/device-api.txt b/doc/device-api.txt
index 1f0dc96..5d760b1 100644
--- a/doc/device-api.txt
+++ b/doc/device-api.txt
@@ -179,3 +179,8 @@ Properties string Address [readonly]
Note that this property can exhibit false-positives
in the case of Bluetooth 2.1 (or newer) devices that
have disabled Extended Inquiry Response support.
+
+ array{string} Batteries [readonly]
+
+ List of device battery object paths that represents the available
+ batteries on the remote device.
--
1.7.9.5
^ permalink raw reply related
* [PATCH v4 02/10] Battery: Add Battery Service plugin skeleton
From: chen.ganir @ 2012-08-16 9:34 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Chen Ganir
In-Reply-To: <1345109702-5698-1-git-send-email-chen.ganir@ti.com>
From: Chen Ganir <chen.ganir@ti.com>
Add support for the Battery Service Gatt Client side.
---
Makefile.am | 10 ++++-
profiles/battery/battery.c | 88 ++++++++++++++++++++++++++++++++++++++++++++
profiles/battery/battery.h | 24 ++++++++++++
profiles/battery/main.c | 53 ++++++++++++++++++++++++++
profiles/battery/manager.c | 62 +++++++++++++++++++++++++++++++
profiles/battery/manager.h | 24 ++++++++++++
6 files changed, 259 insertions(+), 2 deletions(-)
create mode 100644 profiles/battery/battery.c
create mode 100644 profiles/battery/battery.h
create mode 100644 profiles/battery/main.c
create mode 100644 profiles/battery/manager.c
create mode 100644 profiles/battery/manager.h
diff --git a/Makefile.am b/Makefile.am
index a74709d..87e2c1c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -211,7 +211,8 @@ builtin_sources += profiles/health/hdp_main.c profiles/health/hdp_types.h \
endif
if GATTMODULES
-builtin_modules += thermometer alert time gatt_example proximity deviceinfo
+builtin_modules += thermometer alert time gatt_example proximity deviceinfo \
+ battery
builtin_sources += profiles/thermometer/main.c \
profiles/thermometer/manager.h \
profiles/thermometer/manager.c \
@@ -237,7 +238,12 @@ builtin_sources += profiles/thermometer/main.c \
profiles/deviceinfo/manager.h \
profiles/deviceinfo/manager.c \
profiles/deviceinfo/deviceinfo.h \
- profiles/deviceinfo/deviceinfo.c
+ profiles/deviceinfo/deviceinfo.c \
+ profiles/battery/main.c \
+ profiles/battery/manager.c \
+ profiles/battery/manager.h \
+ profiles/battery/battery.c \
+ profiles/battery/battery.h
endif
builtin_modules += formfactor
diff --git a/profiles/battery/battery.c b/profiles/battery/battery.c
new file mode 100644
index 0000000..7ed5707
--- /dev/null
+++ b/profiles/battery/battery.c
@@ -0,0 +1,88 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2012 Texas Instruments, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+#include <bluetooth/uuid.h>
+
+#include "adapter.h"
+#include "device.h"
+#include "att.h"
+#include "gattrib.h"
+#include "gatt.h"
+#include "battery.h"
+
+struct battery {
+ struct btd_device *dev; /* Device reference */
+};
+
+static GSList *servers;
+
+static gint cmp_device(gconstpointer a, gconstpointer b)
+{
+ const struct battery *batt = a;
+ const struct btd_device *dev = b;
+
+ if (dev == batt->dev)
+ return 0;
+
+ return -1;
+}
+
+static void battery_free(gpointer user_data)
+{
+ struct battery *batt = user_data;
+
+ btd_device_unref(batt->dev);
+ g_free(batt);
+}
+
+
+int battery_register(struct btd_device *device)
+{
+ struct battery *batt;
+
+ batt = g_new0(struct battery, 1);
+ batt->dev = btd_device_ref(device);
+
+ servers = g_slist_prepend(servers, batt);
+
+ return 0;
+}
+
+void battery_unregister(struct btd_device *device)
+{
+ struct battery *batt;
+ GSList *l;
+
+ l = g_slist_find_custom(servers, device, cmp_device);
+ if (l == NULL)
+ return;
+
+ batt = l->data;
+ servers = g_slist_remove(servers, batt);
+
+ battery_free(batt);
+}
diff --git a/profiles/battery/battery.h b/profiles/battery/battery.h
new file mode 100644
index 0000000..9933343
--- /dev/null
+++ b/profiles/battery/battery.h
@@ -0,0 +1,24 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2012 Texas Instruments, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+int battery_register(struct btd_device *device);
+void battery_unregister(struct btd_device *device);
diff --git a/profiles/battery/main.c b/profiles/battery/main.c
new file mode 100644
index 0000000..47f4249
--- /dev/null
+++ b/profiles/battery/main.c
@@ -0,0 +1,53 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2012 Texas Instruments, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdint.h>
+#include <glib.h>
+#include <errno.h>
+
+#include "hcid.h"
+#include "plugin.h"
+#include "manager.h"
+#include "log.h"
+
+static int battery_init(void)
+{
+ if (!main_opts.gatt_enabled) {
+ DBG("GATT is disabled");
+ return -ENOTSUP;
+ }
+
+ return battery_manager_init();
+}
+
+static void battery_exit(void)
+{
+ battery_manager_exit();
+}
+
+BLUETOOTH_PLUGIN_DEFINE(battery, VERSION,
+ BLUETOOTH_PLUGIN_PRIORITY_DEFAULT, battery_init,
+ battery_exit)
diff --git a/profiles/battery/manager.c b/profiles/battery/manager.c
new file mode 100644
index 0000000..84b85a3
--- /dev/null
+++ b/profiles/battery/manager.c
@@ -0,0 +1,62 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2012 Texas Instruments, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include <glib.h>
+#include <errno.h>
+#include <bluetooth/uuid.h>
+
+#include "adapter.h"
+#include "device.h"
+#include "att.h"
+#include "gattrib.h"
+#include "gatt.h"
+#include "battery.h"
+#include "manager.h"
+
+#define BATTERY_SERVICE_UUID "0000180f-0000-1000-8000-00805f9b34fb"
+
+static int battery_driver_probe(struct btd_device *device, GSList *uuids)
+{
+ return battery_register(device);
+}
+
+static void battery_driver_remove(struct btd_device *device)
+{
+ battery_unregister(device);
+}
+
+static struct btd_device_driver battery_device_driver = {
+ .name = "battery-driver",
+ .uuids = BTD_UUIDS(BATTERY_SERVICE_UUID),
+ .probe = battery_driver_probe,
+ .remove = battery_driver_remove
+};
+
+int battery_manager_init(void)
+{
+ return btd_register_device_driver(&battery_device_driver);
+}
+
+void battery_manager_exit(void)
+{
+ btd_unregister_device_driver(&battery_device_driver);
+}
diff --git a/profiles/battery/manager.h b/profiles/battery/manager.h
new file mode 100644
index 0000000..b2c849f
--- /dev/null
+++ b/profiles/battery/manager.h
@@ -0,0 +1,24 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2012 Texas Instruments, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+int battery_manager_init(void);
+void battery_manager_exit(void);
--
1.7.9.5
^ permalink raw reply related
* [PATCH v4 03/10] Battery: Add connection logic
From: chen.ganir @ 2012-08-16 9:34 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Chen Ganir
In-Reply-To: <1345109702-5698-1-git-send-email-chen.ganir@ti.com>
From: Chen Ganir <chen.ganir@ti.com>
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/battery/battery.c | 91 ++++++++++++++++++++++++++++++++++++++++++++
profiles/battery/battery.h | 2 +
profiles/battery/manager.c | 2 -
3 files changed, 93 insertions(+), 2 deletions(-)
diff --git a/profiles/battery/battery.c b/profiles/battery/battery.c
index 7ed5707..f9ef73d 100644
--- a/profiles/battery/battery.c
+++ b/profiles/battery/battery.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 "battery.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,99 @@ static void battery_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_battery_cb(GSList *characteristics, guint8 status,
+ gpointer user_data)
+{
+ struct battery *batt = user_data;
+ GSList *l;
+
+ if (status != 0) {
+ error("Discover Battery characteristics: %s",
+ att_ecode2str(status));
+ return;
+ }
+
+ 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_battery_cb, batt);
+ }
+}
+
+static void attio_disconnected_cb(gpointer user_data)
+{
+ struct battery *batt = user_data;
+
+ g_attrib_unref(batt->attrib);
+ batt->attrib = NULL;
+}
+
+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);
+}
int battery_register(struct btd_device *device)
{
struct battery *batt;
+ 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);
+ prim = l->data;
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/battery/battery.h b/profiles/battery/battery.h
index 9933343..801186d 100644
--- a/profiles/battery/battery.h
+++ b/profiles/battery/battery.h
@@ -20,5 +20,7 @@
*
*/
+#define BATTERY_SERVICE_UUID "0000180f-0000-1000-8000-00805f9b34fb"
+
int battery_register(struct btd_device *device);
void battery_unregister(struct btd_device *device);
diff --git a/profiles/battery/manager.c b/profiles/battery/manager.c
index 84b85a3..22b8b20 100644
--- a/profiles/battery/manager.c
+++ b/profiles/battery/manager.c
@@ -32,8 +32,6 @@
#include "battery.h"
#include "manager.h"
-#define BATTERY_SERVICE_UUID "0000180f-0000-1000-8000-00805f9b34fb"
-
static int battery_driver_probe(struct btd_device *device, GSList *uuids)
{
return battery_register(device);
--
1.7.9.5
^ permalink raw reply related
* [PATCH v4 04/10] Battery: Discover Characteristic Descriptors
From: chen.ganir @ 2012-08-16 9:34 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Chen Ganir
In-Reply-To: <1345109702-5698-1-git-send-email-chen.ganir@ti.com>
From: Chen Ganir <chen.ganir@ti.com>
Discover all characteristic descriptors, and build a descriptor
list
---
profiles/battery/battery.c | 62 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)
diff --git a/profiles/battery/battery.c b/profiles/battery/battery.c
index f9ef73d..f93fdbc 100644
--- a/profiles/battery/battery.c
+++ b/profiles/battery/battery.c
@@ -50,6 +50,13 @@ static GSList *servers;
struct characteristic {
struct gatt_char attr; /* Characteristic */
struct battery *batt; /* Parent Battery Service */
+ GSList *desc; /* Descriptors */
+};
+
+struct descriptor {
+ struct characteristic *ch; /* Parent Characteristic */
+ uint16_t handle; /* Descriptor Handle */
+ bt_uuid_t uuid; /* UUID */
};
static gint cmp_device(gconstpointer a, gconstpointer b)
@@ -80,7 +87,47 @@ static void battery_free(gpointer user_data)
g_free(batt);
}
+static void discover_desc_cb(guint8 status, const guint8 *pdu, guint16 len,
+ gpointer user_data)
+{
+ struct characteristic *ch = user_data;
+ struct att_data_list *list;
+ uint8_t format;
+ int i;
+
+ if (status != 0) {
+ error("Discover all characteristic descriptors failed [%s]: %s",
+ ch->attr.uuid, att_ecode2str(status));
+ return;
+ }
+
+ list = dec_find_info_resp(pdu, len, &format);
+ if (list == NULL)
+ return;
+
+ for (i = 0; i < list->num; i++) {
+ struct descriptor *desc;
+ uint8_t *value;
+
+ value = list->data[i];
+ desc = g_new0(struct descriptor, 1);
+ desc->handle = att_get_u16(value);
+ desc->ch = ch;
+
+ if (format == 0x01)
+ desc->uuid = att_get_uuid16(&value[2]);
+ else
+ desc->uuid = att_get_uuid128(&value[2]);
+
+ ch->desc = g_slist_append(ch->desc, desc);
+ }
+
+ att_data_list_free(list);
+}
+
+
static void configure_battery_cb(GSList *characteristics, guint8 status,
+
gpointer user_data)
{
struct battery *batt = user_data;
@@ -95,6 +142,7 @@ static void configure_battery_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;
@@ -104,6 +152,20 @@ static void configure_battery_cb(GSList *characteristics, guint8 status,
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;
+
+ gatt_find_info(batt->attrib, start, end, discover_desc_cb, ch);
}
}
--
1.7.9.5
^ permalink raw reply related
* [PATCH v4 05/10] Battery: Get Battery ID
From: chen.ganir @ 2012-08-16 9:34 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Chen Ganir
In-Reply-To: <1345109702-5698-1-git-send-email-chen.ganir@ti.com>
From: Chen Ganir <chen.ganir@ti.com>
Read the battery level format characteristic descriptor to get the
unique namespace and description values.
---
profiles/battery/battery.c | 112 +++++++++++++++++++++++++++++++++-----------
1 file changed, 85 insertions(+), 27 deletions(-)
diff --git a/profiles/battery/battery.c b/profiles/battery/battery.c
index f93fdbc..a33ac8c 100644
--- a/profiles/battery/battery.c
+++ b/profiles/battery/battery.c
@@ -37,6 +37,8 @@
#include "battery.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,17 @@ 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 */
};
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 +91,55 @@ static void battery_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 +173,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);
@@ -141,31 +195,35 @@ static void configure_battery_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
^ permalink raw reply related
* [PATCH v4 06/10] Battery: Add Battery list to btd_device
From: chen.ganir @ 2012-08-16 9:34 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Chen Ganir
In-Reply-To: <1345109702-5698-1-git-send-email-chen.ganir@ti.com>
From: Chen Ganir <chen.ganir@ti.com>
Add peer battery list to the btd_device. New property added to Device
called Batteries.
---
profiles/battery/battery.c | 14 ++++++++--
src/device.c | 65 ++++++++++++++++++++++++++++++++++++++++++++
src/device.h | 3 ++
3 files changed, 79 insertions(+), 3 deletions(-)
diff --git a/profiles/battery/battery.c b/profiles/battery/battery.c
index a33ac8c..3f79c1f 100644
--- a/profiles/battery/battery.c
+++ b/profiles/battery/battery.c
@@ -50,6 +50,7 @@ struct battery {
static GSList *servers;
struct characteristic {
+ char *path; /* object path */
struct gatt_char attr; /* Characteristic */
struct battery *batt; /* Parent Battery Service */
GSList *desc; /* Descriptors */
@@ -151,12 +152,12 @@ static void discover_desc_cb(guint8 status, const guint8 *pdu, guint16 len,
if (status != 0) {
error("Discover all characteristic descriptors failed [%s]: %s",
ch->attr.uuid, att_ecode2str(status));
- return;
+ goto update_char;
}
list = dec_find_info_resp(pdu, len, &format);
if (list == NULL)
- return;
+ goto update_char;
for (i = 0; i < list->num; i++) {
struct descriptor *desc;
@@ -177,6 +178,14 @@ static void discover_desc_cb(guint8 status, const guint8 *pdu, guint16 len,
}
att_data_list_free(list);
+
+update_char:
+ ch->path = g_strdup_printf("%s/BATT-%02X-%04X",
+ device_get_path(ch->batt->dev),
+ ch->ns,
+ ch->description);
+
+ device_add_battery(ch->batt->dev, ch->path);
}
@@ -206,7 +215,6 @@ static void configure_battery_cb(GSList *characteristics, guint8 status,
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;
diff --git a/src/device.c b/src/device.c
index f781298..c7c6c7d 100644
--- a/src/device.c
+++ b/src/device.c
@@ -124,6 +124,10 @@ struct att_callbacks {
gpointer user_data;
};
+struct btd_battery {
+ char *path;
+};
+
struct btd_device {
bdaddr_t bdaddr;
uint8_t bdaddr_type;
@@ -169,6 +173,7 @@ struct btd_device {
GIOChannel *att_io;
guint cleanup_id;
+ GSList *batteries;
};
static uint16_t uuid_list[] = {
@@ -259,6 +264,7 @@ static void device_free(gpointer user_data)
g_slist_free_full(device->primaries, g_free);
g_slist_free_full(device->attios, g_free);
g_slist_free_full(device->attios_offline, g_free);
+ g_slist_free_full(device->batteries, g_free);
attio_cleanup(device);
@@ -433,6 +439,15 @@ static DBusMessage *get_properties(DBusConnection *conn,
ptr = adapter_get_path(adapter);
dict_append_entry(&dict, "Adapter", DBUS_TYPE_OBJECT_PATH, &ptr);
+ /* Batteries */
+ str = g_new0(char *, g_slist_length(device->batteries) + 1);
+ for (i = 0, l = device->batteries; l; l = l->next, i++) {
+ struct btd_battery *b = l->data;
+ str[i] = b->path;
+ }
+ dict_append_array(&dict, "Batteries", DBUS_TYPE_OBJECT_PATH, &str, i);
+ g_free(str);
+
dbus_message_iter_close_container(&iter, &dict);
return reply;
@@ -1215,6 +1230,9 @@ void device_remove(struct btd_device *device, gboolean remove_stored)
g_slist_free(device->drivers);
device->drivers = NULL;
+ g_slist_free(device->batteries);
+ device->batteries = NULL;
+
attrib_client_unregister(device->services);
btd_device_unref(device);
@@ -3147,3 +3165,50 @@ void device_set_pnpid(struct btd_device *device, uint8_t vendor_id_src,
device_set_product(device, product_id);
device_set_version(device, product_ver);
}
+
+static void batteries_changed(struct btd_device *device)
+{
+ DBusConnection *conn = get_dbus_connection();
+ char **batteries;
+ GSList *l;
+ int i;
+
+ batteries = g_new0(char *, g_slist_length(device->batteries) + 1);
+ for (i = 0, l = device->batteries; l; l = l->next, i++) {
+ struct btd_battery *batt = l->data;
+ batteries[i] = batt->path;
+ }
+
+ emit_array_property_changed(conn, device->path, DEVICE_INTERFACE,
+ "Batteries", DBUS_TYPE_STRING, &batteries,
+ i);
+
+ g_free(batteries);
+}
+
+void device_add_battery(struct btd_device *device, char *path)
+{
+ struct btd_battery *batt;
+
+ batt = g_new0(struct btd_battery, 1);
+ batt->path = g_strdup(path);
+ device->batteries = g_slist_append(device->batteries, batt);
+ batteries_changed(device);
+}
+
+void device_remove_battery(struct btd_device *device, char *path)
+{
+ GSList *l;
+
+ for (l = device->batteries; l; l = l->next) {
+ struct btd_battery *b = l->data;
+
+ if (g_strcmp0(path, b->path) == 0) {
+ device->batteries = g_slist_remove(device->batteries, b);
+ g_free(b->path);
+ g_free(b);
+ batteries_changed(device);
+ return;
+ }
+ }
+}
diff --git a/src/device.h b/src/device.h
index 26e17f7..db71a8a 100644
--- a/src/device.h
+++ b/src/device.h
@@ -126,3 +126,6 @@ int device_unblock(DBusConnection *conn, struct btd_device *device,
void device_set_pnpid(struct btd_device *device, uint8_t vendor_id_src,
uint16_t vendor_id, uint16_t product_id,
uint16_t product_ver);
+
+void device_add_battery(struct btd_device *device, char *path);
+void device_remove_battery(struct btd_device *device, char *path);
--
1.7.9.5
^ permalink raw reply related
* [PATCH v4 07/10] Battery: Read Battery level characteristic
From: chen.ganir @ 2012-08-16 9:35 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Chen Ganir
In-Reply-To: <1345109702-5698-1-git-send-email-chen.ganir@ti.com>
From: Chen Ganir <chen.ganir@ti.com>
Add support for reading the battery level characteristic on
connection establishment.
---
profiles/battery/battery.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 42 insertions(+), 2 deletions(-)
diff --git a/profiles/battery/battery.c b/profiles/battery/battery.c
index 3f79c1f..6baf2db 100644
--- a/profiles/battery/battery.c
+++ b/profiles/battery/battery.c
@@ -56,6 +56,7 @@ struct characteristic {
GSList *desc; /* Descriptors */
uint8_t ns; /* Battery Namespace */
uint16_t description; /* Battery description */
+ uint8_t level;
};
struct descriptor {
@@ -92,6 +93,40 @@ static void battery_free(gpointer user_data)
g_free(batt);
}
+static void read_batterylevel_cb(guint8 status, const guint8 *pdu, guint16 len,
+ gpointer user_data)
+{
+ struct characteristic *ch = user_data;
+ uint8_t value[ATT_MAX_MTU];
+ int vlen;
+
+ if (status != 0) {
+ error("Failed to read Battery Level:%s", att_ecode2str(status));
+ return;
+ }
+
+ vlen = dec_read_resp(pdu, len, value, sizeof(value));
+ if (!vlen) {
+ error("Failed to read Battery Level: Protocol error\n");
+ return;
+ }
+
+ if (vlen < 1) {
+ error("Failed to read Battery Level: Wrong pdu len");
+ return;
+ }
+
+ ch->level = value[0];
+}
+
+static void process_batteryservice_char(struct characteristic *ch)
+{
+ if (g_strcmp0(ch->attr.uuid, BATTERY_LEVEL_UUID) == 0) {
+ gatt_read_char(ch->batt->attrib, ch->attr.value_handle, 0,
+ read_batterylevel_cb, ch);
+ }
+}
+
static void batterylevel_presentation_format_desc_cb(guint8 status,
const guint8 *pdu, guint16 len,
gpointer user_data)
@@ -140,7 +175,6 @@ static void process_batterylevel_desc(struct descriptor *desc)
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)
{
@@ -186,9 +220,9 @@ update_char:
ch->description);
device_add_battery(ch->batt->dev, ch->path);
+ process_batteryservice_char(ch);
}
-
static void configure_battery_cb(GSList *characteristics, guint8 status,
gpointer user_data)
@@ -245,6 +279,12 @@ static void attio_connected_cb(GAttrib *attrib, gpointer user_data)
gatt_discover_char(batt->attrib, batt->svc_range->start,
batt->svc_range->end, NULL,
configure_battery_cb, batt);
+ } else {
+ GSList *l;
+ for (l = batt->chars; l; l = l->next) {
+ struct characteristic *c = l->data;
+ process_batteryservice_char(c);
+ }
}
}
--
1.7.9.5
^ permalink raw reply related
* [PATCH v4 08/10] Battery: Add Battery D-BUS API
From: chen.ganir @ 2012-08-16 9:35 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Chen Ganir
In-Reply-To: <1345109702-5698-1-git-send-email-chen.ganir@ti.com>
From: Chen Ganir <chen.ganir@ti.com>
Add Battery level specific API
---
profiles/battery/battery.c | 84 ++++++++++++++++++++++++++++++++++++++++----
profiles/battery/battery.h | 2 +-
profiles/battery/main.c | 18 ++++++++--
profiles/battery/manager.c | 19 +++++++---
profiles/battery/manager.h | 2 +-
5 files changed, 111 insertions(+), 14 deletions(-)
diff --git a/profiles/battery/battery.c b/profiles/battery/battery.c
index 6baf2db..108813c 100644
--- a/profiles/battery/battery.c
+++ b/profiles/battery/battery.c
@@ -24,7 +24,9 @@
#include <config.h>
#endif
-#include <glib.h>
+#include <gdbus.h>
+#include <errno.h>
+#include <dbus/dbus.h>
#include <bluetooth/uuid.h>
#include "adapter.h"
@@ -34,12 +36,16 @@
#include "att.h"
#include "gattrib.h"
#include "gatt.h"
+#include "dbus-common.h"
#include "battery.h"
#include "log.h"
+#define BATTERY_INTERFACE "org.bluez.Battery"
+
#define BATTERY_LEVEL_UUID "00002a19-0000-1000-8000-00805f9b34fb"
struct battery {
+ DBusConnection *conn; /* The connection to the bus */
struct btd_device *dev; /* Device reference */
GAttrib *attrib; /* GATT connection */
guint attioid; /* Att watcher id */
@@ -65,6 +71,28 @@ struct descriptor {
bt_uuid_t uuid; /* UUID */
};
+static void char_free(gpointer user_data)
+{
+ struct characteristic *c = user_data;
+
+ g_slist_free_full(c->desc, g_free);
+
+ g_free(c);
+}
+
+static void char_interface_free(gpointer user_data)
+{
+ struct characteristic *c = user_data;
+ device_remove_battery(c->batt->dev, c->path);
+
+ g_dbus_unregister_interface(c->batt->conn,
+ c->path, BATTERY_INTERFACE);
+
+ g_free(c->path);
+
+ char_free(c);
+}
+
static gint cmp_device(gconstpointer a, gconstpointer b)
{
const struct battery *batt = a;
@@ -81,7 +109,7 @@ static void battery_free(gpointer user_data)
struct battery *batt = user_data;
if (batt->chars != NULL)
- g_slist_free_full(batt->chars, g_free);
+ g_slist_free_full(batt->chars, char_interface_free);
if (batt->attioid > 0)
btd_device_remove_attio_callback(batt->dev, batt->attioid);
@@ -89,7 +117,10 @@ static void battery_free(gpointer user_data)
if (batt->attrib != NULL)
g_attrib_unref(batt->attrib);
+
+ dbus_connection_unref(batt->conn);
btd_device_unref(batt->dev);
+ g_free(batt->svc_range);
g_free(batt);
}
@@ -175,6 +206,38 @@ static void process_batterylevel_desc(struct descriptor *desc)
DBG("Ignored descriptor %s characteristic %s", uuidstr, ch->attr.uuid);
}
+static DBusMessage *get_properties(DBusConnection *conn, DBusMessage *msg,
+ void *data)
+{
+ struct characteristic *c = data;
+ DBusMessageIter iter;
+ DBusMessageIter dict;
+ DBusMessage *reply;
+
+ reply = dbus_message_new_method_return(msg);
+ if (reply == NULL)
+ return NULL;
+
+ dbus_message_iter_init_append(reply, &iter);
+
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+ DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
+ DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
+ DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
+
+ dict_append_entry(&dict, "Level", DBUS_TYPE_BYTE, &c->level);
+
+ dbus_message_iter_close_container(&iter, &dict);
+
+ return reply;
+}
+
+static GDBusMethodTable battery_methods[] = {
+ { GDBUS_METHOD("GetProperties",
+ NULL, GDBUS_ARGS({ "properties", "a{sv}" }),
+ get_properties) },
+ { }
+};
static void discover_desc_cb(guint8 status, const guint8 *pdu, guint16 len,
gpointer user_data)
{
@@ -219,10 +282,17 @@ update_char:
ch->ns,
ch->description);
- device_add_battery(ch->batt->dev, ch->path);
+ if (!g_dbus_register_interface(ch->batt->conn, ch->path,
+ BATTERY_INTERFACE,
+ battery_methods, NULL, NULL,
+ ch, NULL)) {
+ error("D-Bus register interface %s failed",
+ BATTERY_INTERFACE);
+ } else {
+ device_add_battery(ch->batt->dev, ch->path);
process_batteryservice_char(ch);
+ }
}
-
static void configure_battery_cb(GSList *characteristics, guint8 status,
gpointer user_data)
@@ -249,6 +319,7 @@ static void configure_battery_cb(GSList *characteristics, guint8 status,
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;
@@ -304,7 +375,7 @@ static gint primary_uuid_cmp(gconstpointer a, gconstpointer b)
return g_strcmp0(prim->uuid, uuid);
}
-int battery_register(struct btd_device *device)
+int battery_register(DBusConnection *connection, struct btd_device *device)
{
struct battery *batt;
struct gatt_primary *prim;
@@ -318,7 +389,7 @@ int battery_register(struct btd_device *device)
batt = g_new0(struct battery, 1);
batt->dev = btd_device_ref(device);
-
+ batt->conn = dbus_connection_ref(connection);
batt->svc_range = g_new0(struct att_range, 1);
batt->svc_range->start = prim->range.start;
batt->svc_range->end = prim->range.end;
@@ -328,6 +399,7 @@ int battery_register(struct btd_device *device)
batt->attioid = btd_device_add_attio_callback(device,
attio_connected_cb, attio_disconnected_cb,
batt);
+
return 0;
}
diff --git a/profiles/battery/battery.h b/profiles/battery/battery.h
index 801186d..8231949 100644
--- a/profiles/battery/battery.h
+++ b/profiles/battery/battery.h
@@ -21,6 +21,6 @@
*/
#define BATTERY_SERVICE_UUID "0000180f-0000-1000-8000-00805f9b34fb"
+int battery_register(DBusConnection *conn, struct btd_device *device);
-int battery_register(struct btd_device *device);
void battery_unregister(struct btd_device *device);
diff --git a/profiles/battery/main.c b/profiles/battery/main.c
index 47f4249..49c7249 100644
--- a/profiles/battery/main.c
+++ b/profiles/battery/main.c
@@ -25,7 +25,7 @@
#endif
#include <stdint.h>
-#include <glib.h>
+#include <gdbus.h>
#include <errno.h>
#include "hcid.h"
@@ -33,6 +33,8 @@
#include "manager.h"
#include "log.h"
+static DBusConnection *connection;
+
static int battery_init(void)
{
if (!main_opts.gatt_enabled) {
@@ -40,12 +42,24 @@ static int battery_init(void)
return -ENOTSUP;
}
- return battery_manager_init();
+ connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+ if (connection == NULL)
+ return -EIO;
+
+ if (battery_manager_init(connection) < 0) {
+ dbus_connection_unref(connection);
+ return -EIO;
+ }
+
+ return 0;
}
static void battery_exit(void)
{
battery_manager_exit();
+
+ dbus_connection_unref(connection);
+ connection = NULL;
}
BLUETOOTH_PLUGIN_DEFINE(battery, VERSION,
diff --git a/profiles/battery/manager.c b/profiles/battery/manager.c
index 22b8b20..13bc806 100644
--- a/profiles/battery/manager.c
+++ b/profiles/battery/manager.c
@@ -20,7 +20,7 @@
*
*/
-#include <glib.h>
+#include <gdbus.h>
#include <errno.h>
#include <bluetooth/uuid.h>
@@ -32,9 +32,11 @@
#include "battery.h"
#include "manager.h"
+static DBusConnection *connection;
+
static int battery_driver_probe(struct btd_device *device, GSList *uuids)
{
- return battery_register(device);
+ return battery_register(connection, device);
}
static void battery_driver_remove(struct btd_device *device)
@@ -49,12 +51,21 @@ static struct btd_device_driver battery_device_driver = {
.remove = battery_driver_remove
};
-int battery_manager_init(void)
+int battery_manager_init(DBusConnection *conn)
{
- return btd_register_device_driver(&battery_device_driver);
+ int ret;
+
+ ret = btd_register_device_driver(&battery_device_driver);
+ if (!ret)
+ connection = dbus_connection_ref(conn);
+
+ return ret;
}
void battery_manager_exit(void)
{
btd_unregister_device_driver(&battery_device_driver);
+
+ dbus_connection_unref(connection);
+ connection = NULL;
}
diff --git a/profiles/battery/manager.h b/profiles/battery/manager.h
index b2c849f..60acb1d 100644
--- a/profiles/battery/manager.h
+++ b/profiles/battery/manager.h
@@ -20,5 +20,5 @@
*
*/
-int battery_manager_init(void);
+int battery_manager_init(DBusConnection *conn);
void battery_manager_exit(void);
--
1.7.9.5
^ permalink raw reply related
* [PATCH v4 09/10] Battery: Add support for notifications
From: chen.ganir @ 2012-08-16 9:35 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Chen Ganir
In-Reply-To: <1345109702-5698-1-git-send-email-chen.ganir@ti.com>
From: Chen Ganir <chen.ganir@ti.com>
Add support for emitting PropertyChanged when a battery level
characteristic notification is sent from the peer device.
---
profiles/battery/battery.c | 112 +++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 110 insertions(+), 2 deletions(-)
diff --git a/profiles/battery/battery.c b/profiles/battery/battery.c
index 108813c..3d3fb6b 100644
--- a/profiles/battery/battery.c
+++ b/profiles/battery/battery.c
@@ -50,6 +50,7 @@ struct battery {
GAttrib *attrib; /* GATT connection */
guint attioid; /* Att watcher id */
struct att_range *svc_range; /* Battery range */
+ guint attnotid; /* Att notifications id */
GSList *chars; /* Characteristics */
};
@@ -63,6 +64,7 @@ struct characteristic {
uint8_t ns; /* Battery Namespace */
uint16_t description; /* Battery description */
uint8_t level;
+ gboolean canNotify;
};
struct descriptor {
@@ -104,6 +106,14 @@ static gint cmp_device(gconstpointer a, gconstpointer b)
return -1;
}
+static gint cmp_char_val_handle(gconstpointer a, gconstpointer b)
+{
+ const struct characteristic *ch = a;
+ const uint16_t *handle = b;
+
+ return ch->attr.value_handle - *handle;
+}
+
static void battery_free(gpointer user_data)
{
struct battery *batt = user_data;
@@ -117,6 +127,10 @@ static void battery_free(gpointer user_data)
if (batt->attrib != NULL)
g_attrib_unref(batt->attrib);
+ if (batt->attrib != NULL) {
+ g_attrib_unregister(batt->attrib, batt->attnotid);
+ g_attrib_unref(batt->attrib);
+ }
dbus_connection_unref(batt->conn);
btd_device_unref(batt->dev);
@@ -158,6 +172,18 @@ static void process_batteryservice_char(struct characteristic *ch)
}
}
+static void batterylevel_enable_notify_cb(guint8 status, const guint8 *pdu,
+ guint16 len, gpointer user_data)
+{
+ struct characteristic *ch = (struct characteristic *)user_data;
+
+ if (status != 0) {
+ error("Could not enable batt level notification.");
+ ch->canNotify = FALSE;
+ process_batteryservice_char(ch);
+ }
+}
+
static void batterylevel_presentation_format_desc_cb(guint8 status,
const guint8 *pdu, guint16 len,
gpointer user_data)
@@ -194,6 +220,21 @@ static void process_batterylevel_desc(struct descriptor *desc)
char uuidstr[MAX_LEN_UUID_STR];
bt_uuid_t btuuid;
+ bt_uuid16_create(&btuuid, GATT_CLIENT_CHARAC_CFG_UUID);
+
+ if (bt_uuid_cmp(&desc->uuid, &btuuid) == 0 && g_strcmp0(ch->attr.uuid,
+ BATTERY_LEVEL_UUID) == 0) {
+ uint8_t atval[2];
+ uint16_t val;
+
+ val = GATT_CLIENT_CHARAC_CFG_NOTIF_BIT;
+
+ att_put_u16(val, atval);
+ gatt_write_char(ch->batt->attrib, desc->handle, atval, 2,
+ batterylevel_enable_notify_cb, ch);
+ return;
+ }
+
bt_uuid16_create(&btuuid, GATT_CHARAC_FMT_UUID);
if (bt_uuid_cmp(&desc->uuid, &btuuid) == 0) {
@@ -238,6 +279,13 @@ static GDBusMethodTable battery_methods[] = {
get_properties) },
{ }
};
+static GDBusSignalTable battery_signals[] = {
+ { GDBUS_SIGNAL("PropertyChanged",
+ GDBUS_ARGS({ "name", "s" }, { "value", "v" })) },
+ { }
+};
+
+
static void discover_desc_cb(guint8 status, const guint8 *pdu, guint16 len,
gpointer user_data)
{
@@ -284,7 +332,7 @@ update_char:
if (!g_dbus_register_interface(ch->batt->conn, ch->path,
BATTERY_INTERFACE,
- battery_methods, NULL, NULL,
+ battery_methods, battery_signals, NULL,
ch, NULL)) {
error("D-Bus register interface %s failed",
BATTERY_INTERFACE);
@@ -293,6 +341,12 @@ update_char:
process_batteryservice_char(ch);
}
}
+static void emit_battery_level_changed(struct characteristic *c)
+{
+ emit_property_changed(c->batt->conn, c->path, BATTERY_INTERFACE,
+ "Level", DBUS_TYPE_BYTE, &c->level);
+}
+
static void configure_battery_cb(GSList *characteristics, guint8 status,
gpointer user_data)
@@ -340,12 +394,63 @@ static void configure_battery_cb(GSList *characteristics, guint8 status,
}
}
+static void proc_batterylevel(struct characteristic *c, const uint8_t *pdu,
+ uint16_t len, gboolean final)
+{
+ uint8_t new_batt_level = 0;
+ gboolean changed = FALSE;
+
+ if (!pdu) {
+ error("Battery level notification: Invalid pdu length");
+ goto done;
+ }
+
+ new_batt_level = pdu[1];
+
+ if (new_batt_level != c->level)
+ changed = TRUE;
+
+ c->level = new_batt_level;
+
+done:
+ if (changed)
+ emit_battery_level_changed(c);
+}
+
+static void notif_handler(const uint8_t *pdu, uint16_t len, gpointer user_data)
+{
+ struct battery *batt = user_data;
+ struct characteristic *ch;
+ uint16_t handle;
+ GSList *l;
+
+ if (len < 3) {
+ error("notif_handler: Bad pdu received");
+ return;
+ }
+
+ handle = att_get_u16(&pdu[1]);
+ l = g_slist_find_custom(batt->chars, &handle, cmp_char_val_handle);
+ if (l == NULL) {
+ error("notif_handler: Unexpected handle 0x%04x", handle);
+ return;
+ }
+
+ ch = l->data;
+ if (g_strcmp0(ch->attr.uuid, BATTERY_LEVEL_UUID) == 0) {
+ proc_batterylevel(ch, pdu, len, FALSE);
+ }
+}
+
static void attio_connected_cb(GAttrib *attrib, gpointer user_data)
{
struct battery *batt = user_data;
batt->attrib = g_attrib_ref(attrib);
+ batt->attnotid = g_attrib_register(batt->attrib, ATT_OP_HANDLE_NOTIFY,
+ notif_handler, batt, NULL);
+
if (batt->chars == NULL) {
gatt_discover_char(batt->attrib, batt->svc_range->start,
batt->svc_range->end, NULL,
@@ -354,7 +459,8 @@ static void attio_connected_cb(GAttrib *attrib, gpointer user_data)
GSList *l;
for (l = batt->chars; l; l = l->next) {
struct characteristic *c = l->data;
- process_batteryservice_char(c);
+ if (!c->canNotify)
+ process_batteryservice_char(c);
}
}
}
@@ -363,6 +469,8 @@ static void attio_disconnected_cb(gpointer user_data)
{
struct battery *batt = user_data;
+ g_attrib_unregister(batt->attrib, batt->attnotid);
+ batt->attnotid = 0;
g_attrib_unref(batt->attrib);
batt->attrib = NULL;
}
--
1.7.9.5
^ permalink raw reply related
* [PATCH v4 10/10] Battery: Emit property changed on first read
From: chen.ganir @ 2012-08-16 9:37 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Chen Ganir
From: Chen Ganir <chen.ganir@ti.com>
Emit battery level property changed upon connection, on first read.
---
profiles/battery/battery.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/profiles/battery/battery.c b/profiles/battery/battery.c
index 3d3fb6b..e60811a 100644
--- a/profiles/battery/battery.c
+++ b/profiles/battery/battery.c
@@ -138,6 +138,12 @@ static void battery_free(gpointer user_data)
g_free(batt);
}
+static void emit_battery_level_changed(struct characteristic *c)
+{
+ emit_property_changed(c->batt->conn, c->path, BATTERY_INTERFACE,
+ "Level", DBUS_TYPE_BYTE, &c->level);
+}
+
static void read_batterylevel_cb(guint8 status, const guint8 *pdu, guint16 len,
gpointer user_data)
{
@@ -162,6 +168,7 @@ static void read_batterylevel_cb(guint8 status, const guint8 *pdu, guint16 len,
}
ch->level = value[0];
+ emit_battery_level_changed(ch);
}
static void process_batteryservice_char(struct characteristic *ch)
@@ -341,11 +348,6 @@ update_char:
process_batteryservice_char(ch);
}
}
-static void emit_battery_level_changed(struct characteristic *c)
-{
- emit_property_changed(c->batt->conn, c->path, BATTERY_INTERFACE,
- "Level", DBUS_TYPE_BYTE, &c->level);
-}
static void configure_battery_cb(GSList *characteristics, guint8 status,
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH obexd 0/9] GObexApparam API
From: Johan Hedberg @ 2012-08-16 9:43 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1344508353-24647-1-git-send-email-luiz.dentz@gmail.com>
Hi Luiz,
On Thu, Aug 09, 2012, Luiz Augusto von Dentz wrote:
> GObexApparam can encode/decode OBEX application parameter in a generic
> way, only the tags are expecific to each profile.
>
> Some remarks:
>
> - Tag data is stored in network order/big endian because its type is
> not known.
> - Internally it uses a GHashTable to store the values which doesn't
> guarantee the order of the tag will be exact the same as inserted.
>
> Luiz Augusto von Dentz (9):
> gobex: Introduce GObexApparam API
> gobex: Add unit tests for GObexApparam API
> gobex: Integrate GObexApparam with GObexHeader
> gobex: Add unit test for encoding/decoding apparam headers
> gobex: Add debug option to apparam
> client: Port PBAP module to use GObexApparam
> PBAP: Make use of GObexApparam API
> MAP: Make use of GObexApparam API
> core: Remove map_ap.c
>
> Makefile.am | 18 +-
> client/pbap.c | 181 +++++-------------
> gobex/gobex-apparam.c | 355 +++++++++++++++++++++++++++++++++++
> gobex/gobex-apparam.h | 59 ++++++
> gobex/gobex-debug.h | 7 +-
> gobex/gobex-header.c | 25 +++
> gobex/gobex-header.h | 3 +
> gobex/gobex.c | 11 +-
> plugins/mas.c | 81 ++++----
> plugins/pbap.c | 180 ++++--------------
> plugins/phonebook.h | 2 +-
> src/map_ap.c | 466 ----------------------------------------------
> src/map_ap.h | 63 -------
> unit/test-gobex-apparam.c | 422 +++++++++++++++++++++++++++++++++++++++++
> unit/test-gobex-header.c | 46 +++++
> 15 files changed, 1058 insertions(+), 861 deletions(-)
> create mode 100644 gobex/gobex-apparam.c
> create mode 100644 gobex/gobex-apparam.h
> delete mode 100644 src/map_ap.c
> create mode 100644 unit/test-gobex-apparam.c
All patches in this set have been applied. Thanks.
Johan
^ permalink raw reply
* Re: Bluez 4.101
From: Anderson Lizardo @ 2012-08-16 10:57 UTC (permalink / raw)
To: John Tobias; +Cc: Chan-yeol Park, linux-bluetooth
In-Reply-To: <CACUGKYOUh6G9zkifB98akXd_R8Axv6eh03-OCYnJyLNkkBTq3w@mail.gmail.com>
Hi John,
On Wed, Aug 15, 2012 at 10:54 PM, John Tobias <john.tobias.ph@gmail.com> wrote:
> Let me take it back. I used the kernel from ubuntu 12.04.
You need at least 3.4.0 to use latest BlueZ (although the latest
kernel version is always recommended for development). Ubuntu 12.04
has 3.2.0.
Best Regards,
--
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil
^ 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