* [PATCH v0 0/7] hfp_hf_bluez5: Register Audio Cards in handsfree manager
@ 2013-02-27 17:58 Claudio Takahasi
2013-02-27 17:58 ` [PATCH v0 1/7] handsfree-audio: Switch argument order when creating card Claudio Takahasi
` (7 more replies)
0 siblings, 8 replies; 20+ messages in thread
From: Claudio Takahasi @ 2013-02-27 17:58 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 763 bytes --]
This patch series contains the changes in the hfp_hf_bluez5 plugin to
create/register/remove audio cards.
Claudio Takahasi (7):
handsfree-audio: Switch argument order when creating card
hfp_hf_bluez5: Add registering Audio Card
hfp_hf_bluez5: Add local Bluetooth address to Audio Card
hfp_hf_bluez5: Remove Audio Card when SLC fails
hfp_hf_bluez5: Remove Audio Card when SLC is disconnected
hfp_hf_bluez5: Remove Audio Card when modem is disabled
hfp_hf_bluez5: Remove Audio Card when disconnection is requested
include/handsfree-audio.h | 4 ++--
plugins/hfp_hf_bluez5.c | 42 ++++++++++++++++++++++++++++++++++++++++++
src/handsfree-audio.c | 4 ++--
3 files changed, 46 insertions(+), 4 deletions(-)
--
1.7.11.7
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v0 1/7] handsfree-audio: Switch argument order when creating card
2013-02-27 17:58 [PATCH v0 0/7] hfp_hf_bluez5: Register Audio Cards in handsfree manager Claudio Takahasi
@ 2013-02-27 17:58 ` Claudio Takahasi
2013-02-27 17:58 ` [PATCH v0 2/7] hfp_hf_bluez5: Add registering Audio Card Claudio Takahasi
` (6 subsequent siblings)
7 siblings, 0 replies; 20+ messages in thread
From: Claudio Takahasi @ 2013-02-27 17:58 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1348 bytes --]
Switch local and remote Bluetooth address arguments to follow the same
standard of the Bluetooth functions.
---
include/handsfree-audio.h | 4 ++--
src/handsfree-audio.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/handsfree-audio.h b/include/handsfree-audio.h
index c5403c7..b58f5db 100644
--- a/include/handsfree-audio.h
+++ b/include/handsfree-audio.h
@@ -30,8 +30,8 @@ extern "C" {
struct ofono_handsfree_card;
-struct ofono_handsfree_card *ofono_handsfree_card_create(const char *remote,
- const char *local);
+struct ofono_handsfree_card *ofono_handsfree_card_create(const char *local,
+ const char *remote);
int ofono_handsfree_card_register(struct ofono_handsfree_card *card);
void ofono_handsfree_card_remove(struct ofono_handsfree_card *card);
diff --git a/src/handsfree-audio.c b/src/handsfree-audio.c
index b2d4b97..399bba9 100644
--- a/src/handsfree-audio.c
+++ b/src/handsfree-audio.c
@@ -115,8 +115,8 @@ static const GDBusSignalTable card_signals[] = {
{ }
};
-struct ofono_handsfree_card *ofono_handsfree_card_create(const char *remote,
- const char *local)
+struct ofono_handsfree_card *ofono_handsfree_card_create(const char *local,
+ const char *remote)
{
struct ofono_handsfree_card *card;
--
1.7.11.7
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v0 2/7] hfp_hf_bluez5: Add registering Audio Card
2013-02-27 17:58 [PATCH v0 0/7] hfp_hf_bluez5: Register Audio Cards in handsfree manager Claudio Takahasi
2013-02-27 17:58 ` [PATCH v0 1/7] handsfree-audio: Switch argument order when creating card Claudio Takahasi
@ 2013-02-27 17:58 ` Claudio Takahasi
2013-02-27 17:58 ` [PATCH v0 3/7] hfp_hf_bluez5: Add local Bluetooth address to " Claudio Takahasi
` (5 subsequent siblings)
7 siblings, 0 replies; 20+ messages in thread
From: Claudio Takahasi @ 2013-02-27 17:58 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1896 bytes --]
This patch registers the Handsfree Audio Card when the service level
connection is established.
---
plugins/hfp_hf_bluez5.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index 7057d71..9674635 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -46,6 +46,7 @@
#include <ofono/netreg.h>
#include <ofono/voicecall.h>
#include <ofono/call-volume.h>
+#include <ofono/handsfree-audio.h>
#include <ofono/handsfree.h>
#include <drivers/hfpmodem/slc.h>
@@ -61,6 +62,7 @@
struct hfp {
struct hfp_slc_info info;
DBusMessage *msg;
+ struct ofono_handsfree_card *card;
};
static GDBusClient *bluez = NULL;
@@ -88,6 +90,8 @@ static void slc_established(gpointer userdata)
hfp->msg = NULL;
ofono_info("Service level connection established");
+
+ ofono_handsfree_card_register(hfp->card);
}
static void slc_failed(gpointer userdata)
@@ -315,8 +319,11 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
{
struct hfp *hfp;
struct ofono_modem *modem;
+ struct sockaddr_rc saddr;
+ socklen_t optlen;
DBusMessageIter entry;
const char *device;
+ char remote[18];
int fd, err;
DBG("Profile handler NewConnection");
@@ -353,8 +360,20 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
"Not enough resources");
}
+ memset(&saddr, 0, sizeof(saddr));
+ optlen = sizeof(saddr);
+ if (getpeername(fd, (struct sockaddr *) &saddr, &optlen) < 0) {
+ err = errno;
+ ofono_error("RFCOMM getpeername(): %s (%d)", strerror(err), err);
+ close(fd);
+ goto invalid;
+ }
+
+ bt_ba2str(&saddr.rc_bdaddr, remote);
+
hfp = ofono_modem_get_data(modem);
hfp->msg = dbus_message_ref(msg);
+ hfp->card = ofono_handsfree_card_create(NULL, remote);
return NULL;
--
1.7.11.7
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v0 3/7] hfp_hf_bluez5: Add local Bluetooth address to Audio Card
2013-02-27 17:58 [PATCH v0 0/7] hfp_hf_bluez5: Register Audio Cards in handsfree manager Claudio Takahasi
2013-02-27 17:58 ` [PATCH v0 1/7] handsfree-audio: Switch argument order when creating card Claudio Takahasi
2013-02-27 17:58 ` [PATCH v0 2/7] hfp_hf_bluez5: Add registering Audio Card Claudio Takahasi
@ 2013-02-27 17:58 ` Claudio Takahasi
2013-02-27 17:58 ` [PATCH v0 4/7] hfp_hf_bluez5: Remove Audio Card when SLC fails Claudio Takahasi
` (4 subsequent siblings)
7 siblings, 0 replies; 20+ messages in thread
From: Claudio Takahasi @ 2013-02-27 17:58 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1458 bytes --]
---
plugins/hfp_hf_bluez5.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index 9674635..432e95a 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -323,7 +323,7 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
socklen_t optlen;
DBusMessageIter entry;
const char *device;
- char remote[18];
+ char local[18], remote[18];
int fd, err;
DBG("Profile handler NewConnection");
@@ -362,6 +362,17 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
memset(&saddr, 0, sizeof(saddr));
optlen = sizeof(saddr);
+ if (getsockname(fd, (struct sockaddr *) &saddr, &optlen) < 0) {
+ err = errno;
+ ofono_error("RFCOMM getsockname(): %s (%d)", strerror(err), err);
+ close(fd);
+ goto invalid;
+ }
+
+ bt_ba2str(&saddr.rc_bdaddr, local);
+
+ memset(&saddr, 0, sizeof(saddr));
+ optlen = sizeof(saddr);
if (getpeername(fd, (struct sockaddr *) &saddr, &optlen) < 0) {
err = errno;
ofono_error("RFCOMM getpeername(): %s (%d)", strerror(err), err);
@@ -373,7 +384,7 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
hfp = ofono_modem_get_data(modem);
hfp->msg = dbus_message_ref(msg);
- hfp->card = ofono_handsfree_card_create(NULL, remote);
+ hfp->card = ofono_handsfree_card_create(local, remote);
return NULL;
--
1.7.11.7
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v0 4/7] hfp_hf_bluez5: Remove Audio Card when SLC fails
2013-02-27 17:58 [PATCH v0 0/7] hfp_hf_bluez5: Register Audio Cards in handsfree manager Claudio Takahasi
` (2 preceding siblings ...)
2013-02-27 17:58 ` [PATCH v0 3/7] hfp_hf_bluez5: Add local Bluetooth address to " Claudio Takahasi
@ 2013-02-27 17:58 ` Claudio Takahasi
2013-02-27 17:58 ` [PATCH v0 5/7] hfp_hf_bluez5: Remove Audio Card when SLC is disconnected Claudio Takahasi
` (3 subsequent siblings)
7 siblings, 0 replies; 20+ messages in thread
From: Claudio Takahasi @ 2013-02-27 17:58 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 628 bytes --]
This patch removes the previously created Audio Card if the service
level negotiation fails.
---
plugins/hfp_hf_bluez5.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index 432e95a..bc99107 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -112,6 +112,9 @@ static void slc_failed(gpointer userdata)
ofono_error("Service level connection failed");
ofono_modem_set_powered(modem, FALSE);
+ ofono_handsfree_card_remove(hfp->card);
+ hfp->card = NULL;
+
g_at_chat_unref(info->chat);
info->chat = NULL;
}
--
1.7.11.7
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v0 5/7] hfp_hf_bluez5: Remove Audio Card when SLC is disconnected
2013-02-27 17:58 [PATCH v0 0/7] hfp_hf_bluez5: Register Audio Cards in handsfree manager Claudio Takahasi
` (3 preceding siblings ...)
2013-02-27 17:58 ` [PATCH v0 4/7] hfp_hf_bluez5: Remove Audio Card when SLC fails Claudio Takahasi
@ 2013-02-27 17:58 ` Claudio Takahasi
2013-02-27 17:58 ` [PATCH v0 6/7] hfp_hf_bluez5: Remove Audio Card when modem is disabled Claudio Takahasi
` (2 subsequent siblings)
7 siblings, 0 replies; 20+ messages in thread
From: Claudio Takahasi @ 2013-02-27 17:58 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 622 bytes --]
This patch removes previous registered Audio Card when the remote
Bluetooth device triggers the service level disconnection.
---
plugins/hfp_hf_bluez5.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index bc99107..341d99f 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -129,6 +129,9 @@ static void hfp_disconnected_cb(gpointer user_data)
ofono_modem_set_powered(modem, FALSE);
+ ofono_handsfree_card_remove(hfp->card);
+ hfp->card = NULL;
+
g_at_chat_unref(info->chat);
info->chat = NULL;
}
--
1.7.11.7
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v0 6/7] hfp_hf_bluez5: Remove Audio Card when modem is disabled
2013-02-27 17:58 [PATCH v0 0/7] hfp_hf_bluez5: Register Audio Cards in handsfree manager Claudio Takahasi
` (4 preceding siblings ...)
2013-02-27 17:58 ` [PATCH v0 5/7] hfp_hf_bluez5: Remove Audio Card when SLC is disconnected Claudio Takahasi
@ 2013-02-27 17:58 ` Claudio Takahasi
2013-02-27 17:58 ` [PATCH v0 7/7] hfp_hf_bluez5: Remove Audio Card when disconnection is requested Claudio Takahasi
2013-02-27 20:33 ` [PATCH v1 0/6] hfp_hf_bluez5: Register Audio Cards in handsfree manager Claudio Takahasi
7 siblings, 0 replies; 20+ messages in thread
From: Claudio Takahasi @ 2013-02-27 17:58 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 518 bytes --]
---
plugins/hfp_hf_bluez5.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index 341d99f..93c271b 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -272,6 +272,9 @@ static int hfp_disable(struct ofono_modem *modem)
fd = g_io_channel_unix_get_fd(channel);
shutdown(fd, SHUT_RDWR);
+ ofono_handsfree_card_remove(hfp->card);
+ hfp->card = NULL;
+
g_at_chat_unref(info->chat);
info->chat = NULL;
--
1.7.11.7
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v0 7/7] hfp_hf_bluez5: Remove Audio Card when disconnection is requested
2013-02-27 17:58 [PATCH v0 0/7] hfp_hf_bluez5: Register Audio Cards in handsfree manager Claudio Takahasi
` (5 preceding siblings ...)
2013-02-27 17:58 ` [PATCH v0 6/7] hfp_hf_bluez5: Remove Audio Card when modem is disabled Claudio Takahasi
@ 2013-02-27 17:58 ` Claudio Takahasi
2013-02-27 20:33 ` [PATCH v1 0/6] hfp_hf_bluez5: Register Audio Cards in handsfree manager Claudio Takahasi
7 siblings, 0 replies; 20+ messages in thread
From: Claudio Takahasi @ 2013-02-27 17:58 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 666 bytes --]
For local initiated disconnection the GAtChat disconnect callback is not
called. For this case, Audio Card remove function needs to be called.
---
plugins/hfp_hf_bluez5.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index 93c271b..6ee760e 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -450,6 +450,9 @@ static DBusMessage *profile_disconnection(DBusConnection *conn,
hfp = ofono_modem_get_data(modem);
info = &hfp->info;
+ ofono_handsfree_card_remove(hfp->card);
+ hfp->card = NULL;
+
g_at_chat_unref(info->chat);
info->chat = NULL;
--
1.7.11.7
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v1 0/6] hfp_hf_bluez5: Register Audio Cards in handsfree manager
2013-02-27 17:58 [PATCH v0 0/7] hfp_hf_bluez5: Register Audio Cards in handsfree manager Claudio Takahasi
` (6 preceding siblings ...)
2013-02-27 17:58 ` [PATCH v0 7/7] hfp_hf_bluez5: Remove Audio Card when disconnection is requested Claudio Takahasi
@ 2013-02-27 20:33 ` Claudio Takahasi
2013-02-27 20:33 ` [PATCH v1 1/6] hfp_hf_bluez5: Add registering Audio Card Claudio Takahasi
` (6 more replies)
7 siblings, 7 replies; 20+ messages in thread
From: Claudio Takahasi @ 2013-02-27 20:33 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 691 bytes --]
This patch series contains the changes in the hfp_hf_bluez5 plugin to
create/register/remove audio cards.
Changes from v0-v1:
* Removed commit "Switch argument order when creating card"
Claudio Takahasi (6):
hfp_hf_bluez5: Add registering Audio Card
hfp_hf_bluez5: Add local Bluetooth address to Audio Card
hfp_hf_bluez5: Remove Audio Card when SLC fails
hfp_hf_bluez5: Remove Audio Card when SLC is disconnected
hfp_hf_bluez5: Remove Audio Card when modem is disabled
hfp_hf_bluez5: Remove Audio Card when disconnection is requested
plugins/hfp_hf_bluez5.c | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
--
1.7.11.7
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v1 1/6] hfp_hf_bluez5: Add registering Audio Card
2013-02-27 20:33 ` [PATCH v1 0/6] hfp_hf_bluez5: Register Audio Cards in handsfree manager Claudio Takahasi
@ 2013-02-27 20:33 ` Claudio Takahasi
2013-02-27 20:49 ` Denis Kenzior
2013-02-27 21:03 ` [PATCH v2 " Claudio Takahasi
2013-02-27 20:33 ` [PATCH v1 2/6] hfp_hf_bluez5: Add local Bluetooth address to " Claudio Takahasi
` (5 subsequent siblings)
6 siblings, 2 replies; 20+ messages in thread
From: Claudio Takahasi @ 2013-02-27 20:33 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1896 bytes --]
This patch registers the Handsfree Audio Card when the service level
connection is established.
---
plugins/hfp_hf_bluez5.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index 7057d71..436d98c 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -46,6 +46,7 @@
#include <ofono/netreg.h>
#include <ofono/voicecall.h>
#include <ofono/call-volume.h>
+#include <ofono/handsfree-audio.h>
#include <ofono/handsfree.h>
#include <drivers/hfpmodem/slc.h>
@@ -61,6 +62,7 @@
struct hfp {
struct hfp_slc_info info;
DBusMessage *msg;
+ struct ofono_handsfree_card *card;
};
static GDBusClient *bluez = NULL;
@@ -88,6 +90,8 @@ static void slc_established(gpointer userdata)
hfp->msg = NULL;
ofono_info("Service level connection established");
+
+ ofono_handsfree_card_register(hfp->card);
}
static void slc_failed(gpointer userdata)
@@ -315,8 +319,11 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
{
struct hfp *hfp;
struct ofono_modem *modem;
+ struct sockaddr_rc saddr;
+ socklen_t optlen;
DBusMessageIter entry;
const char *device;
+ char remote[18];
int fd, err;
DBG("Profile handler NewConnection");
@@ -353,8 +360,20 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
"Not enough resources");
}
+ memset(&saddr, 0, sizeof(saddr));
+ optlen = sizeof(saddr);
+ if (getpeername(fd, (struct sockaddr *) &saddr, &optlen) < 0) {
+ err = errno;
+ ofono_error("RFCOMM getpeername(): %s (%d)", strerror(err), err);
+ close(fd);
+ goto invalid;
+ }
+
+ bt_ba2str(&saddr.rc_bdaddr, remote);
+
hfp = ofono_modem_get_data(modem);
hfp->msg = dbus_message_ref(msg);
+ hfp->card = ofono_handsfree_card_create(remote, NULL);
return NULL;
--
1.7.11.7
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v1 2/6] hfp_hf_bluez5: Add local Bluetooth address to Audio Card
2013-02-27 20:33 ` [PATCH v1 0/6] hfp_hf_bluez5: Register Audio Cards in handsfree manager Claudio Takahasi
2013-02-27 20:33 ` [PATCH v1 1/6] hfp_hf_bluez5: Add registering Audio Card Claudio Takahasi
@ 2013-02-27 20:33 ` Claudio Takahasi
2013-02-27 21:02 ` [PATCH v2 " Claudio Takahasi
2013-02-27 20:33 ` [PATCH v1 3/6] hfp_hf_bluez5: Remove Audio Card when SLC fails Claudio Takahasi
` (4 subsequent siblings)
6 siblings, 1 reply; 20+ messages in thread
From: Claudio Takahasi @ 2013-02-27 20:33 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1458 bytes --]
---
plugins/hfp_hf_bluez5.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index 436d98c..97d2f07 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -323,7 +323,7 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
socklen_t optlen;
DBusMessageIter entry;
const char *device;
- char remote[18];
+ char local[18], remote[18];
int fd, err;
DBG("Profile handler NewConnection");
@@ -362,6 +362,17 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
memset(&saddr, 0, sizeof(saddr));
optlen = sizeof(saddr);
+ if (getsockname(fd, (struct sockaddr *) &saddr, &optlen) < 0) {
+ err = errno;
+ ofono_error("RFCOMM getsockname(): %s (%d)", strerror(err), err);
+ close(fd);
+ goto invalid;
+ }
+
+ bt_ba2str(&saddr.rc_bdaddr, local);
+
+ memset(&saddr, 0, sizeof(saddr));
+ optlen = sizeof(saddr);
if (getpeername(fd, (struct sockaddr *) &saddr, &optlen) < 0) {
err = errno;
ofono_error("RFCOMM getpeername(): %s (%d)", strerror(err), err);
@@ -373,7 +384,7 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
hfp = ofono_modem_get_data(modem);
hfp->msg = dbus_message_ref(msg);
- hfp->card = ofono_handsfree_card_create(remote, NULL);
+ hfp->card = ofono_handsfree_card_create(remote, local);
return NULL;
--
1.7.11.7
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v1 3/6] hfp_hf_bluez5: Remove Audio Card when SLC fails
2013-02-27 20:33 ` [PATCH v1 0/6] hfp_hf_bluez5: Register Audio Cards in handsfree manager Claudio Takahasi
2013-02-27 20:33 ` [PATCH v1 1/6] hfp_hf_bluez5: Add registering Audio Card Claudio Takahasi
2013-02-27 20:33 ` [PATCH v1 2/6] hfp_hf_bluez5: Add local Bluetooth address to " Claudio Takahasi
@ 2013-02-27 20:33 ` Claudio Takahasi
2013-02-27 20:33 ` [PATCH v1 4/6] hfp_hf_bluez5: Remove Audio Card when SLC is disconnected Claudio Takahasi
` (3 subsequent siblings)
6 siblings, 0 replies; 20+ messages in thread
From: Claudio Takahasi @ 2013-02-27 20:33 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 628 bytes --]
This patch removes the previously created Audio Card if the service
level negotiation fails.
---
plugins/hfp_hf_bluez5.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index 97d2f07..359c8fd 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -112,6 +112,9 @@ static void slc_failed(gpointer userdata)
ofono_error("Service level connection failed");
ofono_modem_set_powered(modem, FALSE);
+ ofono_handsfree_card_remove(hfp->card);
+ hfp->card = NULL;
+
g_at_chat_unref(info->chat);
info->chat = NULL;
}
--
1.7.11.7
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v1 4/6] hfp_hf_bluez5: Remove Audio Card when SLC is disconnected
2013-02-27 20:33 ` [PATCH v1 0/6] hfp_hf_bluez5: Register Audio Cards in handsfree manager Claudio Takahasi
` (2 preceding siblings ...)
2013-02-27 20:33 ` [PATCH v1 3/6] hfp_hf_bluez5: Remove Audio Card when SLC fails Claudio Takahasi
@ 2013-02-27 20:33 ` Claudio Takahasi
2013-02-27 20:33 ` [PATCH v1 5/6] hfp_hf_bluez5: Remove Audio Card when modem is disabled Claudio Takahasi
` (2 subsequent siblings)
6 siblings, 0 replies; 20+ messages in thread
From: Claudio Takahasi @ 2013-02-27 20:33 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 622 bytes --]
This patch removes previous registered Audio Card when the remote
Bluetooth device triggers the service level disconnection.
---
plugins/hfp_hf_bluez5.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index 359c8fd..c3acd40 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -129,6 +129,9 @@ static void hfp_disconnected_cb(gpointer user_data)
ofono_modem_set_powered(modem, FALSE);
+ ofono_handsfree_card_remove(hfp->card);
+ hfp->card = NULL;
+
g_at_chat_unref(info->chat);
info->chat = NULL;
}
--
1.7.11.7
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v1 5/6] hfp_hf_bluez5: Remove Audio Card when modem is disabled
2013-02-27 20:33 ` [PATCH v1 0/6] hfp_hf_bluez5: Register Audio Cards in handsfree manager Claudio Takahasi
` (3 preceding siblings ...)
2013-02-27 20:33 ` [PATCH v1 4/6] hfp_hf_bluez5: Remove Audio Card when SLC is disconnected Claudio Takahasi
@ 2013-02-27 20:33 ` Claudio Takahasi
2013-02-27 20:33 ` [PATCH v1 6/6] hfp_hf_bluez5: Remove Audio Card when disconnection is requested Claudio Takahasi
2013-02-28 16:00 ` [PATCH v3 0/6] hfp_hf_bluez5: Register Audio Cards in handsfree manager Claudio Takahasi
6 siblings, 0 replies; 20+ messages in thread
From: Claudio Takahasi @ 2013-02-27 20:33 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 518 bytes --]
---
plugins/hfp_hf_bluez5.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index c3acd40..fb1644f 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -272,6 +272,9 @@ static int hfp_disable(struct ofono_modem *modem)
fd = g_io_channel_unix_get_fd(channel);
shutdown(fd, SHUT_RDWR);
+ ofono_handsfree_card_remove(hfp->card);
+ hfp->card = NULL;
+
g_at_chat_unref(info->chat);
info->chat = NULL;
--
1.7.11.7
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v1 6/6] hfp_hf_bluez5: Remove Audio Card when disconnection is requested
2013-02-27 20:33 ` [PATCH v1 0/6] hfp_hf_bluez5: Register Audio Cards in handsfree manager Claudio Takahasi
` (4 preceding siblings ...)
2013-02-27 20:33 ` [PATCH v1 5/6] hfp_hf_bluez5: Remove Audio Card when modem is disabled Claudio Takahasi
@ 2013-02-27 20:33 ` Claudio Takahasi
2013-02-28 16:00 ` [PATCH v3 0/6] hfp_hf_bluez5: Register Audio Cards in handsfree manager Claudio Takahasi
6 siblings, 0 replies; 20+ messages in thread
From: Claudio Takahasi @ 2013-02-27 20:33 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 666 bytes --]
For local initiated disconnection the GAtChat disconnect callback is not
called. For this case, Audio Card remove function needs to be called.
---
plugins/hfp_hf_bluez5.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index fb1644f..c7807bb 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -450,6 +450,9 @@ static DBusMessage *profile_disconnection(DBusConnection *conn,
hfp = ofono_modem_get_data(modem);
info = &hfp->info;
+ ofono_handsfree_card_remove(hfp->card);
+ hfp->card = NULL;
+
g_at_chat_unref(info->chat);
info->chat = NULL;
--
1.7.11.7
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH v1 1/6] hfp_hf_bluez5: Add registering Audio Card
2013-02-27 20:33 ` [PATCH v1 1/6] hfp_hf_bluez5: Add registering Audio Card Claudio Takahasi
@ 2013-02-27 20:49 ` Denis Kenzior
2013-02-27 21:03 ` [PATCH v2 " Claudio Takahasi
1 sibling, 0 replies; 20+ messages in thread
From: Denis Kenzior @ 2013-02-27 20:49 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2214 bytes --]
Hi Claudio,
On 02/27/2013 02:33 PM, Claudio Takahasi wrote:
> This patch registers the Handsfree Audio Card when the service level
> connection is established.
> ---
> plugins/hfp_hf_bluez5.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
> index 7057d71..436d98c 100644
> --- a/plugins/hfp_hf_bluez5.c
> +++ b/plugins/hfp_hf_bluez5.c
> @@ -46,6 +46,7 @@
> #include<ofono/netreg.h>
> #include<ofono/voicecall.h>
> #include<ofono/call-volume.h>
> +#include<ofono/handsfree-audio.h>
> #include<ofono/handsfree.h>
>
> #include<drivers/hfpmodem/slc.h>
> @@ -61,6 +62,7 @@
> struct hfp {
> struct hfp_slc_info info;
> DBusMessage *msg;
> + struct ofono_handsfree_card *card;
> };
>
> static GDBusClient *bluez = NULL;
> @@ -88,6 +90,8 @@ static void slc_established(gpointer userdata)
> hfp->msg = NULL;
>
> ofono_info("Service level connection established");
> +
> + ofono_handsfree_card_register(hfp->card);
> }
>
> static void slc_failed(gpointer userdata)
> @@ -315,8 +319,11 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
> {
> struct hfp *hfp;
> struct ofono_modem *modem;
> + struct sockaddr_rc saddr;
> + socklen_t optlen;
> DBusMessageIter entry;
> const char *device;
> + char remote[18];
> int fd, err;
>
> DBG("Profile handler NewConnection");
> @@ -353,8 +360,20 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
> "Not enough resources");
> }
>
> + memset(&saddr, 0, sizeof(saddr));
> + optlen = sizeof(saddr);
> + if (getpeername(fd, (struct sockaddr *)&saddr,&optlen)< 0) {
Please fix this according to doc/coding-style.txt Item M1 1)
> + err = errno;
> + ofono_error("RFCOMM getpeername(): %s (%d)", strerror(err), err);
This part seems to be over 80 characters
> + close(fd);
> + goto invalid;
> + }
> +
> + bt_ba2str(&saddr.rc_bdaddr, remote);
> +
> hfp = ofono_modem_get_data(modem);
> hfp->msg = dbus_message_ref(msg);
> + hfp->card = ofono_handsfree_card_create(remote, NULL);
>
> return NULL;
>
Regards,
-Denis
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v2 2/6] hfp_hf_bluez5: Add local Bluetooth address to Audio Card
2013-02-27 20:33 ` [PATCH v1 2/6] hfp_hf_bluez5: Add local Bluetooth address to " Claudio Takahasi
@ 2013-02-27 21:02 ` Claudio Takahasi
0 siblings, 0 replies; 20+ messages in thread
From: Claudio Takahasi @ 2013-02-27 21:02 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1464 bytes --]
---
plugins/hfp_hf_bluez5.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index dbb1303..ac2ed61 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -323,7 +323,7 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
socklen_t optlen;
DBusMessageIter entry;
const char *device;
- char remote[18];
+ char local[18], remote[18];
int fd, err;
DBG("Profile handler NewConnection");
@@ -362,6 +362,18 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
memset(&saddr, 0, sizeof(saddr));
optlen = sizeof(saddr);
+ if (getsockname(fd, (struct sockaddr *) &saddr, &optlen) < 0) {
+ err = errno;
+ ofono_error("RFCOMM getsockname(): %s (%d)", strerror(err),
+ err);
+ close(fd);
+ goto invalid;
+ }
+
+ bt_ba2str(&saddr.rc_bdaddr, local);
+
+ memset(&saddr, 0, sizeof(saddr));
+ optlen = sizeof(saddr);
if (getpeername(fd, (struct sockaddr *) &saddr, &optlen) < 0) {
err = errno;
ofono_error("RFCOMM getpeername(): %s (%d)", strerror(err),
@@ -374,7 +386,7 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
hfp = ofono_modem_get_data(modem);
hfp->msg = dbus_message_ref(msg);
- hfp->card = ofono_handsfree_card_create(remote, NULL);
+ hfp->card = ofono_handsfree_card_create(remote, local);
return NULL;
--
1.7.11.7
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 1/6] hfp_hf_bluez5: Add registering Audio Card
2013-02-27 20:33 ` [PATCH v1 1/6] hfp_hf_bluez5: Add registering Audio Card Claudio Takahasi
2013-02-27 20:49 ` Denis Kenzior
@ 2013-02-27 21:03 ` Claudio Takahasi
1 sibling, 0 replies; 20+ messages in thread
From: Claudio Takahasi @ 2013-02-27 21:03 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1908 bytes --]
This patch registers the Handsfree Audio Card when the service level
connection is established.
---
plugins/hfp_hf_bluez5.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index 7057d71..dbb1303 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -46,6 +46,7 @@
#include <ofono/netreg.h>
#include <ofono/voicecall.h>
#include <ofono/call-volume.h>
+#include <ofono/handsfree-audio.h>
#include <ofono/handsfree.h>
#include <drivers/hfpmodem/slc.h>
@@ -61,6 +62,7 @@
struct hfp {
struct hfp_slc_info info;
DBusMessage *msg;
+ struct ofono_handsfree_card *card;
};
static GDBusClient *bluez = NULL;
@@ -88,6 +90,8 @@ static void slc_established(gpointer userdata)
hfp->msg = NULL;
ofono_info("Service level connection established");
+
+ ofono_handsfree_card_register(hfp->card);
}
static void slc_failed(gpointer userdata)
@@ -315,8 +319,11 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
{
struct hfp *hfp;
struct ofono_modem *modem;
+ struct sockaddr_rc saddr;
+ socklen_t optlen;
DBusMessageIter entry;
const char *device;
+ char remote[18];
int fd, err;
DBG("Profile handler NewConnection");
@@ -353,8 +360,21 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
"Not enough resources");
}
+ memset(&saddr, 0, sizeof(saddr));
+ optlen = sizeof(saddr);
+ if (getpeername(fd, (struct sockaddr *) &saddr, &optlen) < 0) {
+ err = errno;
+ ofono_error("RFCOMM getpeername(): %s (%d)", strerror(err),
+ err);
+ close(fd);
+ goto invalid;
+ }
+
+ bt_ba2str(&saddr.rc_bdaddr, remote);
+
hfp = ofono_modem_get_data(modem);
hfp->msg = dbus_message_ref(msg);
+ hfp->card = ofono_handsfree_card_create(remote, NULL);
return NULL;
--
1.7.11.7
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 0/6] hfp_hf_bluez5: Register Audio Cards in handsfree manager
2013-02-27 20:33 ` [PATCH v1 0/6] hfp_hf_bluez5: Register Audio Cards in handsfree manager Claudio Takahasi
` (5 preceding siblings ...)
2013-02-27 20:33 ` [PATCH v1 6/6] hfp_hf_bluez5: Remove Audio Card when disconnection is requested Claudio Takahasi
@ 2013-02-28 16:00 ` Claudio Takahasi
2013-02-28 16:11 ` Denis Kenzior
6 siblings, 1 reply; 20+ messages in thread
From: Claudio Takahasi @ 2013-02-28 16:00 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 867 bytes --]
This patch series contains the changes in the hfp_hf_bluez5 plugin to
create/register/remove audio cards.
Changes between v0-v1:
* Removed commit "Switch argument order when creating card"
Changes between v1-v2:
* Fixed coding style: 80 character limit
Changes between v2-v3:
* Fixed M5: Git commit message 50/72 formatting
* Fixed M1: Blank line before and after an if/while/do/for statement
Claudio Takahasi (6):
hfp_hf_bluez5: Add registering Audio Card
hfp_hf_bluez5: Add local address to Audio Card
hfp_hf_bluez5: Remove Card when SLC fails
hfp_hf_bluez5: Remove Card if SLC is disconnected
hfp_hf_bluez5: Remove Card when modem is disabled
hfp_hf_bluez5: Remove Card on RequestDisconnection
plugins/hfp_hf_bluez5.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
--
1.7.11.7
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v3 0/6] hfp_hf_bluez5: Register Audio Cards in handsfree manager
2013-02-28 16:00 ` [PATCH v3 0/6] hfp_hf_bluez5: Register Audio Cards in handsfree manager Claudio Takahasi
@ 2013-02-28 16:11 ` Denis Kenzior
0 siblings, 0 replies; 20+ messages in thread
From: Denis Kenzior @ 2013-02-28 16:11 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1041 bytes --]
Hi Claudio,
On 02/28/2013 10:00 AM, Claudio Takahasi wrote:
> This patch series contains the changes in the hfp_hf_bluez5 plugin to
> create/register/remove audio cards.
>
> Changes between v0-v1:
> * Removed commit "Switch argument order when creating card"
>
> Changes between v1-v2:
> * Fixed coding style: 80 character limit
>
> Changes between v2-v3:
> * Fixed M5: Git commit message 50/72 formatting
> * Fixed M1: Blank line before and after an if/while/do/for statement
>
> Claudio Takahasi (6):
> hfp_hf_bluez5: Add registering Audio Card
> hfp_hf_bluez5: Add local address to Audio Card
> hfp_hf_bluez5: Remove Card when SLC fails
> hfp_hf_bluez5: Remove Card if SLC is disconnected
> hfp_hf_bluez5: Remove Card when modem is disabled
> hfp_hf_bluez5: Remove Card on RequestDisconnection
>
> plugins/hfp_hf_bluez5.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 46 insertions(+)
>
All patches in this series have been applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2013-02-28 16:11 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-27 17:58 [PATCH v0 0/7] hfp_hf_bluez5: Register Audio Cards in handsfree manager Claudio Takahasi
2013-02-27 17:58 ` [PATCH v0 1/7] handsfree-audio: Switch argument order when creating card Claudio Takahasi
2013-02-27 17:58 ` [PATCH v0 2/7] hfp_hf_bluez5: Add registering Audio Card Claudio Takahasi
2013-02-27 17:58 ` [PATCH v0 3/7] hfp_hf_bluez5: Add local Bluetooth address to " Claudio Takahasi
2013-02-27 17:58 ` [PATCH v0 4/7] hfp_hf_bluez5: Remove Audio Card when SLC fails Claudio Takahasi
2013-02-27 17:58 ` [PATCH v0 5/7] hfp_hf_bluez5: Remove Audio Card when SLC is disconnected Claudio Takahasi
2013-02-27 17:58 ` [PATCH v0 6/7] hfp_hf_bluez5: Remove Audio Card when modem is disabled Claudio Takahasi
2013-02-27 17:58 ` [PATCH v0 7/7] hfp_hf_bluez5: Remove Audio Card when disconnection is requested Claudio Takahasi
2013-02-27 20:33 ` [PATCH v1 0/6] hfp_hf_bluez5: Register Audio Cards in handsfree manager Claudio Takahasi
2013-02-27 20:33 ` [PATCH v1 1/6] hfp_hf_bluez5: Add registering Audio Card Claudio Takahasi
2013-02-27 20:49 ` Denis Kenzior
2013-02-27 21:03 ` [PATCH v2 " Claudio Takahasi
2013-02-27 20:33 ` [PATCH v1 2/6] hfp_hf_bluez5: Add local Bluetooth address to " Claudio Takahasi
2013-02-27 21:02 ` [PATCH v2 " Claudio Takahasi
2013-02-27 20:33 ` [PATCH v1 3/6] hfp_hf_bluez5: Remove Audio Card when SLC fails Claudio Takahasi
2013-02-27 20:33 ` [PATCH v1 4/6] hfp_hf_bluez5: Remove Audio Card when SLC is disconnected Claudio Takahasi
2013-02-27 20:33 ` [PATCH v1 5/6] hfp_hf_bluez5: Remove Audio Card when modem is disabled Claudio Takahasi
2013-02-27 20:33 ` [PATCH v1 6/6] hfp_hf_bluez5: Remove Audio Card when disconnection is requested Claudio Takahasi
2013-02-28 16:00 ` [PATCH v3 0/6] hfp_hf_bluez5: Register Audio Cards in handsfree manager Claudio Takahasi
2013-02-28 16:11 ` Denis Kenzior
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.