* Re: [PATCH] IrMC sync server support
From: Marcel J.E. Mol @ 2010-08-17 8:48 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: Marcel Holtmann, linux-bluetooth
In-Reply-To: <AANLkTi=p5WD+WELPNo=URLVTnpaKQ4xFk9Efu2HiviYE@mail.gmail.com>
Hi,
On Mon, Aug 16, 2010 at 10:47:08PM +0300, Luiz Augusto von Dentz wrote:
> Hi,
>
> On Mon, Aug 16, 2010 at 8:22 PM, Marcel J.E. Mol <marcel@mesa.nl> wrote:
> > On Thu, Aug 12, 2010 at 07:41:39AM -0400, Marcel Holtmann wrote:
> >> Hi Marcel,
> >>
> >> > A reasonable working IrMC SYNC server (only full phonebook sync support)
> >> > Support for cal and note by just returning nothing.
> >> > ---
> >> > Makefile.am | 3 +
> >> > plugins/irmc.c | 488 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >> > src/main.c | 12 ++-
> >> > src/obex.h | 1 +
> >> > 4 files changed, 502 insertions(+), 2 deletions(-)
> >> > create mode 100644 plugins/irmc.c
> >> >
> >> > diff --git a/Makefile.am b/Makefile.am
> >> > index 73e2f28..ce8c675 100644
> >> > --- a/Makefile.am
> >> > +++ b/Makefile.am
> >> > @@ -58,6 +58,9 @@ builtin_sources += plugins/pbap.c plugins/phonebook.h \
> >> > builtin_modules += syncevolution
> >> > builtin_sources += plugins/syncevolution.c
> >> >
> >> > +builtin_modules += irmc
> >> > +builtin_sources += plugins/irmc.c plugins/phonebook.h
> >> > +
> >> > builtin_nodist += plugins/phonebook.c
> >> >
> >> > libexec_PROGRAMS += src/obexd
> >> > diff --git a/plugins/irmc.c b/plugins/irmc.c
> >> > new file mode 100644
> >> > index 0000000..96fd807
> >> > --- /dev/null
> >> > +++ b/plugins/irmc.c
> >> > @@ -0,0 +1,488 @@
> >> > +/*
> >> > + *
> >> > + * OBEX IrMC Sync Server
> >> > ...
> >> > +#include "dbus.h"
> >> > +
> >> > +#define IRMC_CHANNEL 17
> >>
> >> we did have a list of defined RFCOMM channels for various protocols, but
> >> just don't remember where it is.
> >>
> >> Johan, we should put that into the doc/ directory actually. Can you dig
> >> up that list and commit it as text file.
> >>
> >
> > Any news on this one? Is 17 the correct channel for IrMC?
>
> I just took a look in the spec, it just say that the channel 'varies',
> which is not very revealing and it does not suggest anything. The only
> record that I found was using channel 11 which apparently we are not
> using too.
Ok, then 17 is just fine for IrMC then. I posted a 3th version at the end of
last week. Are there any new comments I have to take care of? Or can it be
considere for inclusion in the main tree now?
On the other hand, if the channel 'varies' it might be better to let the
plugin manager select a channel number for each service instead of allocating
a fixed one in the specific plugin code.
What did you found about channel 11 then? On my nokia 7710 channel 11 is used for
"OBEX File Transfer" (serivce 0x1106).
-Marcel
--
======-------- Marcel J.E. Mol MESA Consulting B.V.
=======--------- ph. +31-(0)6-54724868 P.O. Box 112
=======--------- marcel@mesa.nl 2630 AC Nootdorp
__==== www.mesa.nl ---____U_n_i_x______I_n_t_e_r_n_e_t____ The Netherlands ____
They couldn't think of a number, Linux user 1148 -- counter.li.org
so they gave me a name! -- Rupert Hine -- www.ruperthine.com
^ permalink raw reply
* Re: [PATCH 2/3] Maemo6 MCE: listen to adapter mode changes
From: Johan Hedberg @ 2010-08-17 10:30 UTC (permalink / raw)
To: Daniel Örstadius; +Cc: linux-bluetooth
In-Reply-To: <AANLkTimpogcSN1eKO9A2aWB1aB7YNZSRD7f-vGMvma9q@mail.gmail.com>
Hi Daniel,
> From: Daniel Orstadius <daniel.orstadius@nokia.com>
> Date: Tue, 17 Aug 2010 11:41:33 +0300
> Subject: [PATCH] Maemo6 MCE: listen to adapter powered state
>
> Registers a callback in btd_adapter to get notified when the
> powered state of the adapter is changed. This is needed to update
> the state stored in the MCE if the adapter is powered on or off
> using for example SetProperty(Powered). The current setting of
> the MCE is saved in a variable and if the notification to the
> plugin does not match this value the MCE is updated accordingly
> using its DBus method for setting radio states.
> ---
> plugins/maemo6.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++--
> 1 files changed, 46 insertions(+), 2 deletions(-)
A couple of issues I noticed:
> + DBG("adapter_powered called with %d", (int) powered);
I don't think the int cast is necessary here. Or do you get a warning
otherwise?
> + dbus_message_append_args(msg, DBUS_TYPE_UINT32, &radio_states,
> + DBUS_TYPE_UINT32, &radio_mask);
DBUS_TYPE_INVALID is missing from the end of the arguments list.
> +}
> +
> +
> static int mce_probe(struct btd_adapter *adapter)
Why the two consecutive empty lines? Please remove one.
> @@ -132,6 +173,9 @@ static int mce_probe(struct btd_adapter *adapter)
> watch_id = g_dbus_add_signal_watch(conn, NULL, MCE_SIGNAL_PATH,
> MCE_SIGNAL_IF, MCE_RADIO_STATES_SIG,
> mce_signal_callback, adapter, NULL);
> +
> + btd_adapter_register_powered_callback(adapter, adapter_powered);
> +
> return 0;
> }
>
It seems you're missing the corresponding unregister_powered_callback
call in mce_remove().
Johan
^ permalink raw reply
* [PATCH] Fix problem with filling ADR with unneeded semicolons
From: Lukasz Pawlik @ 2010-08-17 11:10 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Lukasz Pawlik
Previously in a phonebook pull request ADR was filled with six
semicolons when contact address entry was empty in phonebook. This
patch fixes this problem. Address is send as an empty string.
---
plugins/vcard.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/plugins/vcard.c b/plugins/vcard.c
index 80f8265..7333a68 100644
--- a/plugins/vcard.c
+++ b/plugins/vcard.c
@@ -155,6 +155,26 @@ static gboolean contact_fields_present(struct phonebook_contact * contact)
return FALSE;
}
+static gboolean address_fields_present(struct phonebook_contact *contact)
+{
+ if (contact->pobox && strlen(contact->pobox))
+ return TRUE;
+ if (contact->extended && strlen(contact->extended))
+ return TRUE;
+ if (contact->street && strlen(contact->street))
+ return TRUE;
+ if (contact->locality && strlen(contact->locality))
+ return TRUE;
+ if (contact->region && strlen(contact->region))
+ return TRUE;
+ if (contact->postal && strlen(contact->postal))
+ return TRUE;
+ if (contact->country && strlen(contact->country))
+ return TRUE;
+
+ return FALSE;
+}
+
static void vcard_printf_name(GString *vcards,
struct phonebook_contact *contact)
{
@@ -253,6 +273,11 @@ static void vcard_printf_email(GString *vcards, const char *email)
static void vcard_printf_adr(GString *vcards, struct phonebook_contact *contact)
{
+ if (address_fields_present(contact) == FALSE) {
+ vcard_printf(vcards, "ADR:");
+ return;
+ }
+
vcard_printf(vcards, "ADR:%s;%s;%s;%s;%s;%s;%s", contact->pobox,
contact->extended, contact->street,
contact->locality, contact->region,
--
1.7.0.4
^ permalink raw reply related
* Re: [PATCH] Fix problem with filling ADR with unneeded semicolons
From: Johan Hedberg @ 2010-08-17 11:50 UTC (permalink / raw)
To: Lukasz Pawlik; +Cc: linux-bluetooth
In-Reply-To: <1282043444-20543-1-git-send-email-lucas.pawlik@gmail.com>
Hi Lukasz,
On Tue, Aug 17, 2010, Lukasz Pawlik wrote:
> Previously in a phonebook pull request ADR was filled with six
> semicolons when contact address entry was empty in phonebook. This
> patch fixes this problem. Address is send as an empty string.
> ---
> plugins/vcard.c | 25 +++++++++++++++++++++++++
> 1 files changed, 25 insertions(+), 0 deletions(-)
Thanks. The patch is now upstream.
Johan
^ permalink raw reply
* Re: resending patch to retry reset in case it failed
From: Oliver Neukum @ 2010-08-17 12:41 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth, linux-usb
In-Reply-To: <1281612323.12579.252.camel@localhost.localdomain>
Am Donnerstag, 12. August 2010, 13:25:23 schrieb Marcel Holtmann:
> Hi Oliver,
>
> > may I ask what happened to this patch?
> > Do you take it, want modifications or reject it?
> >
> > Regards
> > Oliver
> >
> > From af61f0663f095599003290b13ad6fadee1d4fb25 Mon Sep 17 00:00:00 2001
> > From: Oliver Neukum <oliver@neukum.org>
> > Date: Tue, 6 Jul 2010 08:08:42 +0200
> > Subject: [PATCH] bluetooth: retry reset for devices that fail
> >
> > Some devices fail to reset properly at the first attempt to reset
> > them under unknown circumstances. Failures can be identified by
> > an invalid btaddr. Retry in those cases.
>
> I was pondering about it and haven't really made up my mind with this
> stuff. To be honest, I don't like the patch a little bit. I can see your
> point why you want it, but the patch is a bit too ugly for my taste.
Do you have any suggestion how to beautify it?
To me the patch shows the quality of simplicity at least.
> Tell me which device is causing this and I might be able to reproduce
> this and find small less ugly fix. Also keep in mind that the init
> routine needs changing to accommodate AMP and LE devices. So we have to
> be really careful here.
In the non-error case the patch changes nothing.
Regards
Oliver
^ permalink raw reply
* Re: [PATCH 2/3] Maemo6 MCE: listen to adapter mode changes
From: Daniel Örstadius @ 2010-08-17 12:54 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <20100817103051.GA29845@jh-x301>
[-- Attachment #1: Type: text/plain, Size: 1204 bytes --]
On Tue, Aug 17, 2010 at 1:30 PM, Johan Hedberg <johan.hedberg@gmail.com> wrote:
>
> A couple of issues I noticed:
>
>> + DBG("adapter_powered called with %d", (int) powered);
>
> I don't think the int cast is necessary here. Or do you get a warning
> otherwise?
>
>> + dbus_message_append_args(msg, DBUS_TYPE_UINT32, &radio_states,
>> + DBUS_TYPE_UINT32, &radio_mask);
>
> DBUS_TYPE_INVALID is missing from the end of the arguments list.
>
>> +}
>> +
>> +
>> static int mce_probe(struct btd_adapter *adapter)
>
> Why the two consecutive empty lines? Please remove one.
>
>> @@ -132,6 +173,9 @@ static int mce_probe(struct btd_adapter *adapter)
>> watch_id = g_dbus_add_signal_watch(conn, NULL, MCE_SIGNAL_PATH,
>> MCE_SIGNAL_IF, MCE_RADIO_STATES_SIG,
>> mce_signal_callback, adapter, NULL);
>> +
>> + btd_adapter_register_powered_callback(adapter, adapter_powered);
>> +
>> return 0;
>> }
>>
>
> It seems you're missing the corresponding unregister_powered_callback
> call in mce_remove().
>
Corrected in the attached patch.
/Daniel
[-- Attachment #2: 0001-Maemo6-MCE-listen-to-adapter-powered-state.patch --]
[-- Type: text/x-patch, Size: 3836 bytes --]
From 263f53fe9cddd9fe9c8c8d4e8265cfbbe3f8c37e Mon Sep 17 00:00:00 2001
From: Daniel Orstadius <daniel.orstadius@nokia.com>
Date: Tue, 17 Aug 2010 15:48:45 +0300
Subject: [PATCH] Maemo6 MCE: listen to adapter powered state
Registers a callback to btd_adapter to get notified when the
powered state of the adapter is changed. This is needed to update
the state stored in the MCE if the adapter is powered on or off
using for example SetProperty(Powered). The current setting of
the MCE is saved in a variable and if the notification to the
plugin does not match this value the MCE is updated accordingly
using its DBus method for setting radio states.
---
plugins/maemo6.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 48 insertions(+), 2 deletions(-)
diff --git a/plugins/maemo6.c b/plugins/maemo6.c
index 2ed5f12..55ea508 100644
--- a/plugins/maemo6.c
+++ b/plugins/maemo6.c
@@ -43,11 +43,13 @@
#define MCE_SIGNAL_IF "com.nokia.mce.signal"
#define MCE_REQUEST_PATH "/com/nokia/mce/request"
#define MCE_SIGNAL_PATH "/com/nokia/mce/signal"
+#define MCE_RADIO_STATES_CHANGE_REQ "req_radio_states_change"
#define MCE_RADIO_STATES_GET "get_radio_states"
#define MCE_RADIO_STATES_SIG "radio_states_ind"
static guint watch_id;
static DBusConnection *conn = NULL;
+static gboolean mce_bt_set = FALSE;
static gboolean mce_signal_callback(DBusConnection *connection,
DBusMessage *message, void *user_data)
@@ -66,7 +68,11 @@ static gboolean mce_signal_callback(DBusConnection *connection,
dbus_message_iter_get_basic(&args, &sigvalue);
DBG("got signal with value %u", sigvalue);
- if (sigvalue & MCE_RADIO_STATE_BLUETOOTH)
+ /* set the adapter according to the mce signal
+ and remember the value */
+ mce_bt_set = sigvalue & MCE_RADIO_STATE_BLUETOOTH;
+
+ if (mce_bt_set)
btd_adapter_switch_online(adapter);
else
btd_adapter_switch_offline(adapter);
@@ -102,13 +108,48 @@ static void read_radio_states_cb(DBusPendingCall *call, void *user_data)
goto done;
}
- if (radio_states & MCE_RADIO_STATE_BLUETOOTH)
+ DBG("radio_states: %d", radio_states);
+
+ mce_bt_set = radio_states & MCE_RADIO_STATE_BLUETOOTH;
+
+ if (mce_bt_set)
btd_adapter_switch_online(adapter);
+ else
+ btd_adapter_switch_offline(adapter);
done:
dbus_message_unref(reply);
}
+static void adapter_powered(struct btd_adapter *adapter, gboolean powered)
+{
+ DBusMessage *msg;
+ dbus_uint32_t radio_states = 0;
+ dbus_uint32_t radio_mask = MCE_RADIO_STATE_BLUETOOTH;
+
+ DBG("adapter_powered called with %d", powered);
+
+ /* nothing to do if the states match */
+ if (mce_bt_set == powered)
+ return;
+
+ /* set the mce value according to the state of the adapter */
+ msg = dbus_message_new_method_call(MCE_SERVICE, MCE_REQUEST_PATH,
+ MCE_REQUEST_IF, MCE_RADIO_STATES_CHANGE_REQ);
+
+ if (powered)
+ radio_states = MCE_RADIO_STATE_BLUETOOTH;
+
+ dbus_message_append_args(msg, DBUS_TYPE_UINT32, &radio_states,
+ DBUS_TYPE_UINT32, &radio_mask,
+ DBUS_TYPE_INVALID);
+
+ if (!dbus_connection_send(conn, msg, NULL))
+ error("calling %s failed", MCE_RADIO_STATES_CHANGE_REQ);
+
+ dbus_message_unref(msg);
+}
+
static int mce_probe(struct btd_adapter *adapter)
{
DBusMessage *msg;
@@ -132,6 +173,9 @@ static int mce_probe(struct btd_adapter *adapter)
watch_id = g_dbus_add_signal_watch(conn, NULL, MCE_SIGNAL_PATH,
MCE_SIGNAL_IF, MCE_RADIO_STATES_SIG,
mce_signal_callback, adapter, NULL);
+
+ btd_adapter_register_powered_callback(adapter, adapter_powered);
+
return 0;
}
@@ -141,6 +185,8 @@ static void mce_remove(struct btd_adapter *adapter)
if (watch_id > 0)
g_dbus_remove_watch(conn, watch_id);
+
+ btd_adapter_unregister_powered_callback(adapter, adapter_powered);
}
static struct btd_adapter_driver mce_driver = {
--
1.6.0.4
^ permalink raw reply related
* Re: [PATCH 2/3] Maemo6 MCE: listen to adapter mode changes
From: Johan Hedberg @ 2010-08-17 13:33 UTC (permalink / raw)
To: Daniel Örstadius; +Cc: linux-bluetooth
In-Reply-To: <AANLkTikfG3Beawf-kguknYcz-T8WXL9hk9H_D9N35=SS@mail.gmail.com>
Hi Daniel,
On Tue, Aug 17, 2010, Daniel Örstadius wrote:
> Corrected in the attached patch.
>
> /Daniel
> From 263f53fe9cddd9fe9c8c8d4e8265cfbbe3f8c37e Mon Sep 17 00:00:00 2001
> From: Daniel Orstadius <daniel.orstadius@nokia.com>
> Date: Tue, 17 Aug 2010 15:48:45 +0300
> Subject: [PATCH] Maemo6 MCE: listen to adapter powered state
>
> Registers a callback to btd_adapter to get notified when the
> powered state of the adapter is changed. This is needed to update
> the state stored in the MCE if the adapter is powered on or off
> using for example SetProperty(Powered). The current setting of
> the MCE is saved in a variable and if the notification to the
> plugin does not match this value the MCE is updated accordingly
> using its DBus method for setting radio states.
> ---
> plugins/maemo6.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++--
> 1 files changed, 48 insertions(+), 2 deletions(-)
Thanks. This patch is now also upstream.
Johan
^ permalink raw reply
* [PATCH 1/2] Fix aborting capability scripts making them zombies processes
From: Luiz Augusto von Dentz @ 2010-08-17 13:58 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
When using G_SPAWN_DO_NOT_REAP_CHILD the watch cannot be removed since it
basically replaces the use of waitpid which does prevent the child
process to became 'zombie' when terminated, a more detailed explanation
can be found in waitpid manpage.
---
plugins/filesystem.c | 28 ++++++++++++++++++----------
1 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/plugins/filesystem.c b/plugins/filesystem.c
index f0e5bbe..bf00ac2 100644
--- a/plugins/filesystem.c
+++ b/plugins/filesystem.c
@@ -237,7 +237,7 @@ struct capability_object {
int pid;
int output;
int err;
- unsigned int watch;
+ gboolean aborted;
GString *buffer;
};
@@ -247,10 +247,20 @@ static void script_exited(GPid pid, int status, void *data)
char buf[128];
object->pid = -1;
- object->watch = 0;
DBG("pid: %d status: %d", pid, status);
+ g_spawn_close_pid(pid);
+
+ /* free the object if aborted */
+ if (object->aborted) {
+ if (object->buffer != NULL)
+ g_string_free(object->buffer, TRUE);
+
+ g_free(object);
+ return;
+ }
+
if (WEXITSTATUS(status) != EXIT_SUCCESS) {
memset(buf, 0, sizeof(buf));
if (read(object->err, buf, sizeof(buf)) > 0)
@@ -258,8 +268,6 @@ static void script_exited(GPid pid, int status, void *data)
obex_object_set_io_flags(data, G_IO_ERR, -EPERM);
} else
obex_object_set_io_flags(data, G_IO_IN, 0);
-
- g_spawn_close_pid(pid);
}
static int capability_exec(const char **argv, int *output, int *err)
@@ -321,7 +329,8 @@ static void *capability_open(const char *name, int oflag, mode_t mode,
if (object->pid < 0)
goto fail;
- object->watch = g_child_watch_add(object->pid, script_exited, object);
+ /* Watch cannot be removed while the process is still running */
+ g_child_watch_add(object->pid, script_exited, object);
done:
if (err)
@@ -519,18 +528,17 @@ static int capability_close(void *object)
if (obj->pid < 0)
goto done;
- if (obj->watch)
- g_source_remove(obj->watch);
-
- g_spawn_close_pid(obj->pid);
-
DBG("kill: pid %d", obj->pid);
err = kill(obj->pid, SIGTERM);
if (err < 0) {
err = -errno;
error("kill: %s (%d)", strerror(-err), -err);
+ goto done;
}
+ obj->aborted = TRUE;
+ return 0;
+
done:
if (obj->buffer != NULL)
g_string_free(obj->buffer, TRUE);
--
1.7.0.4
^ permalink raw reply related
* [PATCH 2/2] gwobex: fix misuse of OBEX_SetCustomData/OBEX_GetCustomData
From: Luiz Augusto von Dentz @ 2010-08-17 13:58 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1282053510-18102-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
Those function should only be used in case of custom transport which is
not the case since we are using fd transport here.
To fix that it now uses OBEX_SetUserData/OBEX_GetUserData which are not
associate with any transport in particular.
---
gwobex/gw-obex.c | 2 +-
gwobex/obex-priv.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gwobex/gw-obex.c b/gwobex/gw-obex.c
index e656692..4481212 100644
--- a/gwobex/gw-obex.c
+++ b/gwobex/gw-obex.c
@@ -343,7 +343,7 @@ GwObex *gw_obex_setup_fd(int fd, const gchar *uuid, gint uuid_len,
ctx->mutex = g_mutex_new();
#endif
- OBEX_SetCustomData(handle, ctx);
+ OBEX_SetUserData(handle, ctx);
debug("Connecting to OBEX service\n");
if (!gw_obex_connect(ctx, uuid, uuid_len)) {
diff --git a/gwobex/obex-priv.c b/gwobex/obex-priv.c
index 76a9599..aba7dd7 100644
--- a/gwobex/obex-priv.c
+++ b/gwobex/obex-priv.c
@@ -514,7 +514,7 @@ static void obex_writestream(GwObex *ctx, obex_object_t *object) {
static void obex_event_handler(obex_t *handle, obex_object_t *object, int mode,
int event, int obex_cmd, int obex_rsp) {
- GwObex *ctx = OBEX_GetCustomData(handle);
+ GwObex *ctx = OBEX_GetUserData(handle);
switch (event) {
case OBEX_EV_ABORT:
debug("OBEX_EV_ABORT\n");
--
1.7.0.4
^ permalink raw reply related
* [PATCH 0/5] Fast connectable mode for HFP
From: Dmitriy Paliy @ 2010-08-17 14:05 UTC (permalink / raw)
To: linux-bluetooth
Hi,
The following patches are implementation of fast connectable mode for HFP.
Such mode means significantly shorter page scan interval and interlaced
page scan type. As a result, HFP connection typically is created much faster.
The fast connectable mode can be activated by incomming call indicator and
deactivated by answer or reject call indicator. Such speeds up connectability
of a headset when there is an incomming call. Retransmisions in eSCO are
possible to be paused for in-band ring tone when the mode is enabled during
given above period of time. eSCO is not affected during call since page scan
settings are returned to their default values immidiately after call is
accepted (or rejected).
Use of the mode can be enabled by changing FastConnectable in audio.conf
configuration file. It is disabled by default. Also, it doesn't affect and
doesn't change any other interfaces.
Br,
Dmitriy
^ permalink raw reply
* [PATCH 1/5] Add STANDARD and INTERLACED page scan definitions
From: Dmitriy Paliy @ 2010-08-17 14:05 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Dmitriy Paliy
In-Reply-To: <1282053934-19445-1-git-send-email-dmitriy.paliy@nokia.com>
Added standard and interlaced page scan type definitions. Used for
both read and write page scan type HCI commands.
---
lib/hci.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/lib/hci.h b/lib/hci.h
index f31918d..0369ee2 100644
--- a/lib/hci.h
+++ b/lib/hci.h
@@ -992,6 +992,8 @@ typedef struct {
#define OCF_READ_PAGE_SCAN_TYPE 0x0046
#define OCF_WRITE_PAGE_SCAN_TYPE 0x0047
+ #define PAGE_SCAN_TYPE_STANDARD 0x00
+ #define PAGE_SCAN_TYPE_INTERLACED 0x01
#define OCF_READ_AFH_MODE 0x0048
typedef struct {
--
1.7.0.4
^ permalink raw reply related
* [PATCH 2/5] Add fast connectable to hciops
From: Dmitriy Paliy @ 2010-08-17 14:05 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Dmitriy Paliy
In-Reply-To: <1282053934-19445-1-git-send-email-dmitriy.paliy@nokia.com>
Fast connectable switches between two sets of parameters to enable
or disable fast page scan mode. Page scan interval and page scan
type are changed to speed up connectabily when needed. When
disabled it sets default values. List of btd_adapter_ops is updated
respectively.
---
plugins/hciops.c | 34 ++++++++++++++++++++++++++++++++++
src/adapter.h | 1 +
2 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/plugins/hciops.c b/plugins/hciops.c
index 9c97c5a..652830a 100644
--- a/plugins/hciops.c
+++ b/plugins/hciops.c
@@ -716,6 +716,39 @@ static int hciops_cancel_resolve_name(int index, bdaddr_t *bdaddr)
return err;
}
+static int hciops_fast_connectable(int index, gboolean enable)
+{
+ int dd, err = 0;
+ write_page_activity_cp cp;
+ uint8_t type;
+
+ if (enable) {
+ type = PAGE_SCAN_TYPE_INTERLACED;
+ cp.interval = 0x0024; /* 22.5 msec page scan interval */
+ } else {
+ type = PAGE_SCAN_TYPE_STANDARD; /* default */
+ cp.interval = 0x0800; /* default 1.28 sec page scan */
+ }
+
+ cp.window = 0x0012; /* default 11.25 msec page scan window */
+
+ dd = hci_open_dev(index);
+ if (dd < 0)
+ return -EIO;
+
+ if ( hci_send_cmd(dd, OGF_HOST_CTL, OCF_WRITE_PAGE_ACTIVITY,
+ WRITE_PAGE_ACTIVITY_CP_SIZE, &cp) < 0 ) {
+ err = -errno;
+ } else if ( hci_send_cmd(dd, OGF_HOST_CTL, OCF_WRITE_PAGE_SCAN_TYPE,
+ 1, &type) < 0 ) {
+ err = -errno;
+ }
+
+ hci_close_dev(dd);
+
+ return err;
+}
+
static struct btd_adapter_ops hci_ops = {
.setup = hciops_setup,
.cleanup = hciops_cleanup,
@@ -732,6 +765,7 @@ static struct btd_adapter_ops hci_ops = {
.set_name = hciops_set_name,
.read_name = hciops_read_name,
.set_class = hciops_set_class,
+ .set_fast_connectable = hciops_fast_connectable,
};
static int hciops_init(void)
diff --git a/src/adapter.h b/src/adapter.h
index 58853ac..657e035 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -183,6 +183,7 @@ struct btd_adapter_ops {
int (*set_name) (int index, const char *name);
int (*read_name) (int index);
int (*set_class) (int index, uint32_t class);
+ int (*set_fast_connectable) (int index, gboolean enable);
};
int btd_register_adapter_ops(struct btd_adapter_ops *btd_adapter_ops);
--
1.7.0.4
^ permalink raw reply related
* [PATCH 3/5] Add set fast connectable to adapter
From: Dmitriy Paliy @ 2010-08-17 14:05 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Dmitriy Paliy
In-Reply-To: <1282053934-19445-1-git-send-email-dmitriy.paliy@nokia.com>
Set fast connectable added to adapter interface. Enables or disables
faster page scanning. It does not interfere with any other adapter's
interfaces.
---
src/adapter.c | 12 ++++++++++++
src/adapter.h | 6 ++++++
2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index 4ad4165..b023c01 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -3454,3 +3454,15 @@ void btd_adapter_unregister_powered_callback(struct btd_adapter *adapter,
adapter->powered_callbacks =
g_slist_remove(adapter->powered_callbacks, cb);
}
+
+int btd_adapter_set_fast_connectable(struct btd_adapter *adapter,
+ gboolean enable)
+{
+ if (!adapter_ops)
+ return -EINVAL;
+
+ if (!adapter->up)
+ return -EINVAL;
+
+ return adapter_ops->set_fast_connectable(adapter->dev_id, enable);
+}
diff --git a/src/adapter.h b/src/adapter.h
index 657e035..5352731 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -196,3 +196,9 @@ void btd_adapter_register_powered_callback(struct btd_adapter *adapter,
btd_adapter_powered_cb cb);
void btd_adapter_unregister_powered_callback(struct btd_adapter *adapter,
btd_adapter_powered_cb cb);
+
+/* If TRUE, enables fast connectabe, i.e. reduces page scan interval and changes
+ * type. If FALSE, disables fast connectable, i.e. sets page scan interval and
+ * type to default values. Valid for both connectable and discoverable modes. */
+int btd_adapter_set_fast_connectable(struct btd_adapter *adapter,
+ gboolean enable);
--
1.7.0.4
^ permalink raw reply related
* [PATCH 4/5] Add set fast connectable to audio manager
From: Dmitriy Paliy @ 2010-08-17 14:05 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Dmitriy Paliy
In-Reply-To: <1282053934-19445-1-git-send-email-dmitriy.paliy@nokia.com>
Set fast connectable added to audio manager interface. Enables
fast connectable mode for all audio adapters or sets respective
values to default when disabled. It does not interfere with any
other audio manager's interfaces, modes, or states.
---
audio/manager.c | 14 ++++++++++++++
audio/manager.h | 4 ++++
2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/audio/manager.c b/audio/manager.c
index 6dd0f87..b885929 100644
--- a/audio/manager.c
+++ b/audio/manager.c
@@ -1290,3 +1290,17 @@ gboolean manager_allow_headset_connection(struct audio_device *device)
return TRUE;
}
+
+void manager_set_fast_connectable(gboolean enable)
+{
+ GSList *l;
+
+ for (l = adapters; l != NULL; l = l->next) {
+ struct audio_adapter *adapter = l->data;
+
+ if ( btd_adapter_set_fast_connectable(adapter->btd_adapter,
+ enable) )
+ error("Changing fast connectable for hci%d failed",
+ adapter_get_dev_id(adapter->btd_adapter) );
+ }
+}
diff --git a/audio/manager.h b/audio/manager.h
index 8e1abf4..90fe6f0 100644
--- a/audio/manager.h
+++ b/audio/manager.h
@@ -48,3 +48,7 @@ struct audio_device *manager_get_device(const bdaddr_t *src,
gboolean create);
gboolean manager_allow_headset_connection(struct audio_device *device);
+
+/* TRUE to enable fast connectable and FALSE to disable fast connectable for all
+ * audio adapters. */
+void manager_set_fast_connectable(gboolean enable);
--
1.7.0.4
^ permalink raw reply related
* [PATCH 5/5] Add fast connectable support to HFP
From: Dmitriy Paliy @ 2010-08-17 14:05 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Dmitriy Paliy
In-Reply-To: <1282053934-19445-1-git-send-email-dmitriy.paliy@nokia.com>
Audio.conf is updated to support fast connectable mode. Set
FastConnectable to true to enable and to false to disable. Headset
initialization and call indicators are updated respectively. It is
disabled by default.
---
audio/audio.conf | 7 +++++++
audio/headset.c | 20 ++++++++++++++++++++
2 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/audio/audio.conf b/audio/audio.conf
index a64fb66..302e046 100644
--- a/audio/audio.conf
+++ b/audio/audio.conf
@@ -32,6 +32,13 @@ HFP=true
# Maximum number of connected HSP/HFP devices per adapter. Defaults to 1
MaxConnected=1
+# Set to true to enable use of fast connectable mode (faster page scanning)
+# for HFP when incomming call starts. Default settings are restored after
+# call is answered or rejected. Page scan interval is much shorter and page
+# scan type changed to interlaced. Such allows faster connection initiated
+# by a headset.
+FastConnectable=false
+
# Just an example of potential config options for the other interfaces
#[A2DP]
#SBCSources=1
diff --git a/audio/headset.c b/audio/headset.c
index 99d4c7a..cdb3370 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -95,6 +95,7 @@ static struct {
};
static gboolean sco_hci = TRUE;
+static gboolean fast_connectable = FALSE;
static GSList *active_devices = NULL;
@@ -2262,6 +2263,19 @@ uint32_t headset_config_init(GKeyFile *config)
g_free(str);
}
+ /* Init fast connectable option */
+ str = g_key_file_get_string(config, "Headset", "FastConnectable",
+ &err);
+ if (err) {
+ DBG("audio.conf: %s", err->message);
+ g_clear_error(&err);
+ } else {
+ fast_connectable = strcmp(str, "true") == 0;
+ if (fast_connectable)
+ manager_set_fast_connectable(FALSE);
+ g_free(str);
+ }
+
return ag.features;
}
@@ -2743,6 +2757,9 @@ int telephony_incoming_call_ind(const char *number, int type)
struct headset *hs;
struct headset_slc *slc;
+ if (fast_connectable)
+ manager_set_fast_connectable(TRUE);
+
if (!active_devices)
return -ENODEV;
@@ -2782,6 +2799,9 @@ int telephony_calling_stopped_ind(void)
{
struct audio_device *dev;
+ if (fast_connectable)
+ manager_set_fast_connectable(FALSE);
+
if (ag.ring_timer) {
g_source_remove(ag.ring_timer);
ag.ring_timer = 0;
--
1.7.0.4
^ permalink raw reply related
* Re: [PATCH 1/2] Fix aborting capability scripts making them zombies processes
From: Johan Hedberg @ 2010-08-17 14:18 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1282053510-18102-1-git-send-email-luiz.dentz@gmail.com>
Hi Luiz,
On Tue, Aug 17, 2010, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
>
> When using G_SPAWN_DO_NOT_REAP_CHILD the watch cannot be removed since it
> basically replaces the use of waitpid which does prevent the child
> process to became 'zombie' when terminated, a more detailed explanation
> can be found in waitpid manpage.
> ---
> plugins/filesystem.c | 28 ++++++++++++++++++----------
> 1 files changed, 18 insertions(+), 10 deletions(-)
Thanks. The patch is now upstream.
Johan
^ permalink raw reply
* Re: [PATCH 2/2] gwobex: fix misuse of OBEX_SetCustomData/OBEX_GetCustomData
From: Johan Hedberg @ 2010-08-17 14:19 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1282053510-18102-2-git-send-email-luiz.dentz@gmail.com>
Hi Luiz,
On Tue, Aug 17, 2010, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
>
> Those function should only be used in case of custom transport which is
> not the case since we are using fd transport here.
>
> To fix that it now uses OBEX_SetUserData/OBEX_GetUserData which are not
> associate with any transport in particular.
> ---
> gwobex/gw-obex.c | 2 +-
> gwobex/obex-priv.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
This one has also been pushed to the obexd upstream tree. Also remember
to update the upstream gwobex tree at gitorious.org.
Johan
^ permalink raw reply
* Re: [PATCH 0/5] Fast connectable mode for HFP
From: Johan Hedberg @ 2010-08-17 14:20 UTC (permalink / raw)
To: Dmitriy Paliy; +Cc: linux-bluetooth, marcel
In-Reply-To: <1282053934-19445-1-git-send-email-dmitriy.paliy@nokia.com>
Hi Dmitriy,
On Tue, Aug 17, 2010, Dmitriy Paliy wrote:
> The following patches are implementation of fast connectable mode for HFP.
> Such mode means significantly shorter page scan interval and interlaced
> page scan type. As a result, HFP connection typically is created much faster.
> The fast connectable mode can be activated by incomming call indicator and
> deactivated by answer or reject call indicator. Such speeds up connectability
> of a headset when there is an incomming call. Retransmisions in eSCO are
> possible to be paused for in-band ring tone when the mode is enabled during
> given above period of time. eSCO is not affected during call since page scan
> settings are returned to their default values immidiately after call is
> accepted (or rejected).
>
> Use of the mode can be enabled by changing FastConnectable in audio.conf
> configuration file. It is disabled by default. Also, it doesn't affect and
> doesn't change any other interfaces.
In general these patches seem fine to me, however I'd like a second
opinion from Marcel before pushing upstream.
Johan
^ permalink raw reply
* Re: Support for HCI commands and events related to AMP functionality
From: Johan Hedberg @ 2010-08-17 14:26 UTC (permalink / raw)
To: Inga Stotland; +Cc: linux-bluetooth, rshaffer, marcel
In-Reply-To: <1281485576-32715-1-git-send-email-ingas@codeaurora.org>
Hi Inga,
On Tue, Aug 10, 2010, Inga Stotland wrote:
> Added new HCI commands and events constructs for AMP related development.
> Will be used in updated testing tools for AMP.
Both patches have been pushed upstream. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH v2 1/2] Bluetooth: Option to enable power management from host
From: Johan Hedberg @ 2010-08-17 14:30 UTC (permalink / raw)
To: Suraj Sumangala; +Cc: linux-bluetooth, Jothikumar.Mothilal
In-Reply-To: <1281681408-27376-1-git-send-email-suraj@atheros.com>
Hi,
On Fri, Aug 13, 2010, Suraj Sumangala wrote:
> This provides a new option for hciattach to enable hardware specific
> power management from host.
> This option by default will be disabled for existing devices
> ---
> tools/hciattach.8 | 13 ++++++++
> tools/hciattach.c | 88 ++++++++++++++++++++++++++++++++++++++---------------
> 2 files changed, 76 insertions(+), 25 deletions(-)
This patch has been pushed upstream. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH v2 2/2] Bluetooth: host level Support for Atheros AR300x device
From: Johan Hedberg @ 2010-08-17 14:32 UTC (permalink / raw)
To: Suraj Sumangala; +Cc: linux-bluetooth, Jothikumar.Mothilal
In-Reply-To: <1281681408-27376-2-git-send-email-suraj@atheros.com>
Hi,
On Fri, Aug 13, 2010, Suraj Sumangala wrote:
> Implements support for Atheros AR300x Bluetooth chip in
> hciattach application. Supports configuration download
> and power management configure feature.
> ---
> Makefile.tools | 7 +-
> tools/hciattach.8 | 3 +
> tools/hciattach.c | 105 ++++++
> tools/hciattach.h | 3 +
> tools/hciattach_ar3k.c | 859 ++++++++++++++++++++++++++++++++++++++++++++++++
> 5 files changed, 974 insertions(+), 3 deletions(-)
> create mode 100644 tools/hciattach_ar3k.c
This patch produces several errors:
tools/hciattach_ar3k.c: In function ‘write_ps_cmd’:
tools/hciattach_ar3k.c:196: error: comparison between signed and unsigned integer expressions
tools/hciattach_ar3k.c: In function ‘get_ps_file_name’:
tools/hciattach_ar3k.c:536: error: comparison between signed and unsigned integer expressions
tools/hciattach_ar3k.c: In function ‘get_patch_file_name’:
tools/hciattach_ar3k.c:552: error: comparison between signed and unsigned integer expressions
tools/hciattach_ar3k.c:552: error: comparison between signed and unsigned integer expressions
make[1]: *** [tools/hciattach_ar3k.o] Error 1
Please fix those and always check that your patches compile cleanly with
./bootstrap-configure before sending them upstream. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH 2/5] Add fast connectable to hciops
From: Johan Hedberg @ 2010-08-17 14:41 UTC (permalink / raw)
To: Dmitriy Paliy; +Cc: linux-bluetooth
In-Reply-To: <1282053934-19445-3-git-send-email-dmitriy.paliy@nokia.com>
Hi Dmitry,
On Tue, Aug 17, 2010, Dmitriy Paliy wrote:
> + if ( hci_send_cmd(dd, OGF_HOST_CTL, OCF_WRITE_PAGE_ACTIVITY,
> + WRITE_PAGE_ACTIVITY_CP_SIZE, &cp) < 0 ) {
> + err = -errno;
> + } else if ( hci_send_cmd(dd, OGF_HOST_CTL, OCF_WRITE_PAGE_SCAN_TYPE,
> + 1, &type) < 0 ) {
> + err = -errno;
> + }
A few coding style issues: no braces for one-line if-statements and
remove the spaces after ( and before ) should be removed.
Johan
^ permalink raw reply
* Re: [PATCH 4/5] Add set fast connectable to audio manager
From: Johan Hedberg @ 2010-08-17 14:43 UTC (permalink / raw)
To: Dmitriy Paliy; +Cc: linux-bluetooth
In-Reply-To: <1282053934-19445-5-git-send-email-dmitriy.paliy@nokia.com>
Hi Dmitriy,
On Tue, Aug 17, 2010, Dmitriy Paliy wrote:
> + if ( btd_adapter_set_fast_connectable(adapter->btd_adapter,
> + enable) )
> + error("Changing fast connectable for hci%d failed",
> + adapter_get_dev_id(adapter->btd_adapter) );
> + }
Same coding style issues I already mentioned for the other patch: no
braces for one-line if-statements and no space after ( or before ).
Johan
^ permalink raw reply
* [PATCH 1/1] Bluetooth: Add socket option definitions for AMP
From: Mat Martineau @ 2010-08-17 23:07 UTC (permalink / raw)
To: linux-bluetooth; +Cc: marcel, rshaffer, linux-arm-msm, Mat Martineau
This adds a new BT_AMP socket option to control the use of AMP channels.
It is for use with the SOL_BLUETOOTH option level on L2CAP sockets.
Available option values are defined as:
BT_AMP_REQUIRE_BR_EDR
* Default
* AMP controllers cannot be used
* Channel move requests from the remote device are denied
* If the L2CAP channel is currently using AMP, move the channel to
BR/EDR
BT_AMP_PREFER_AMP
* Allow use of AMP controllers
* If the L2CAP channel is currently on BR/EDR and AMP controller
resources are available, initiate a channel move to AMP
* Channel move requests from the remote device are allowed
* If the L2CAP socket has not been connected yet, try to create
and configure the channel directly on an AMP controller rather
than BR/EDR
BT_AMP_PREFER_BR_EDR
* Allow use of AMP controllers
* If the L2CAP channel is currently on AMP, move it to BR/EDR
* Channel move requests from the remote device are allowed
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
---
include/net/bluetooth/bluetooth.h | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 27a902d..0d41b99 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -64,6 +64,11 @@ struct bt_security {
#define BT_DEFER_SETUP 7
+#define BT_AMP 8
+#define BT_AMP_REQUIRE_BR_EDR 0
+#define BT_AMP_PREFER_AMP 1
+#define BT_AMP_PREFER_BR_EDR 2
+
#define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg)
#define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg)
#define BT_DBG(fmt, arg...) pr_debug("%s: " fmt "\n" , __func__ , ## arg)
--
1.7.1
--
Mat Martineau
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
^ permalink raw reply related
* [PATCH 0/3] Parsing of AMP related HCI commands and events
From: Inga Stotland @ 2010-08-18 3:55 UTC (permalink / raw)
To: linux-bluetooth; +Cc: rshaffer, johan.hedberg, marcel
Added support for interpreting of the following HCI commands:
Create Physical Link,
Accept Physical Link,
Disconnect Physical Link,
Create Logical Link,
Accept Logical Link,
Disconnect Logical Link,
Logical Link Cancel,
Flow Spec Modify,
Read Encryption Key Size,
Read Local AMP Info,
Read Local AMP ASSOC,
Write Remote AMP ASSOC
and HCI events:
Physical Link Complete,
Disconnect Physical Link Complete,
Physical Link Loss Early Warning,
Physical Link Recovery,
Logical Link Complete,
Disconnect Logical Link Complete,
Flow Spec Modify Complete
--
Inga Stotland
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
^ 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