Skip to contentSkip to conversation

Fix error not being propagated properly

PATCH In review Luiz Augusto von Dentz 2 participants 3 messages Mar 5, 2010 – Mar 22, 2010 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 Fix error not being propagated properly

---
 audio/headset.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
audio/headset.c +0 -0
index 0176937..893edd0 100644
@@ -198,7 +198,7 @@ static DBusHandlerResult

error_connection_attempt_failed(DBusConnection *conn,
{
return error_common_reply(conn, msg,
ERROR_INTERFACE ".ConnectionAttemptFailed",
- err > 0 ? strerror(err) : "Connection attempt failed");
+ err < 0 ? strerror(-err) : "Connection attempt failed");
}

static int rfcomm_connect(struct audio_device *device, headset_stream_cb_t cb,
@@ -435,7 +435,7 @@ static void pending_connect_complete(struct connect_cb *cb, struct audio_device
{
struct headset *hs = dev->headset;

- if (hs->pending->err)
+ if (hs->pending->err < 0)
cb->cb(NULL, cb->cb_data);
else
cb->cb(dev, cb->cb_data);

Signature · 6 lines
1.6.3.3


-- 
Luiz Augusto von Dentz
Computer Engineer

From dfcc6b0bfd8ed75630968dbb4967c31f6a0dd39a Mon Sep 17 00:00:00 2001
From: Luiz Augusto Von Dentz <[email protected]>
Date: Fri, 5 Mar 2010 14:19:58 +0200
Subject: [PATCH 10/11] Fix not emitting error properly when sco connection fails

---
 audio/headset.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
audio/headset.c +1 -0
index 15d3672..0176937 100644
@@ -573,6 +573,7 @@ static void sco_connect_cb(GIOChannel *chan, GError *err, gpointer user_data)
 
 	if (err) {
 		error("%s", err->message);
+		p->err = -errno;
 
 		if (p && p->msg)
 			error_connection_attempt_failed(dev->conn, p->msg, p->err);
Signature · 1 line
1.6.3.3
author maintainer
#1 lore raw

Now with the correct patch attached

Quoted 36 lines · Luiz Augusto von Dentz

---
 audio/headset.c |    4 ++--

 1 files changed, 2 insertions(+), 2 deletions(-)
audio/headset.c +1 -1
index 0176937..893edd0 100644
@@ -198,7 +198,7 @@ static DBusHandlerResult
 error_connection_attempt_failed(DBusConnection *conn,
  {
        return error_common_reply(conn, msg,
                        ERROR_INTERFACE ".ConnectionAttemptFailed",
-                       err > 0 ? strerror(err) : "Connection attempt failed");
+                       err < 0 ? strerror(-err) : "Connection attempt failed");
  }
 

 static int rfcomm_connect(struct audio_device *device, headset_stream_cb_t cb,

audio/headset.c +0 -0
@@ -435,7 +435,7 @@ static void pending_connect_complete(struct

connect_cb *cb, struct audio_device
 {
       struct headset *hs = dev->headset;

-       if (hs->pending->err)
+       if (hs->pending->err < 0)
               cb->cb(NULL, cb->cb_data);
       else
               cb->cb(dev, cb->cb_data);
--
1.6.3.3

--
Luiz Augusto von Dentz
Computer Engineer

Signature · 2 lines
Luiz Augusto von Dentz
Computer Engineer

From 5dd57c233aa881faeaa6bfca147abcdb9e04dc93 Mon Sep 17 00:00:00 2001
From: Luiz Augusto Von Dentz <[email protected]>
Date: Fri, 5 Mar 2010 15:01:59 +0200
Subject: [PATCH 11/11] Fix error not being propagated properly

---
 audio/headset.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
audio/headset.c +2 -2
index 0176937..893edd0 100644
@@ -198,7 +198,7 @@ static DBusHandlerResult error_connection_attempt_failed(DBusConnection *conn,
 {
 	return error_common_reply(conn, msg,
 			ERROR_INTERFACE ".ConnectionAttemptFailed",
-			err > 0 ? strerror(err) : "Connection attempt failed");
+			err < 0 ? strerror(-err) : "Connection attempt failed");
 }
 
 static int rfcomm_connect(struct audio_device *device, headset_stream_cb_t cb,
@@ -435,7 +435,7 @@ static void pending_connect_complete(struct connect_cb *cb, struct audio_device
 {
 	struct headset *hs = dev->headset;
 
-	if (hs->pending->err)
+	if (hs->pending->err < 0)
 		cb->cb(NULL, cb->cb_data);
 	else
 		cb->cb(dev, cb->cb_data);
Signature · 1 line
1.6.3.3
#2 lore raw
Quoted 10 lines · Luiz Augusto von Dentz

Now with the correct patch attached

From 5dd57c233aa881faeaa6bfca147abcdb9e04dc93 Mon Sep 17 00:00:00 2001
From: Luiz Augusto Von Dentz <[email protected]>
Date: Fri, 5 Mar 2010 15:01:59 +0200
Subject: [PATCH 11/11] Fix error not being propagated properly

---
 audio/headset.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

The first patch had some issues so I pushed my own fixed up version of it. However, this second patch from you is now pushed (unchanged) upstream.

Johan