* Re: [PATCH 4/6] Bluetooth: trivial: Remove empty line
From: Gustavo Padovan @ 2012-09-08 20:34 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1346933147-11789-4-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
* Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com> [2012-09-06 15:05:44 +0300]:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> net/bluetooth/hci_core.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index 8dbbc01..f305e44 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -268,7 +268,6 @@ static void hci_init_req(struct hci_dev *hdev, unsigned long opt)
> BT_ERR("Unknown device type %d", hdev->dev_type);
> break;
> }
> -
> }
>
> static void hci_le_init_req(struct hci_dev *hdev, unsigned long opt)
Patch has been applied to bluetooth-next. Thanks.
Gustavo
^ permalink raw reply
* Re: [PATCH 1/6] Bluetooth: Fix deadlock when closing socket
From: Gustavo Padovan @ 2012-09-08 21:05 UTC (permalink / raw)
To: Mat Martineau; +Cc: Andrei Emeltchenko, Marcel Holtmann, linux-bluetooth
In-Reply-To: <alpine.DEB.2.02.1209070949580.3761@mathewm-linux>
* Mat Martineau <mathewm@codeaurora.org> [2012-09-07 10:00:40 -0700]:
>
> Andrei -
>
> On Fri, 7 Sep 2012, Andrei Emeltchenko wrote:
>
> >Hi Marcel,
> >
> >On Thu, Sep 06, 2012 at 01:10:51PM -0700, Marcel Holtmann wrote:
> >>Hi Mat,
> >>
> >>>>If we have unacked frames when closing bluetooth socket we deadlock
> >>>>since conn->chan_lock, chan->lock and socket lock are taken. Remove
> >>>>__l2cap_wait_ack completely.
> >>>>
> >>>>Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> >>>
> >>>I don't think you want to remove this code completely, at least not
> >>>without giving some thought to the problem it is solving.
> >>>
> >>>The problem is that programs may have an open socket which they send
> >>>some data on, then immediately close. There is no feedback when data
> >>>is actually sent over the air, so the socket may end up getting torn
> >>>down while there is still data in the HCI tx buffer or some data was
> >>>lost and needs to be retransmitted. Waiting for an acknowledgement
> >>>confirms that the application's sent data made it to the remote
> >>>device.
> >>>
> >>>Without this code, it's difficult to use l2test on a number of
> >>>qualification tests. Profiles or applications using ERTM may depend
> >>>on the "wait for ack before closing" behavior in order to have a clean
> >>>disconnect.
> >>
> >>isn't that what we have SO_LINGER for?
> >
> >Looking at the code I suspect that SO_LINGER is not working. Maybe we need
> >to merge linger code and wait_ack stuff.
>
> It does look like a bug that the "wait_ack" behavior happens even
> without SO_LINGER.
>
> In order to do SO_LINGER right, it would be better to check
> chan->tx_q instead of chan->unacked_frames to makes sure all data is
> sent and acked. chan->unacked_frames only tells you how many sent
> frames are unacked and does not take in to account queued data that
> hasn't been sent yet.
Not sure if we need SO_LINGER here, in TCP shutdown() per default waits for
the remote side to close the connection, we basically doing something similar
here. IMHO we just fixes this to avoid deadlock and stay with this code.
Gustavo
^ permalink raw reply
* Re: [PATCH 5/6] Bluetooth: debug: Print refcnt for hci_dev
From: Gustavo Padovan @ 2012-09-08 21:13 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1346933147-11789-5-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
* Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com> [2012-09-06 15:05:45 +0300]:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> include/net/bluetooth/hci_core.h | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> index 4704ca4..6a3337e 100644
> --- a/include/net/bluetooth/hci_core.h
> +++ b/include/net/bluetooth/hci_core.h
> @@ -603,11 +603,17 @@ static inline void hci_conn_put(struct hci_conn *conn)
> /* ----- HCI Devices ----- */
> static inline void hci_dev_put(struct hci_dev *d)
> {
> + BT_DBG("%s orig refcnt %d", d->name,
> + atomic_read(&d->dev.kobj.kref.refcount));
> +
> put_device(&d->dev);
> }
>
> static inline struct hci_dev *hci_dev_hold(struct hci_dev *d)
> {
> + BT_DBG("%s orig refcnt %d", d->name,
> + atomic_read(&d->dev.kobj.kref.refcount));
> +
> get_device(&d->dev);
> return d;
> }
Patch has been applied to bluetooth-next. Thanks.
Gustavo
^ permalink raw reply
* Re: [PATCH 6/6] Bluetooth: AMP: Add Read Data Block Size to amp_init
From: Gustavo Padovan @ 2012-09-08 21:14 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1346933147-11789-6-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
* Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com> [2012-09-06 15:05:46 +0300]:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> Add Read Data Block Size HCI cmd to AMP initialization, then it
> makes possible to send data.
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> net/bluetooth/hci_core.c | 3 +++
> 1 file changed, 3 insertions(+)
Patch has been applied to bluetooth-next. Thanks.
Gustavo
^ permalink raw reply
* Re: [PATCH 2/10] drivers/bluetooth/bluecard_cs.c: removes unnecessary semicolon
From: Gustavo Padovan @ 2012-09-08 21:34 UTC (permalink / raw)
To: Peter Senna Tschudin
Cc: Marcel Holtmann, kernel-janitors, Julia.Lawall, Johan Hedberg,
linux-bluetooth, linux-kernel
In-Reply-To: <1347031488-26598-2-git-send-email-peter.senna@gmail.com>
Hi Peter,
* Peter Senna Tschudin <peter.senna@gmail.com> [2012-09-07 17:24:40 +0200]:
> From: Peter Senna Tschudin <peter.senna@gmail.com>
>
> removes unnecessary semicolon
>
> Found by Coccinelle: http://coccinelle.lip6.fr/
>
> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
>
> ---
> drivers/bluetooth/bluecard_cs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
patch has been applied to the bluetooth-next tree. Thanks.
Gustavo
^ permalink raw reply
* Re: [PATCH 3/10] drivers/bluetooth/hci_ldisc.c: removes unnecessary semicolon
From: Gustavo Padovan @ 2012-09-08 21:34 UTC (permalink / raw)
To: Peter Senna Tschudin
Cc: Marcel Holtmann, kernel-janitors, Julia.Lawall, Johan Hedberg,
linux-bluetooth, linux-kernel
In-Reply-To: <1347031488-26598-1-git-send-email-peter.senna@gmail.com>
Hi Peter,
* Peter Senna Tschudin <peter.senna@gmail.com> [2012-09-07 17:24:39 +0200]:
> From: Peter Senna Tschudin <peter.senna@gmail.com>
>
> removes unnecessary semicolon
>
> Found by Coccinelle: http://coccinelle.lip6.fr/
>
> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Patch has been applied to the bluetooth-next tree. Thanks.
Gustavo
^ permalink raw reply
* Re: [PATCH 4/10] drivers/bluetooth/hci_ll.c: removes unnecessary semicolon
From: Gustavo Padovan @ 2012-09-08 21:35 UTC (permalink / raw)
To: Peter Senna Tschudin
Cc: Marcel Holtmann, kernel-janitors, Julia.Lawall, Johan Hedberg,
linux-bluetooth, linux-kernel
In-Reply-To: <1347031488-26598-4-git-send-email-peter.senna@gmail.com>
Hi Peter,
* Peter Senna Tschudin <peter.senna@gmail.com> [2012-09-07 17:24:42 +0200]:
> From: Peter Senna Tschudin <peter.senna@gmail.com>
>
> removes unnecessary semicolon
>
> Found by Coccinelle: http://coccinelle.lip6.fr/
>
> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
>
> ---
> drivers/bluetooth/hci_ll.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, thanks.
Gustavo
^ permalink raw reply
* Re: [PATCH 5/10] drivers/bluetooth/hci_vhci.c: removes unnecessary semicolon
From: Gustavo Padovan @ 2012-09-08 21:36 UTC (permalink / raw)
To: Peter Senna Tschudin
Cc: Marcel Holtmann, kernel-janitors, Julia.Lawall, Johan Hedberg,
linux-bluetooth, linux-kernel
In-Reply-To: <1347031488-26598-9-git-send-email-peter.senna@gmail.com>
Hi Peter,
* Peter Senna Tschudin <peter.senna@gmail.com> [2012-09-07 17:24:47 +0200]:
> From: Peter Senna Tschudin <peter.senna@gmail.com>
>
> removes unnecessary semicolon
>
> Found by Coccinelle: http://coccinelle.lip6.fr/
>
> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
>
> ---
> drivers/bluetooth/hci_vhci.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, thanks.
Gustavo
^ permalink raw reply
* Re: [PATCH 10/10] drivers/bluetooth/btuart_cs.c: removes unnecessary semicolon
From: Gustavo Padovan @ 2012-09-08 21:37 UTC (permalink / raw)
To: Peter Senna Tschudin
Cc: Marcel Holtmann, kernel-janitors, Julia.Lawall, Johan Hedberg,
linux-bluetooth, linux-kernel
In-Reply-To: <1347031488-26598-10-git-send-email-peter.senna@gmail.com>
Hi Peter,
* Peter Senna Tschudin <peter.senna@gmail.com> [2012-09-07 17:24:48 +0200]:
> From: Peter Senna Tschudin <peter.senna@gmail.com>
>
> removes unnecessary semicolon
>
> Found by Coccinelle: http://coccinelle.lip6.fr/
>
> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
>
> ---
> drivers/bluetooth/btuart_cs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, Thanks.
ustavo
^ permalink raw reply
* pull request: bluetooth 2012-09-08
From: Gustavo Padovan @ 2012-09-08 21:59 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, linux-bluetooth, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1671 bytes --]
Hi John,
A few more fixes to 3.6, here we have four important fix to the MGMT interface,
two from Johan Hedberg and Andrzej Kaczmarek. Andrei fixed a free on
uninitialized memory and I added support for Broadcom/Foxconn devices.
Please pull, or let me know of any problems. Thanks.
Gustavo
The following changes since commit f10723841e624c0726c70356b31d91befed01dd6:
libertas sdio: fix suspend when interface is down (2012-09-05 14:53:36 -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 b6f04c364ef853d8baa8949be20ef708000bcb97:
Bluetooth: Fix freeing uninitialized delayed works (2012-09-08 17:27:52 -0300)
----------------------------------------------------------------
Andrei Emeltchenko (1):
Bluetooth: Fix freeing uninitialized delayed works
Andrzej Kaczmarek (2):
Bluetooth: mgmt: Fix enabling SSP while powered off
Bluetooth: mgmt: Fix enabling LE while powered off
Gustavo Padovan (1):
Bluetooth: Add USB_VENDOR_AND_INTERFACE_INFO() for Broadcom/Foxconn
Johan Hedberg (2):
Bluetooth: mgmt: Implement support for passkey notification
Bluetooth: Update management interface revision
drivers/bluetooth/btusb.c | 2 +-
include/net/bluetooth/hci.h | 18 ++++++++++++
include/net/bluetooth/hci_core.h | 5 ++++
include/net/bluetooth/mgmt.h | 7 +++++
net/bluetooth/hci_event.c | 67 ++++++++++++++++++++++++++++++++++++++++++
net/bluetooth/l2cap_core.c | 2 +-
net/bluetooth/mgmt.c | 35 +++++++++++++++++++++-
7 files changed, 133 insertions(+), 3 deletions(-)
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: Setting up an A2DP server
From: Maxim Levitsky @ 2012-09-09 1:38 UTC (permalink / raw)
To: Niklas Claesson; +Cc: Lucas De Marchi, linux-bluetooth
In-Reply-To: <CAAHv3KF8Vnz+iT0_OviJqUYUrNH=2ygMNH-GAxhc5H=H89euTw@mail.gmail.com>
On Tue, 2012-08-21 at 17:13 +0200, Niklas Claesson wrote:
> 2012/8/20 Lucas De Marchi <lucas.demarchi@profusion.mobi>:
> > On Fri, Aug 17, 2012 at 6:50 PM, Niklas Claesson
> > <nicke.claesson@gmail.com> wrote:
> >> I've actually solved the issue myself by writing an Agent that accepts
> >
> > You could mark the device as trusted, so you don't have to do this.
>
> I don't know which devices will connect, perhaps I could mark all
> nearby devices as trusted. But I don't know how I would do that.
>
> >
> >
> >> all incoming requests, and another python script that polls 'pacmd
> >> list-sources' every 2 seconds for new bluetooth sources. And third and
> >
> > Why do you need this?
>
> I have to set the bluetooth device as current source in Pulseaudio
I am also affected by this exact issue.
I also want to make my system be a 'A2DP' headset.
I managed to do so, but only when I initiate the connection from the
system, and using awkward dbus command.
When however I try to connect to it from my tablet nothing happens.
Any pointers will be welcome.
Best regards,
Maxim Levitsky
^ permalink raw reply
* Re: [PATCH RFC] battery: Add generic device battery interface
From: Chen Ganir @ 2012-09-09 5:59 UTC (permalink / raw)
To: Claudio Takahasi; +Cc: linux-bluetooth
In-Reply-To: <CAKT1EBdo=yJX+DZmnFJoMydE4D_sD-CzOpYFwdKTXwKmcHQgAw@mail.gmail.com>
Claudio,
On 09/06/2012 10:34 PM, Claudio Takahasi wrote:
> Hi Chen Ganir:
>
> On Thu, Aug 30, 2012 at 8:26 AM, <chen.ganir@ti.com> wrote:
>> From: Chen Ganir <chen.ganir@ti.com>
>>
>> Add the D-Bus API documentation for the new generic device battery
>> interface. This API provides generic access to peer devcice
>> batteries.
>> ---
>> doc/battery-api.txt | 34 ++++++++++++++++++++++++++++++++++
>> doc/device-api.txt | 5 +++++
>> 2 files changed, 39 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..da82024
>> --- /dev/null
>> +++ b/doc/battery-api.txt
>> @@ -0,0 +1,34 @@
>> +BlueZ D-Bus Battery API description
>> +****************************************
>> +
>> + Texas Instruments, Inc. <chen.ganir@ti.com>
>> +
>> +Device Battery hierarchy
>> +=====================================
>> +
>> +Service org.bluez
>> +Interface org.bluez.Battery
>> +Object path [variable prefix]/{hci0,..}/dev_XX_XX_XX_XX_XX_XX/BATTYYYY
>> +YYYY is numeric value between 0 and 9999.
>> +
>> +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 uint16 Level [readonly]
>> +
>> + Battery level (0-100).
>> +
>> + uint16 Description [readonly]
>> +
>> + Battery description.
>> +
>> + uint16 Namespace [readonly]
>> +
>> + Battery Namespace.
>
> IMO "Description" and "Namespace" should be string:
> http://developer.bluetooth.org/gatt/Pages/GattNamespaceDescriptors.aspx
>
> For BLE Presentation Format is mandatory(Namespace and Description).
> For AVRCP, probably it doesn't make sense. I recommend to include
> additional description for these fields.
>
After discussing this issue with Johan, we decided to remove the
Namespace and Description properties from the generic battery. Do you
think we should have those properties or can we exclude them ? Do you
see any use case for those properties?
>> diff --git a/doc/device-api.txt b/doc/device-api.txt
>> index 1f0dc96..c98d539 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{object} Batteries [readonly]
>> +
>> + List of device battery object paths that represents the available
>> + batteries on the remote 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
>
> Are you planning to implement the Battery Service on BlueZ? (using UPower)
> It seems to be straightforward.
>
The plan is to add a generic Battery implemented into the BlueZ stack,
but no UPower integration is planned at the moment - maybe later.
> Regards,
> Claudio
>
BR,
Chen Ganir
^ permalink raw reply
* [PATCH obexd 1/7 v4] client: Add filters to Phonebook.PullAll
From: Luiz Augusto von Dentz @ 2012-09-10 8:02 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This avoid D-Bus round trips and is more aligned with what has been
proposed for MessageAccess interface.
---
v3: Fix patch 2/7
v4: Fix not having an empty line before parse_filter in patch 1/7
client/pbap.c | 256 +++++++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 210 insertions(+), 46 deletions(-)
diff --git a/client/pbap.c b/client/pbap.c
index ebd6320..b41412c 100644
--- a/client/pbap.c
+++ b/client/pbap.c
@@ -351,18 +351,191 @@ send:
pending_request_free(request);
}
+static GObexApparam *parse_format(GObexApparam *apparam, DBusMessageIter *iter)
+{
+ const char *string;
+ guint8 format;
+
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING)
+ return NULL;
+
+ dbus_message_iter_get_basic(iter, &string);
+
+ if (!string || g_str_equal(string, ""))
+ format = FORMAT_VCARD21;
+ else if (!g_ascii_strcasecmp(string, "vcard21"))
+ format = FORMAT_VCARD21;
+ else if (!g_ascii_strcasecmp(string, "vcard30"))
+ format = FORMAT_VCARD30;
+ else
+ return NULL;
+
+ return g_obex_apparam_set_uint8(apparam, FORMAT_TAG, format);
+}
+
+static GObexApparam *parse_order(GObexApparam *apparam, DBusMessageIter *iter)
+{
+ const char *string;
+ guint8 order;
+
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING)
+ return NULL;
+
+ dbus_message_iter_get_basic(iter, &string);
+
+ if (!string || g_str_equal(string, ""))
+ order = ORDER_INDEXED;
+ else if (!g_ascii_strcasecmp(string, "indexed"))
+ order = ORDER_INDEXED;
+ else if (!g_ascii_strcasecmp(string, "alphanumeric"))
+ order = ORDER_ALPHANUMERIC;
+ else if (!g_ascii_strcasecmp(string, "phonetic"))
+ order = ORDER_PHONETIC;
+ else
+ return NULL;
+
+ return g_obex_apparam_set_uint8(apparam, ORDER_TAG, order);
+}
+
+static GObexApparam *parse_offset(GObexApparam *apparam, DBusMessageIter *iter)
+{
+ guint16 num;
+
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_UINT16)
+ return NULL;
+
+ dbus_message_iter_get_basic(iter, &num);
+
+ return g_obex_apparam_set_uint16(apparam, LISTSTARTOFFSET_TAG, num);
+}
+
+static GObexApparam *parse_max_count(GObexApparam *apparam,
+ DBusMessageIter *iter)
+{
+ guint16 num;
+
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_UINT16)
+ return NULL;
+
+ dbus_message_iter_get_basic(iter, &num);
+
+ return g_obex_apparam_set_uint16(apparam, MAXLISTCOUNT_TAG, num);
+}
+
+static uint64_t get_filter_mask(const char *filterstr)
+{
+ int i, bit = -1;
+
+ if (!filterstr)
+ return 0;
+
+ if (!g_ascii_strcasecmp(filterstr, "ALL"))
+ return FILTER_ALL;
+
+ for (i = 0; filter_list[i] != NULL; i++)
+ if (!g_ascii_strcasecmp(filterstr, filter_list[i]))
+ return 1ULL << i;
+
+ if (strlen(filterstr) < 4 || strlen(filterstr) > 5
+ || g_ascii_strncasecmp(filterstr, "bit", 3) != 0)
+ return 0;
+
+ sscanf(&filterstr[3], "%d", &bit);
+ if (bit >= 0 && bit <= FILTER_BIT_MAX)
+ return 1ULL << bit;
+ else
+ return 0;
+}
+
+static int set_field(guint64 *filter, const char *filterstr)
+{
+ guint64 mask;
+
+ mask = get_filter_mask(filterstr);
+
+ if (mask == 0)
+ return -EINVAL;
+
+ *filter |= mask;
+ return 0;
+}
+
+static GObexApparam *parse_fields(GObexApparam *apparam, DBusMessageIter *iter)
+{
+ DBusMessageIter array;
+ guint64 filter = 0;
+
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY)
+ return NULL;
+
+ dbus_message_iter_recurse(iter, &array);
+
+ while (dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_STRING) {
+ const char *string;
+
+ dbus_message_iter_get_basic(&array, &string);
+
+ if (set_field(&filter, string) < 0)
+ return NULL;
+
+ dbus_message_iter_next(&array);
+ }
+
+ return g_obex_apparam_set_uint64(apparam, FILTER_TAG, filter);
+}
+
+static GObexApparam *parse_filters(GObexApparam *apparam,
+ DBusMessageIter *iter)
+{
+ DBusMessageIter array;
+
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY)
+ return NULL;
+
+ dbus_message_iter_recurse(iter, &array);
+
+ while (dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_DICT_ENTRY) {
+ const char *key;
+ DBusMessageIter value, entry;
+
+ dbus_message_iter_recurse(&array, &entry);
+ dbus_message_iter_get_basic(&entry, &key);
+
+ dbus_message_iter_next(&entry);
+ dbus_message_iter_recurse(&entry, &value);
+
+ if (strcasecmp(key, "Format") == 0) {
+ if (parse_format(apparam, &value) == NULL)
+ return NULL;
+ } else if (strcasecmp(key, "Order") == 0) {
+ if (parse_order(apparam, &value) == NULL)
+ return NULL;
+ } else if (strcasecmp(key, "Offset") == 0) {
+ if (parse_offset(apparam, &value) == NULL)
+ return NULL;
+ } else if (strcasecmp(key, "MaxCount") == 0) {
+ if (parse_max_count(apparam, &value) == NULL)
+ return NULL;
+ } else if (strcasecmp(key, "Fields") == 0) {
+ if (parse_fields(apparam, &value) == NULL)
+ return NULL;
+ }
+
+ dbus_message_iter_next(&array);
+ }
+
+ return apparam;
+}
+
static struct obc_transfer *pull_phonebook(struct pbap_data *pbap,
DBusMessage *message,
guint8 type, const char *name,
const char *targetfile,
- uint64_t filter, guint8 format,
- guint16 maxlistcount,
- guint16 liststartoffset,
+ GObexApparam *apparam,
GError **err)
{
struct pending_request *request;
struct obc_transfer *transfer;
- GObexApparam *apparam;
guint8 buf[32];
gsize len;
session_callback_t func;
@@ -371,13 +544,6 @@ static struct obc_transfer *pull_phonebook(struct pbap_data *pbap,
if (transfer == NULL)
return NULL;
- apparam = g_obex_apparam_set_uint64(NULL, FILTER_TAG, filter);
- apparam = g_obex_apparam_set_uint8(apparam, FORMAT_TAG, format);
- apparam = g_obex_apparam_set_uint16(apparam, MAXLISTCOUNT_TAG,
- maxlistcount);
- apparam = g_obex_apparam_set_uint16(apparam, LISTSTARTOFFSET_TAG,
- liststartoffset);
-
switch (type) {
case PULLPHONEBOOK:
func = NULL;
@@ -396,8 +562,6 @@ static struct obc_transfer *pull_phonebook(struct pbap_data *pbap,
obc_transfer_set_params(transfer, buf, len);
- g_obex_apparam_free(apparam);
-
if (!obc_session_queue(pbap->session, transfer, func, request, err)) {
if (request != NULL)
pending_request_free(request);
@@ -490,31 +654,6 @@ static int set_order(struct pbap_data *pbap, const char *orderstr)
return 0;
}
-static uint64_t get_filter_mask(const char *filterstr)
-{
- int i, bit = -1;
-
- if (!filterstr)
- return 0;
-
- if (!g_ascii_strcasecmp(filterstr, "ALL"))
- return FILTER_ALL;
-
- for (i = 0; filter_list[i] != NULL; i++)
- if (!g_ascii_strcasecmp(filterstr, filter_list[i]))
- return 1ULL << i;
-
- if (strlen(filterstr) < 4 || strlen(filterstr) > 5
- || g_ascii_strncasecmp(filterstr, "bit", 3) != 0)
- return 0;
-
- sscanf(&filterstr[3], "%d", &bit);
- if (bit >= 0 && bit <= FILTER_BIT_MAX)
- return 1ULL << bit;
- else
- return 0;
-}
-
static int add_filter(struct pbap_data *pbap, const char *filterstr)
{
uint64_t mask;
@@ -618,25 +757,41 @@ static DBusMessage *pbap_pull_all(DBusConnection *connection,
struct obc_transfer *transfer;
const char *targetfile;
char *name;
+ GObexApparam *apparam;
GError *err = NULL;
+ DBusMessageIter args;
if (!pbap->path)
return g_dbus_create_error(message,
ERROR_INTERFACE ".Forbidden",
"Call Select first of all");
- if (dbus_message_get_args(message, NULL,
- DBUS_TYPE_STRING, &targetfile,
- DBUS_TYPE_INVALID) == FALSE)
+ dbus_message_iter_init(message, &args);
+
+ if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING)
return g_dbus_create_error(message,
ERROR_INTERFACE ".InvalidArguments", NULL);
+ dbus_message_iter_get_basic(&args, &targetfile);
+ dbus_message_iter_next(&args);
+
+ apparam = g_obex_apparam_set_uint16(NULL, MAXLISTCOUNT_TAG,
+ DEFAULT_COUNT);
+ apparam = g_obex_apparam_set_uint16(apparam, LISTSTARTOFFSET_TAG,
+ DEFAULT_OFFSET);
+
+ if (parse_filters(apparam, &args) == NULL) {
+ g_obex_apparam_free(apparam);
+ return g_dbus_create_error(message,
+ ERROR_INTERFACE ".InvalidArguments", NULL);
+ }
+
name = g_strconcat(pbap->path, ".vcf", NULL);
transfer = pull_phonebook(pbap, message, PULLPHONEBOOK, name,
- targetfile, pbap->filter, pbap->format,
- DEFAULT_COUNT, DEFAULT_OFFSET, &err);
+ targetfile, apparam, &err);
g_free(name);
+ g_obex_apparam_free(apparam);
if (transfer == NULL) {
DBusMessage *reply = g_dbus_create_error(message,
@@ -754,20 +909,28 @@ static DBusMessage *pbap_get_size(DBusConnection *connection,
DBusMessage *reply;
struct obc_transfer *transfer;
char *name;
+ GObexApparam *apparam;
GError *err = NULL;
+ DBusMessageIter args;
if (!pbap->path)
return g_dbus_create_error(message,
ERROR_INTERFACE ".Forbidden",
"Call Select first of all");
+ dbus_message_iter_init(message, &args);
+
name = g_strconcat(pbap->path, ".vcf", NULL);
+ apparam = g_obex_apparam_set_uint16(NULL, MAXLISTCOUNT_TAG, 0);
+ apparam = g_obex_apparam_set_uint16(apparam, LISTSTARTOFFSET_TAG,
+ DEFAULT_OFFSET);
+
transfer = pull_phonebook(pbap, message, GETPHONEBOOKSIZE, name, NULL,
- pbap->filter, pbap->format, 0,
- DEFAULT_OFFSET, &err);
+ apparam, &err);
g_free(name);
+ g_obex_apparam_free(apparam);
if (transfer != NULL)
return NULL;
@@ -891,7 +1054,8 @@ static const GDBusMethodTable pbap_methods[] = {
GDBUS_ARGS({ "location", "s" }, { "phonebook", "s" }),
NULL, pbap_select) },
{ GDBUS_METHOD("PullAll",
- GDBUS_ARGS({ "targetfile", "s" }),
+ GDBUS_ARGS({ "targetfile", "s" },
+ { "filters", "a{sv}" }),
GDBUS_ARGS({ "transfer", "o" },
{ "properties", "a{sv}" }),
pbap_pull_all) },
--
1.7.11.4
^ permalink raw reply related
* [PATCH obexd 2/7 v4] client: Add filters to PhonebookAccess.Pull
From: Luiz Augusto von Dentz @ 2012-09-10 8:02 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1347264179-31477-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This avoid D-Bus round trips and is more aligned with what has been
proposed for MessageAccess interface.
---
client/pbap.c | 78 +++++++++++++++++++++++++++++++++++++++--------------------
1 file changed, 52 insertions(+), 26 deletions(-)
diff --git a/client/pbap.c b/client/pbap.c
index b41412c..3f182df 100644
--- a/client/pbap.c
+++ b/client/pbap.c
@@ -804,43 +804,25 @@ static DBusMessage *pbap_pull_all(DBusConnection *connection,
return obc_transfer_create_dbus_reply(transfer, message);
}
-static DBusMessage *pbap_pull_vcard(DBusConnection *connection,
- DBusMessage *message, void *user_data)
+static DBusMessage *pull_vcard(struct pbap_data *pbap, DBusMessage *message,
+ const char *name, const char *targetfile,
+ GObexApparam *apparam)
{
- struct pbap_data *pbap = user_data;
struct obc_transfer *transfer;
- GObexApparam *apparam;
- guint8 buf[32];
- gsize len;
- const char *name, *targetfile;
DBusMessage *reply;
GError *err = NULL;
+ guint8 buf[32];
+ gsize len;
- if (!pbap->path)
- return g_dbus_create_error(message,
- ERROR_INTERFACE ".Forbidden",
- "Call Select first of all");
-
- if (dbus_message_get_args(message, NULL,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &targetfile,
- DBUS_TYPE_INVALID) == FALSE)
- return g_dbus_create_error(message,
- ERROR_INTERFACE ".InvalidArguments", NULL);
+ len = g_obex_apparam_encode(apparam, buf, sizeof(buf));
+ g_obex_apparam_free(apparam);
transfer = obc_transfer_get("x-bt/vcard", name, targetfile, &err);
if (transfer == NULL)
goto fail;
- apparam = g_obex_apparam_set_uint64(NULL, FILTER_TAG, pbap->filter);
- apparam = g_obex_apparam_set_uint8(apparam, FORMAT_TAG, pbap->format);
-
- len = g_obex_apparam_encode(apparam, buf, sizeof(buf));
-
obc_transfer_set_params(transfer, buf, len);
- g_obex_apparam_free(apparam);
-
if (!obc_session_queue(pbap->session, transfer, NULL, NULL, &err))
goto fail;
@@ -853,6 +835,49 @@ fail:
return reply;
}
+static DBusMessage *pbap_pull_vcard(DBusConnection *connection,
+ DBusMessage *message, void *user_data)
+{
+ struct pbap_data *pbap = user_data;
+ GObexApparam *apparam;
+ const char *name, *targetfile;
+ DBusMessageIter args;
+
+ if (!pbap->path)
+ return g_dbus_create_error(message,
+ ERROR_INTERFACE ".Forbidden",
+ "Call Select first of all");
+
+ dbus_message_iter_init(message, &args);
+
+ if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING)
+ return g_dbus_create_error(message,
+ ERROR_INTERFACE ".InvalidArguments", NULL);
+
+ dbus_message_iter_get_basic(&args, &name);
+ dbus_message_iter_next(&args);
+
+ if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING)
+ return g_dbus_create_error(message,
+ ERROR_INTERFACE ".InvalidArguments", NULL);
+
+ dbus_message_iter_get_basic(&args, &targetfile);
+ dbus_message_iter_next(&args);
+
+ apparam = g_obex_apparam_set_uint16(NULL, MAXLISTCOUNT_TAG,
+ DEFAULT_COUNT);
+ apparam = g_obex_apparam_set_uint16(apparam, LISTSTARTOFFSET_TAG,
+ DEFAULT_OFFSET);
+
+ if (parse_filters(apparam, &args) == NULL) {
+ g_obex_apparam_free(apparam);
+ return g_dbus_create_error(message,
+ ERROR_INTERFACE ".InvalidArguments", NULL);
+ }
+
+ return pull_vcard(pbap, message, name, targetfile, apparam);
+}
+
static DBusMessage *pbap_list(DBusConnection *connection,
DBusMessage *message, void *user_data)
{
@@ -1060,7 +1085,8 @@ static const GDBusMethodTable pbap_methods[] = {
{ "properties", "a{sv}" }),
pbap_pull_all) },
{ GDBUS_METHOD("Pull",
- GDBUS_ARGS({ "vcard", "s" }, { "targetfile", "s" }),
+ GDBUS_ARGS({ "vcard", "s" }, { "targetfile", "s" },
+ { "filters", "a{sv}" }),
GDBUS_ARGS({ "transfer", "o" },
{ "properties", "a{sv}" }),
pbap_pull_vcard) },
--
1.7.11.4
^ permalink raw reply related
* [PATCH obexd 3/7 v4] client: Add filters to PhonebookAccess.List and PhonebookAccess.Search
From: Luiz Augusto von Dentz @ 2012-09-10 8:02 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1347264179-31477-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This avoid D-Bus round trips and is more aligned with what has been
proposed for MessageAccess interface.
---
client/pbap.c | 115 ++++++++++++++++++++++++++++++++++++++--------------------
1 file changed, 76 insertions(+), 39 deletions(-)
diff --git a/client/pbap.c b/client/pbap.c
index 3f182df..2f1dd5f 100644
--- a/client/pbap.c
+++ b/client/pbap.c
@@ -575,35 +575,24 @@ static struct obc_transfer *pull_phonebook(struct pbap_data *pbap,
static DBusMessage *pull_vcard_listing(struct pbap_data *pbap,
DBusMessage *message, const char *name,
- guint8 order, char *searchval, guint8 attrib,
- guint16 count, guint16 offset)
+ GObexApparam *apparam)
{
struct pending_request *request;
struct obc_transfer *transfer;
guint8 buf[272];
gsize len;
GError *err = NULL;
- GObexApparam *apparam;
DBusMessage *reply;
+ len = g_obex_apparam_encode(apparam, buf, sizeof(buf));
+ g_obex_apparam_free(apparam);
+
transfer = obc_transfer_get("x-bt/vcard-listing", name, NULL, &err);
if (transfer == NULL)
goto fail;
- apparam = g_obex_apparam_set_uint8(NULL, ORDER_TAG, order);
- apparam = g_obex_apparam_set_uint8(apparam, SEARCHATTRIB_TAG, attrib);
- apparam = g_obex_apparam_set_string(apparam, SEARCHVALUE_TAG,
- searchval);
- apparam = g_obex_apparam_set_uint16(apparam, MAXLISTCOUNT_TAG, count);
- apparam = g_obex_apparam_set_uint16(apparam, LISTSTARTOFFSET_TAG,
- offset);
-
- len = g_obex_apparam_encode(apparam, buf, sizeof(buf));
-
obc_transfer_set_params(transfer, buf, len);
- g_obex_apparam_free(apparam);
-
request = pending_request_new(pbap, message);
if (obc_session_queue(pbap->session, transfer,
pull_vcard_listing_callback, request, &err))
@@ -882,34 +871,33 @@ static DBusMessage *pbap_list(DBusConnection *connection,
DBusMessage *message, void *user_data)
{
struct pbap_data *pbap = user_data;
+ GObexApparam *apparam;
+ DBusMessageIter args;
if (!pbap->path)
return g_dbus_create_error(message,
ERROR_INTERFACE ".Forbidden",
"Call Select first of all");
- return pull_vcard_listing(pbap, message, "", pbap->order, "",
- ATTRIB_NAME, DEFAULT_COUNT, DEFAULT_OFFSET);
-}
+ dbus_message_iter_init(message, &args);
-static DBusMessage *pbap_search(DBusConnection *connection,
- DBusMessage *message, void *user_data)
-{
- struct pbap_data *pbap = user_data;
- char *field, *value;
- guint8 attrib;
+ apparam = g_obex_apparam_set_uint16(NULL, MAXLISTCOUNT_TAG,
+ DEFAULT_COUNT);
+ apparam = g_obex_apparam_set_uint16(apparam, LISTSTARTOFFSET_TAG,
+ DEFAULT_OFFSET);
- if (dbus_message_get_args(message, NULL,
- DBUS_TYPE_STRING, &field,
- DBUS_TYPE_STRING, &value,
- DBUS_TYPE_INVALID) == FALSE)
+ if (parse_filters(apparam, &args) == NULL) {
+ g_obex_apparam_free(apparam);
return g_dbus_create_error(message,
ERROR_INTERFACE ".InvalidArguments", NULL);
+ }
- if (!pbap->path)
- return g_dbus_create_error(message,
- ERROR_INTERFACE ".Forbidden",
- "Call Select first of all");
+ return pull_vcard_listing(pbap, message, "", apparam);
+}
+
+static GObexApparam *parse_attribute(GObexApparam *apparam, const char *field)
+{
+ guint8 attrib;
if (!field || g_str_equal(field, ""))
attrib = ATTRIB_NAME;
@@ -920,11 +908,58 @@ static DBusMessage *pbap_search(DBusConnection *connection,
else if (!g_ascii_strcasecmp(field, "sound"))
attrib = ATTRIB_SOUND;
else
+ return NULL;
+
+ return g_obex_apparam_set_uint8(apparam, SEARCHATTRIB_TAG, attrib);
+}
+
+static DBusMessage *pbap_search(DBusConnection *connection,
+ DBusMessage *message, void *user_data)
+{
+ struct pbap_data *pbap = user_data;
+ char *field, *value;
+ GObexApparam *apparam;
+ DBusMessageIter args;
+
+ if (!pbap->path)
+ return g_dbus_create_error(message,
+ ERROR_INTERFACE ".Forbidden",
+ "Call Select first of all");
+
+ dbus_message_iter_init(message, &args);
+
+ if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING)
+ return g_dbus_create_error(message,
+ ERROR_INTERFACE ".InvalidArguments", NULL);
+
+ dbus_message_iter_get_basic(&args, &field);
+ dbus_message_iter_next(&args);
+
+ apparam = parse_attribute(NULL, field);
+ if (apparam == NULL)
+ return g_dbus_create_error(message,
+ ERROR_INTERFACE ".InvalidArguments", NULL);
+
+ if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING)
+ return g_dbus_create_error(message,
+ ERROR_INTERFACE ".InvalidArguments", NULL);
+
+ dbus_message_iter_get_basic(&args, &value);
+ dbus_message_iter_next(&args);
+
+ apparam = g_obex_apparam_set_uint16(apparam, MAXLISTCOUNT_TAG,
+ DEFAULT_COUNT);
+ apparam = g_obex_apparam_set_uint16(apparam, LISTSTARTOFFSET_TAG,
+ DEFAULT_OFFSET);
+ apparam = g_obex_apparam_set_string(apparam, SEARCHVALUE_TAG, value);
+
+ if (parse_filters(apparam, &args) == NULL) {
+ g_obex_apparam_free(apparam);
return g_dbus_create_error(message,
ERROR_INTERFACE ".InvalidArguments", NULL);
+ }
- return pull_vcard_listing(pbap, message, "", pbap->order, value,
- attrib, DEFAULT_COUNT, DEFAULT_OFFSET);
+ return pull_vcard_listing(pbap, message, "", apparam);
}
static DBusMessage *pbap_get_size(DBusConnection *connection,
@@ -1091,12 +1126,14 @@ static const GDBusMethodTable pbap_methods[] = {
{ "properties", "a{sv}" }),
pbap_pull_vcard) },
{ GDBUS_ASYNC_METHOD("List",
- NULL, GDBUS_ARGS({ "vcard_listing", "a(ss)" }),
- pbap_list) },
+ GDBUS_ARGS({ "filters", "a{sv}" }),
+ GDBUS_ARGS({ "vcard_listing", "a(ss)" }),
+ pbap_list) },
{ GDBUS_ASYNC_METHOD("Search",
- GDBUS_ARGS({ "field", "s" }, { "value", "s" }),
- GDBUS_ARGS({ "vcard_listing", "a(ss)" }),
- pbap_search) },
+ GDBUS_ARGS({ "field", "s" }, { "value", "s" },
+ { "filters", "a{sv}" }),
+ GDBUS_ARGS({ "vcard_listing", "a(ss)" }),
+ pbap_search) },
{ GDBUS_ASYNC_METHOD("GetSize",
NULL, GDBUS_ARGS({ "size", "q" }),
pbap_get_size) },
--
1.7.11.4
^ permalink raw reply related
* [PATCH obexd 4/7 v4] client: Remove deprecated methods from PhonebookAccess
From: Luiz Augusto von Dentz @ 2012-09-10 8:02 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1347264179-31477-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
SetFormat, SetOrder, SetFilter and GetFilter methods are no longer
necessary as other methods now take them as parameters to avoid round
trips.
---
client/pbap.c | 197 +++++-----------------------------------------------------
1 file changed, 14 insertions(+), 183 deletions(-)
diff --git a/client/pbap.c b/client/pbap.c
index 2f1dd5f..c0ccbdc 100644
--- a/client/pbap.c
+++ b/client/pbap.c
@@ -116,9 +116,6 @@ static const char *filter_list[] = {
struct pbap_data {
struct obc_session *session;
char *path;
- guint8 format;
- guint8 order;
- uint64_t filter;
};
struct pending_request {
@@ -607,91 +604,6 @@ fail:
return reply;
}
-static int set_format(struct pbap_data *pbap, const char *formatstr)
-{
- if (!formatstr || g_str_equal(formatstr, "")) {
- pbap->format = FORMAT_VCARD21;
- return 0;
- }
-
- if (!g_ascii_strcasecmp(formatstr, "vcard21"))
- pbap->format = FORMAT_VCARD21;
- else if (!g_ascii_strcasecmp(formatstr, "vcard30"))
- pbap->format = FORMAT_VCARD30;
- else
- return -EINVAL;
-
- return 0;
-}
-
-static int set_order(struct pbap_data *pbap, const char *orderstr)
-{
- if (!orderstr || g_str_equal(orderstr, "")) {
- pbap->order = ORDER_INDEXED;
- return 0;
- }
-
- if (!g_ascii_strcasecmp(orderstr, "indexed"))
- pbap->order = ORDER_INDEXED;
- else if (!g_ascii_strcasecmp(orderstr, "alphanumeric"))
- pbap->order = ORDER_ALPHANUMERIC;
- else if (!g_ascii_strcasecmp(orderstr, "phonetic"))
- pbap->order = ORDER_PHONETIC;
- else
- return -EINVAL;
-
- return 0;
-}
-
-static int add_filter(struct pbap_data *pbap, const char *filterstr)
-{
- uint64_t mask;
-
- mask = get_filter_mask(filterstr);
-
- if (mask == 0)
- return -EINVAL;
-
- pbap->filter |= mask;
- return 0;
-}
-
-static int remove_filter(struct pbap_data *pbap, const char *filterstr)
-{
- uint64_t mask;
-
- mask = get_filter_mask(filterstr);
-
- if (mask == 0)
- return -EINVAL;
-
- pbap->filter &= ~mask;
- return 0;
-}
-
-static gchar **get_filter_strs(uint64_t filter, gint *size)
-{
- gchar **list, **item;
- gint i;
- gint filter_list_size = sizeof(filter_list) / sizeof(filter_list[0]) - 1;
-
- list = g_malloc0(sizeof(gchar **) * (FILTER_BIT_MAX + 2));
-
- item = list;
-
- for (i = 0; i < filter_list_size; i++)
- if (filter & (1ULL << i))
- *(item++) = g_strdup(filter_list[i]);
-
- for (i = filter_list_size; i <= FILTER_BIT_MAX; i++)
- if (filter & (1ULL << i))
- *(item++) = g_strdup_printf("%s%d", "BIT", i);
-
- *item = NULL;
- *size = item - list;
- return list;
-}
-
static DBusMessage *pbap_select(DBusConnection *connection,
DBusMessage *message, void *user_data)
{
@@ -1001,95 +913,26 @@ static DBusMessage *pbap_get_size(DBusConnection *connection,
return reply;
}
-static DBusMessage *pbap_set_format(DBusConnection *connection,
- DBusMessage *message, void *user_data)
-{
- struct pbap_data *pbap = user_data;
- const char *format;
-
- if (dbus_message_get_args(message, NULL,
- DBUS_TYPE_STRING, &format,
- DBUS_TYPE_INVALID) == FALSE)
- return g_dbus_create_error(message,
- ERROR_INTERFACE ".InvalidArguments", NULL);
-
- if (set_format(pbap, format) < 0)
- return g_dbus_create_error(message,
- ERROR_INTERFACE ".InvalidArguments",
- "InvalidFormat");
-
- return dbus_message_new_method_return(message);
-}
-
-static DBusMessage *pbap_set_order(DBusConnection *connection,
- DBusMessage *message, void *user_data)
-{
- struct pbap_data *pbap = user_data;
- const char *order;
-
- if (dbus_message_get_args(message, NULL,
- DBUS_TYPE_STRING, &order,
- DBUS_TYPE_INVALID) == FALSE)
- return g_dbus_create_error(message,
- ERROR_INTERFACE ".InvalidArguments", NULL);
-
- if (set_order(pbap, order) < 0)
- return g_dbus_create_error(message,
- ERROR_INTERFACE ".InvalidArguments",
- "InvalidFilter");
-
- return dbus_message_new_method_return(message);
-}
-
-static DBusMessage *pbap_set_filter(DBusConnection *connection,
- DBusMessage *message, void *user_data)
+static gchar **get_filter_strs(uint64_t filter, gint *size)
{
- struct pbap_data *pbap = user_data;
- char **filters, **item;
- gint size;
- uint64_t oldfilter = pbap->filter;
-
- if (dbus_message_get_args(message, NULL, DBUS_TYPE_ARRAY,
- DBUS_TYPE_STRING, &filters, &size,
- DBUS_TYPE_INVALID) == FALSE)
- return g_dbus_create_error(message,
- ERROR_INTERFACE ".InvalidArguments", NULL);
-
- remove_filter(pbap, "ALL");
- if (size == 0)
- goto done;
+ gchar **list, **item;
+ gint i;
- for (item = filters; *item; item++) {
- if (add_filter(pbap, *item) < 0) {
- pbap->filter = oldfilter;
- g_strfreev(filters);
- return g_dbus_create_error(message,
- ERROR_INTERFACE ".InvalidArguments",
- "InvalidFilters");
- }
- }
+ list = g_malloc0(sizeof(gchar **) * (FILTER_BIT_MAX + 2));
-done:
- g_strfreev(filters);
- return dbus_message_new_method_return(message);
-}
+ item = list;
-static DBusMessage *pbap_get_filter(DBusConnection *connection,
- DBusMessage *message, void *user_data)
-{
- struct pbap_data *pbap = user_data;
- gchar **filters = NULL;
- gint size;
- DBusMessage *reply;
+ for (i = 0; filter_list[i] != NULL; i++)
+ if (filter & (1ULL << i))
+ *(item++) = g_strdup(filter_list[i]);
- filters = get_filter_strs(pbap->filter, &size);
- reply = dbus_message_new_method_return(message);
- dbus_message_append_args(reply, DBUS_TYPE_ARRAY,
- DBUS_TYPE_STRING, &filters, size,
- DBUS_TYPE_INVALID);
+ for (; i <= FILTER_BIT_MAX; i++)
+ if (filter & (1ULL << i))
+ *(item++) = g_strdup_printf("%s%d", "BIT", i);
- g_strfreev(filters);
- return reply;
+ *item = NULL;
+ *size = item - list;
+ return list;
}
static DBusMessage *pbap_list_filter_fields(DBusConnection *connection,
@@ -1137,18 +980,6 @@ static const GDBusMethodTable pbap_methods[] = {
{ GDBUS_ASYNC_METHOD("GetSize",
NULL, GDBUS_ARGS({ "size", "q" }),
pbap_get_size) },
- { GDBUS_METHOD("SetFormat",
- GDBUS_ARGS({ "format", "s" }), NULL,
- pbap_set_format) },
- { GDBUS_METHOD("SetOrder",
- GDBUS_ARGS({ "order", "s" }), NULL,
- pbap_set_order) },
- { GDBUS_METHOD("SetFilter",
- GDBUS_ARGS({ "fields", "as" }), NULL,
- pbap_set_filter) },
- { GDBUS_METHOD("GetFilter",
- NULL, GDBUS_ARGS({ "fields", "as" }),
- pbap_get_filter) },
{ GDBUS_METHOD("ListFilterFields",
NULL, GDBUS_ARGS({ "fields", "as" }),
pbap_list_filter_fields) },
--
1.7.11.4
^ permalink raw reply related
* [PATCH obexd 5/7 v4] test: Update pbap-client to work with changes in PhonebookAcess
From: Luiz Augusto von Dentz @ 2012-09-10 8:02 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1347264179-31477-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
test/pbap-client | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/test/pbap-client b/test/pbap-client
index 498f8a3..7dd54ef 100755
--- a/test/pbap-client
+++ b/test/pbap-client
@@ -70,16 +70,16 @@ class PbapClient:
print "Transfer finished with error %s: %s" % (code, message)
mainloop.quit()
- def pull(self, vcard, func):
+ def pull(self, vcard, params, func):
req = Transfer(func)
- self.pbap.Pull(vcard, "",
+ self.pbap.Pull(vcard, "", params,
reply_handler=lambda r: self.register(r, req),
error_handler=self.error)
self.transfers += 1
- def pull_all(self, func):
+ def pull_all(self, params, func):
req = Transfer(func)
- self.pbap.PullAll("",
+ self.pbap.PullAll("", params,
reply_handler=lambda r: self.register(r, req),
error_handler=self.error)
self.transfers += 1
@@ -135,18 +135,15 @@ if __name__ == '__main__':
print "Size = %d\n" % (ret)
print "\n--- List vCard ---\n"
- ret = pbap_client.interface().List()
+ ret = pbap_client.interface().List(dbus.Dictionary())
+ params = dbus.Dictionary({ "Format" : "vcard30",
+ "Fields" : [ "VERSION", "FN", "TEL"] })
for item in ret:
print "%s : %s" % (item[0], item[1])
- pbap_client.interface().SetFormat("vcard30")
- pbap_client.interface().SetFilter(["VERSION", "FN",
- "TEL"]);
- pbap_client.pull(item[0],
+ pbap_client.pull(item[0], params,
lambda x: process_result(x, None))
- pbap_client.interface().SetFormat("vcard30")
- pbap_client.interface().SetFilter(["VERSION", "FN", "TEL"]);
- pbap_client.pull_all(lambda x: process_result(x,
+ pbap_client.pull_all(params, lambda x: process_result(x,
"\n--- PullAll ---\n"))
pbap_client.flush_transfers(lambda: test_paths(paths[1:]))
--
1.7.11.4
^ permalink raw reply related
* [PATCH obexd 6/7 v4] client: Move common code to pull_phonebook
From: Luiz Augusto von Dentz @ 2012-09-10 8:02 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1347264179-31477-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
client/pbap.c | 79 +++++++++++++++++++++++------------------------------------
1 file changed, 30 insertions(+), 49 deletions(-)
diff --git a/client/pbap.c b/client/pbap.c
index c0ccbdc..a8db1cf 100644
--- a/client/pbap.c
+++ b/client/pbap.c
@@ -524,22 +524,29 @@ static GObexApparam *parse_filters(GObexApparam *apparam,
return apparam;
}
-static struct obc_transfer *pull_phonebook(struct pbap_data *pbap,
+static DBusMessage *pull_phonebook(struct pbap_data *pbap,
DBusMessage *message,
- guint8 type, const char *name,
+ guint8 type,
const char *targetfile,
- GObexApparam *apparam,
- GError **err)
+ GObexApparam *apparam)
{
struct pending_request *request;
struct obc_transfer *transfer;
+ char *name;
guint8 buf[32];
gsize len;
session_callback_t func;
+ DBusMessage *reply;
+ GError *err = NULL;
+
+ name = g_strconcat(pbap->path, ".vcf", NULL);
+
+ len = g_obex_apparam_encode(apparam, buf, sizeof(buf));
+ g_obex_apparam_free(apparam);
- transfer = obc_transfer_get("x-bt/phonebook", name, targetfile, err);
+ transfer = obc_transfer_get("x-bt/phonebook", name, targetfile, &err);
if (transfer == NULL)
- return NULL;
+ goto fail;
switch (type) {
case PULLPHONEBOOK:
@@ -555,19 +562,28 @@ static struct obc_transfer *pull_phonebook(struct pbap_data *pbap,
return NULL;
}
- len = g_obex_apparam_encode(apparam, buf, sizeof(buf));
-
obc_transfer_set_params(transfer, buf, len);
- if (!obc_session_queue(pbap->session, transfer, func, request, err)) {
+ if (!obc_session_queue(pbap->session, transfer, func, request, &err)) {
if (request != NULL)
pending_request_free(request);
- return NULL;
+ goto fail;
}
+ g_free(name);
+
+ if (targetfile == NULL)
+ return NULL;
- return transfer;
+ return obc_transfer_create_dbus_reply(transfer, message);
+
+fail:
+ g_free(name);
+ reply = g_dbus_create_error(message, ERROR_INTERFACE ".Failed", "%s",
+ err->message);
+ g_error_free(err);
+ return reply;
}
static DBusMessage *pull_vcard_listing(struct pbap_data *pbap,
@@ -655,11 +671,8 @@ static DBusMessage *pbap_pull_all(DBusConnection *connection,
DBusMessage *message, void *user_data)
{
struct pbap_data *pbap = user_data;
- struct obc_transfer *transfer;
const char *targetfile;
- char *name;
GObexApparam *apparam;
- GError *err = NULL;
DBusMessageIter args;
if (!pbap->path)
@@ -687,22 +700,8 @@ static DBusMessage *pbap_pull_all(DBusConnection *connection,
ERROR_INTERFACE ".InvalidArguments", NULL);
}
- name = g_strconcat(pbap->path, ".vcf", NULL);
-
- transfer = pull_phonebook(pbap, message, PULLPHONEBOOK, name,
- targetfile, apparam, &err);
- g_free(name);
- g_obex_apparam_free(apparam);
-
- if (transfer == NULL) {
- DBusMessage *reply = g_dbus_create_error(message,
- ERROR_INTERFACE ".Failed", "%s",
- err->message);
- g_error_free(err);
- return reply;
- }
-
- return obc_transfer_create_dbus_reply(transfer, message);
+ return pull_phonebook(pbap, message, PULLPHONEBOOK, targetfile,
+ apparam);
}
static DBusMessage *pull_vcard(struct pbap_data *pbap, DBusMessage *message,
@@ -878,11 +877,7 @@ static DBusMessage *pbap_get_size(DBusConnection *connection,
DBusMessage *message, void *user_data)
{
struct pbap_data *pbap = user_data;
- DBusMessage *reply;
- struct obc_transfer *transfer;
- char *name;
GObexApparam *apparam;
- GError *err = NULL;
DBusMessageIter args;
if (!pbap->path)
@@ -892,25 +887,11 @@ static DBusMessage *pbap_get_size(DBusConnection *connection,
dbus_message_iter_init(message, &args);
- name = g_strconcat(pbap->path, ".vcf", NULL);
-
apparam = g_obex_apparam_set_uint16(NULL, MAXLISTCOUNT_TAG, 0);
apparam = g_obex_apparam_set_uint16(apparam, LISTSTARTOFFSET_TAG,
DEFAULT_OFFSET);
- transfer = pull_phonebook(pbap, message, GETPHONEBOOKSIZE, name, NULL,
- apparam, &err);
-
- g_free(name);
- g_obex_apparam_free(apparam);
-
- if (transfer != NULL)
- return NULL;
-
- reply = g_dbus_create_error(message, ERROR_INTERFACE ".Failed", "%s",
- err->message);
- g_error_free(err);
- return reply;
+ return pull_phonebook(pbap, message, GETPHONEBOOKSIZE, NULL, apparam);
}
static gchar **get_filter_strs(uint64_t filter, gint *size)
--
1.7.11.4
^ permalink raw reply related
* [PATCH obexd 7/7 v4] client-doc: Update documentation of PhonebookAccess interface
From: Luiz Augusto von Dentz @ 2012-09-10 8:02 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1347264179-31477-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
doc/client-api.txt | 62 +++++++++++++++++++++++++++++++-----------------------
1 file changed, 36 insertions(+), 26 deletions(-)
diff --git a/doc/client-api.txt b/doc/client-api.txt
index 7ca65cc..f447789 100644
--- a/doc/client-api.txt
+++ b/doc/client-api.txt
@@ -206,7 +206,7 @@ Methods void Select(string location, string phonebook)
"mch": missing call history
"cch": combination of ich och mch
- object, dict PullAll(string targetfile)
+ object, dict PullAll(string targetfile, dict filters)
Return the entire phonebook object from the PSE server
in plain string with vcard format, and store it in
@@ -222,14 +222,21 @@ Methods void Select(string location, string phonebook)
The properties of this transfer are also returned along
with the object path, to avoid a call to GetProperties.
- array{string vcard, string name} List()
+ Possible filters: Format, Order, Offset, MaxCount and
+ Fields
+
+ array{string vcard, string name} List(dict filters)
Return an array of vcard-listing data where every entry
consists of a pair of strings containing the vcard
handle and the contact name. For example:
"1.vcf" : "John"
- object, dict Pull(string vcard, string targetfile)
+ Possible filters: Order, Offset and MaxCount
+
+
+ object, dict
+ Pull(string vcard, string targetfile, dict filters)
Given a vcard handle, retrieve the vcard in the current
phonebook object and store it in a local file.
@@ -244,8 +251,11 @@ Methods void Select(string location, string phonebook)
The properties of this transfer are also returned along
with the object path, to avoid a call to GetProperties.
+ Possbile filters: Format and Fields
+
+
array{string vcard, string name}
- Search(string field, string value)
+ Search(string field, string value, dict filters)
Search for entries matching the given condition and
return an array of vcard-listing data where every entry
@@ -258,47 +268,47 @@ Methods void Select(string location, string phonebook)
{ "name" (default) | "number" | "sound" }
value : the string value to search for
+
+ Possible filters: Order, Offset and MaxCount
+
uint16 GetSize()
Return the number of entries in the selected phonebook
object that are actually used (i.e. indexes that
correspond to non-NULL entries).
- void SetFormat(string format)
+ array{string} ListFilterFields()
- Indicate the format of the vcard that should be return
- by related methods.
+ Return All Available fields that can be used in Fields
+ filter.
- format : { "vcard21" (default) | "vcard30" }
+Filter: string Format:
- void SetOrder(string order)
+ Items vcard format
- Indicate the sorting method of the vcard-listing data
- returned by List and Search methods.
+ Possible values: "vcard21" (default) or "vcard30"
- order : { "indexed" (default) | "alphanumeric" |
- "phonetic" }
+ string Order:
- void SetFilter(array{string})
+ Items order
- Indicate fields that should be contained in vcards
- return by related methods.
+ Possible values: "indexed" (default), "alphanumeric" or
+ "phonetic"
- Give an empty array will clear the filter and return
- all fields available in vcards. And this is the default
- behavior.
+ uint16 Offset:
- Possible filter fields : "VERSION", "FN", ..., "ALL",
- "bit[0-63]"
+ Offset of the first item, default is 0
- array{string} ListFilterFields()
+ uint16 MaxCount:
+
+ Maximum number of items, default is unlimited (65535)
+
+ array{string} Fields:
- Return All Available fields that can be used in
- SetFilter method.
+ Item vcard fields, default is all values.
- array{string} GetFilter()
+ Possible values can be query with ListFilterFields.
- Return the current filter setting
Synchronization hierarchy
=======================
--
1.7.11.4
^ permalink raw reply related
* [RFCv0] Bluetooth: Fix SO_LINGER in L2CAP
From: Andrei Emeltchenko @ 2012-09-10 8:23 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <alpine.DEB.2.02.1209070949580.3761@mathewm-linux>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
include/net/bluetooth/l2cap.h | 2 +-
net/bluetooth/l2cap_core.c | 35 ++++++++++++++++-------------------
net/bluetooth/l2cap_sock.c | 9 +++------
3 files changed, 20 insertions(+), 26 deletions(-)
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 8a726ff..72ffe53 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -757,7 +757,7 @@ int l2cap_init_sockets(void);
void l2cap_cleanup_sockets(void);
void __l2cap_connect_rsp_defer(struct l2cap_chan *chan);
-int __l2cap_wait_ack(struct sock *sk);
+int __l2cap_wait_ack(struct sock *sk, unsigned long timeo);
int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm);
int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid);
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index b1914e6..0502042 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1696,35 +1696,32 @@ done:
return err;
}
-int __l2cap_wait_ack(struct sock *sk)
+int __l2cap_wait_ack(struct sock *sk, unsigned long timeo)
{
struct l2cap_chan *chan = l2cap_pi(sk)->chan;
- DECLARE_WAITQUEUE(wait, current);
int err = 0;
- int timeo = HZ/5;
- add_wait_queue(sk_sleep(sk), &wait);
- set_current_state(TASK_INTERRUPTIBLE);
- while (chan->unacked_frames > 0 && chan->conn) {
- if (!timeo)
- timeo = HZ/5;
+ if (unlikely(!skb_queue_empty(&chan->tx_q))) {
+ DECLARE_WAITQUEUE(wait, current);
+
+ add_wait_queue(sk_sleep(sk), &wait);
+ set_current_state(TASK_INTERRUPTIBLE);
if (signal_pending(current)) {
err = sock_intr_errno(timeo);
- break;
- }
+ } else {
+ release_sock(sk);
+ timeo = schedule_timeout(timeo);
+ lock_sock(sk);
+ set_current_state(TASK_INTERRUPTIBLE);
- release_sock(sk);
- timeo = schedule_timeout(timeo);
- lock_sock(sk);
- set_current_state(TASK_INTERRUPTIBLE);
+ err = sock_error(sk);
+ }
- err = sock_error(sk);
- if (err)
- break;
+ set_current_state(TASK_RUNNING);
+ remove_wait_queue(sk_sleep(sk), &wait);
}
- set_current_state(TASK_RUNNING);
- remove_wait_queue(sk_sleep(sk), &wait);
+
return err;
}
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index f9cdc02..bb3515f 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -866,18 +866,15 @@ static int l2cap_sock_shutdown(struct socket *sock, int how)
lock_sock(sk);
if (!sk->sk_shutdown) {
- if (chan->mode == L2CAP_MODE_ERTM)
- err = __l2cap_wait_ack(sk);
+ if (chan->mode == L2CAP_MODE_ERTM &&
+ sock_flag(sk, SOCK_LINGER && sk->sk_lingertime))
+ err = __l2cap_wait_ack(sk, sk->sk_lingertime);
sk->sk_shutdown = SHUTDOWN_MASK;
release_sock(sk);
l2cap_chan_close(chan, 0);
lock_sock(sk);
-
- if (sock_flag(sk, SOCK_LINGER) && sk->sk_lingertime)
- err = bt_sock_wait_state(sk, BT_CLOSED,
- sk->sk_lingertime);
}
if (!err && sk->sk_err)
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH obexd 1/7 v4] client: Add filters to Phonebook.PullAll
From: Johan Hedberg @ 2012-09-10 8:24 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1347264179-31477-1-git-send-email-luiz.dentz@gmail.com>
Hi Luiz,
On Mon, Sep 10, 2012, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> This avoid D-Bus round trips and is more aligned with what has been
> proposed for MessageAccess interface.
> ---
> v3: Fix patch 2/7
> v4: Fix not having an empty line before parse_filter in patch 1/7
>
> client/pbap.c | 256 +++++++++++++++++++++++++++++++++++++++++++++++-----------
> 1 file changed, 210 insertions(+), 46 deletions(-)
The whole patch set has been applied. Thanks.
Johan
^ permalink raw reply
* Re: [RFCv0] Bluetooth: Fix SO_LINGER in L2CAP
From: Anderson Lizardo @ 2012-09-10 10:43 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1347265388-19759-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
On Mon, Sep 10, 2012 at 4:23 AM, Andrei Emeltchenko
<Andrei.Emeltchenko.news@gmail.com> wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Could you explain on the commit message what is broken on the current
code, so we can review the semantics of your changes?
Is it any crash, wrong behavior etc.
Best Regards,
--
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil
^ permalink raw reply
* Re: [RFCv0] Bluetooth: Fix SO_LINGER in L2CAP
From: Andrei Emeltchenko @ 2012-09-10 10:55 UTC (permalink / raw)
To: Anderson Lizardo; +Cc: linux-bluetooth
In-Reply-To: <CAJdJm_PpSukMH=d1giiN1WKmXAam7s5OQB9-YS1aYwv1rB+84Q@mail.gmail.com>
Hi Anderson,
On Mon, Sep 10, 2012 at 06:43:53AM -0400, Anderson Lizardo wrote:
> Hi Andrei,
>
> On Mon, Sep 10, 2012 at 4:23 AM, Andrei Emeltchenko
> <Andrei.Emeltchenko.news@gmail.com> wrote:
> > From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> Could you explain on the commit message what is broken on the current
> code, so we can review the semantics of your changes?
If we have unacked frames when closing bluetooth socket we deadlock
since conn->chan_lock, chan->lock and socket lock are taken.
Also see Mat comments.
Best regards
Andrei Emeltchenko
^ permalink raw reply
* [PATCH obexd] client: Use larger timeout first packet in transfers
From: Luiz Augusto von Dentz @ 2012-09-10 11:32 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This align the client timeout for GET operations with g_obex_get_req_pkt
which does use 60 seconds to cover for extra interaction during the first
packet.
---
client/transfer.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/client/transfer.c b/client/transfer.c
index 76f6681..e9fabfb 100644
--- a/client/transfer.c
+++ b/client/transfer.c
@@ -48,6 +48,8 @@
#define OBC_TRANSFER_ERROR obc_transfer_error_quark()
+#define FIRST_PACKET_TIMEOUT 60
+
static guint64 counter = 0;
struct transfer_callback {
@@ -662,7 +664,8 @@ static gboolean transfer_start_get(struct obc_transfer *transfer, GError **err)
transfer->params->data,
transfer->params->size);
- transfer->xfer = g_obex_send_req(transfer->obex, req, -1,
+ transfer->xfer = g_obex_send_req(transfer->obex, req,
+ FIRST_PACKET_TIMEOUT,
get_xfer_progress_first,
transfer, err);
if (transfer->xfer == 0)
--
1.7.11.4
^ permalink raw reply related
* Re: [PATCH] Add support for Logitech Harmony Adapter for PS3
From: Luiz Augusto von Dentz @ 2012-09-10 13:11 UTC (permalink / raw)
To: David Dillow, linux-bluetooth
In-Reply-To: <20120907124559.GA16092@x220>
Hi David, Bastien,
So we are plannin to rid of the fakehid.c in favor of implementing it
properly inside the kernel similarly to what was done to wiimote, so
is there any obstacle for doing that?
The kernel seems to already have some support for sixaxis in
drivers/hid/hid-sony.c, so I suppose the following would enable us to
use it:
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 41c34f2..a34d92c 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -684,6 +684,7 @@
#define USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE 0x024b
#define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268
#define USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER 0x042f
+#define BT_DEVICE_ID_SONY_PS3_CONTROLLER 0x0306
#define USB_VENDOR_ID_SOUNDGRAPH 0x15c2
#define USB_DEVICE_ID_SOUNDGRAPH_IMON_FIRST 0x0034
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 5cd25bd..17dd1bb 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -216,6 +216,8 @@ static const struct hid_device_id sony_devices[] = {
.driver_data = SIXAXIS_CONTROLLER_USB },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY,
USB_DEVICE_ID_SONY_PS3_CONTROLLER),
.driver_data = SIXAXIS_CONTROLLER_BT },
+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY,
BT_DEVICE_ID_SONY_PS3_CONTROLLER),
+ .driver_data = SIXAXIS_CONTROLLER_BT },
{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE),
.driver_data = VAIO_RDESC_CONSTANT },
{ }
--
Luiz Augusto von Dentz
^ permalink raw reply related
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