Skip to contentSkip to conversation

move hcid to use common exceptions

PATCH In review [email protected] 1 participant 1 message Oct 28, 2007 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 move hcid to use common exceptions

This part is for hcid

Fabien

hcid/adapter.c +115 -114
diff -x Entries -u -r -N utils/hcid/adapter.c utils2/hcid/adapter.c
@@ -60,6 +60,7 @@
 #include "dbus-hci.h"
 #include "dbus-sdp.h"
 #include "dbus-error.h"
+#include "common-error.h"
 
 #define NUM_ELEMENTS(table) (sizeof(table)/sizeof(const char *))
 
@@ -365,7 +366,7 @@
 	DBusMessage *reply;
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
@@ -386,11 +387,11 @@
 	int err;
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	err = get_device_version(adapter->dev_id, str, sizeof(str));
 	if (err < 0)
-		return error_failed(conn, msg, -err);
+		return error_failed_errno(conn, msg, -err);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
@@ -411,11 +412,11 @@
 	int err;
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	err = get_device_revision(adapter->dev_id, str, sizeof(str));
 	if (err < 0)
-		return error_failed(conn, msg, -err);
+		return error_failed_errno(conn, msg, -err);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
@@ -436,11 +437,11 @@
 	int err;
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	err = get_device_manufacturer(adapter->dev_id, str, sizeof(str));
 	if (err < 0)
-		return error_failed(conn, msg, -err);
+		return error_failed_errno(conn, msg, -err);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
@@ -461,11 +462,11 @@
 	int err;
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	err = get_device_company(adapter->dev_id, str, sizeof(str));
 	if (err < 0)
-		return error_failed(conn, msg, -err);
+		return error_failed_errno(conn, msg, -err);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
@@ -487,7 +488,7 @@
 	int i;
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
@@ -513,7 +514,7 @@
 	const char *mode;
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
@@ -542,10 +543,10 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &mode,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (!mode)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	new_mode = str2mode(adapter->address, mode);
 	switch(new_mode) {
@@ -560,7 +561,7 @@
 		scan_enable = (SCAN_PAGE | SCAN_INQUIRY);
 		break;
 	default:
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 	}
 
 	/* Do reverse resolution in case of "on" mode */
@@ -584,7 +585,7 @@
 				adapter->dev_id, strerror(errno), errno);
 
 			hci_close_dev(dd);
-			return error_failed(conn, msg, err);
+			return error_failed_errno(conn, msg, err);
 		}
 	}
 
@@ -592,7 +593,7 @@
 			hcid.offmode == HCID_OFFMODE_DEVDOWN) {
 		if (ioctl(dd, HCIDEVDOWN, adapter->dev_id) < 0) {
 			hci_close_dev(dd);
-			return error_failed(conn, msg, errno);
+			return error_failed_errno(conn, msg, errno);
 		}
 
 		goto done;
@@ -602,7 +603,7 @@
 	err = set_limited_discoverable(dd, adapter->class, limited);
 	if (err < 0) {
 		hci_close_dev(dd);
-		return error_failed(conn, msg, -err);
+		return error_failed_errno(conn, msg, -err);
 	}
 
 	if (current_scan != scan_enable) {
@@ -623,14 +624,14 @@
 			error("Sending write scan enable command failed: %s (%d)",
 					strerror(errno), errno);
 			hci_close_dev(dd);
-			return error_failed(conn, msg, err);
+			return error_failed_errno(conn, msg, err);
 		}
 
 		if (status) {
 			error("Setting scan enable failed with status 0x%02x",
 					status);
 			hci_close_dev(dd);
-			return error_failed(conn, msg, bt_error(status));
+			return error_failed_errno(conn, msg, bt_error(status));
 		}
 	} else {
 		/* discoverable or limited */
@@ -673,7 +674,7 @@
 	DBusMessage *reply;
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
@@ -700,7 +701,7 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_UINT32, &timeout,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
@@ -739,7 +740,7 @@
 	dbus_bool_t connectable = FALSE;
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (scan_enable & SCAN_PAGE)
 		connectable = TRUE;
@@ -763,7 +764,7 @@
 	dbus_bool_t discoverable = FALSE;
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (scan_enable & SCAN_INQUIRY)
 		discoverable = TRUE;
@@ -793,10 +794,10 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &peer_addr,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (check_address(peer_addr) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	str2ba(peer_addr, &peer_bdaddr);
 
@@ -824,7 +825,7 @@
 	GSList *l = adapter->active_conn;
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
@@ -860,7 +861,7 @@
 	const char *str_ptr = "computer";
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
@@ -888,7 +889,7 @@
 	int size, i;
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	major_class = adapter->class[1] & 0x1F;
 
@@ -930,7 +931,7 @@
 	uint8_t minor_class;
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	/* FIXME: Currently, only computer major class is supported */
 	if ((adapter->class[1] & 0x1f) != 1)
@@ -970,10 +971,10 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &minor,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (!minor)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	dd = hci_open_dev(adapter->dev_id);
 	if (dd < 0)
@@ -994,7 +995,7 @@
 	/* Check if it's a valid minor class */
 	if (dev_class == 0xFFFFFFFF) {
 		hci_close_dev(dd);
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 	}
 
 	/* set the service class and major class  */
@@ -1005,7 +1006,7 @@
 		error("Can't write class of device on hci%d: %s(%d)",
 				adapter->dev_id, strerror(errno), errno);
 		hci_close_dev(dd);
-		return error_failed(conn, msg, err);
+		return error_failed_errno(conn, msg, err);
 	}
 
 	dbus_connection_emit_signal(conn, dbus_message_get_path(msg),
@@ -1035,7 +1036,7 @@
 		return error_not_ready(conn, msg);
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
@@ -1069,7 +1070,7 @@
 	bdaddr_t ba;
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	str2ba(adapter->address, &ba);
 
@@ -1080,7 +1081,7 @@
 
 		err = get_device_name(adapter->dev_id, str, sizeof(str));
 		if (err < 0)
-			return error_failed(conn, msg, -err);
+			return error_failed_errno(conn, msg, -err);
 	}
 
 	reply = dbus_message_new_method_return(msg);
@@ -1105,11 +1106,11 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &str_ptr,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (!g_utf8_validate(str_ptr, -1, NULL)) {
 		error("Name change failed: the supplied name isn't valid UTF-8");
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 	}
 
 	str2ba(adapter->address, &bdaddr);
@@ -1121,7 +1122,7 @@
 
 	ecode = set_device_name(adapter->dev_id, str_ptr);
 	if (ecode < 0)
-		return error_failed(conn, msg, -ecode);
+		return error_failed_errno(conn, msg, -ecode);
 
 done:
 	reply = dbus_message_new_method_return(msg);
@@ -1151,10 +1152,10 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &addr_ptr,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (check_address(addr_ptr) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
@@ -1333,10 +1334,10 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &addr_ptr,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (check_address(addr_ptr) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	create_name(filename, PATH_MAX, STORAGEDIR, adapter->address,
 			"manufacturers");
@@ -1405,10 +1406,10 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &addr_ptr,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (check_address(addr_ptr) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
@@ -1448,10 +1449,10 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &addr_ptr,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (check_address(addr_ptr) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	create_name(filename, PATH_MAX, STORAGEDIR, adapter->address,
 			"manufacturers");
@@ -1485,7 +1486,7 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &str_bdaddr,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	str2ba(str_bdaddr, &bdaddr);
 	ba2oui(&bdaddr, oui);
@@ -1519,12 +1520,12 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &addr_peer,
 				DBUS_TYPE_INVALID)) {
-		error_invalid_arguments(conn, msg);
+		error_invalid_arguments(conn, msg, NULL);
 		return -1;
 	}
 
 	if (check_address(addr_peer) < 0) {
-		error_invalid_arguments(conn, msg);
+		error_invalid_arguments(conn, msg, NULL);
 		return -1;
 	}
 
@@ -1657,10 +1658,10 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &addr,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (check_address(addr) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	create_name(filename, PATH_MAX, STORAGEDIR, adapter->address, "features");
 
@@ -1711,10 +1712,10 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &peer_addr,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (check_address(peer_addr) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	/* check if it is in the cache */
 	create_name(filename, PATH_MAX, STORAGEDIR, adapter->address, "names");
@@ -1762,10 +1763,10 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &addr_ptr,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (check_address(addr_ptr) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	str2ba(addr_ptr, &bdaddr);
 
@@ -1796,18 +1797,18 @@
 				DBUS_TYPE_STRING, &addr,
 				DBUS_TYPE_STRING, &alias,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if ((strlen(alias) == 0) || (check_address(addr) < 0)) {
 		error("Alias change failed: Invalid parameter");
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 	}
 
 	str2ba(addr, &bdaddr);
 
 	ecode = set_device_alias(adapter->dev_id, &bdaddr, alias);
 	if (ecode < 0)
-		return error_failed(conn, msg, -ecode);
+		return error_failed_errno(conn, msg, -ecode);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
@@ -1834,11 +1835,11 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &addr_ptr,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (check_address(addr_ptr) < 0) {
 		error("Alias clear failed: Invalid parameter");
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 	}
 
 	str2ba(addr_ptr, &bdaddr);
@@ -1849,7 +1850,7 @@
 
 	ecode = set_device_alias(adapter->dev_id, &bdaddr, NULL);
 	if (ecode < 0)
-		return error_failed(conn, msg, -ecode);
+		return error_failed_errno(conn, msg, -ecode);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
@@ -1876,10 +1877,10 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &addr_ptr,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (check_address(addr_ptr) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	create_name(filename, PATH_MAX, STORAGEDIR, adapter->address,
 			"lastseen");
@@ -1913,10 +1914,10 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &addr_ptr,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (check_address(addr_ptr) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	create_name(filename, PATH_MAX, STORAGEDIR, adapter->address,
 			"lastused");
@@ -1962,7 +1963,7 @@
 			   	500) < 0) {
 		int err = errno;
 		error("Disconnect failed");
-		error_failed(pending_dc->conn, pending_dc->msg, err);
+		error_failed_errno(pending_dc->conn, pending_dc->msg, err);
 	} else {
 		reply = dbus_message_new_method_return(pending_dc->msg);
 		if (!reply)
@@ -1999,10 +2000,10 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &peer_addr,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (check_address(peer_addr) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	str2ba(peer_addr, &peer_bdaddr);
 
@@ -2097,7 +2098,7 @@
 	if (getsockopt(sk, SOL_SOCKET, SO_ERROR, &ret, &len) < 0) {
 		error("Can't get socket error: %s (%d)",
 				strerror(errno), errno);
-		error_failed(adapter->bonding->conn, adapter->bonding->rq,
+		error_failed_errno(adapter->bonding->conn, adapter->bonding->rq,
 				errno);
 		goto failed;
 	}
@@ -2116,7 +2117,7 @@
 	if (getsockopt(sk, SOL_L2CAP, L2CAP_CONNINFO, &cinfo, &len) < 0) {
 		error("Can't get connection info: %s (%d)",
 				strerror(errno), errno);
-		error_failed(adapter->bonding->conn, adapter->bonding->rq,
+		error_failed_errno(adapter->bonding->conn, adapter->bonding->rq,
 				errno);
 		goto failed;
 	}
@@ -2145,7 +2146,7 @@
 	if (hci_send_req(dd, &rq, 500) < 0) {
 		error("Unable to send HCI request: %s (%d)",
 					strerror(errno), errno);
-		error_failed(adapter->bonding->conn, adapter->bonding->rq,
+		error_failed_errno(adapter->bonding->conn, adapter->bonding->rq,
 				errno);
 		hci_close_dev(dd);
 		goto failed;
@@ -2154,7 +2155,7 @@
 	if (rp.status) {
 		error("HCI_Authentication_Requested failed with status 0x%02x",
 				rp.status);
-		error_failed(adapter->bonding->conn, adapter->bonding->rq,
+		error_failed_errno(adapter->bonding->conn, adapter->bonding->rq,
 				bt_error(rp.status));
 		hci_close_dev(dd);
 		goto failed;
@@ -2200,10 +2201,10 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &peer_addr,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (check_address(peer_addr) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	str2ba(peer_addr, &peer_bdaddr);
 
@@ -2266,10 +2267,10 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &peer_addr,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (check_address(peer_addr) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	str2ba(peer_addr, &peer_bdaddr);
 
@@ -2337,10 +2338,10 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &addr_ptr,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (check_address(addr_ptr) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	dd = hci_open_dev(adapter->dev_id);
 	if (dd < 0)
@@ -2362,7 +2363,7 @@
 	if (textfile_casedel(filename, addr_ptr) < 0) {
 		int err = errno;
 		hci_close_dev(dd);
-		return error_failed(conn, msg, err);
+		return error_failed_errno(conn, msg, err);
 	}
 
 	str2ba(addr_ptr, &bdaddr);
@@ -2381,7 +2382,7 @@
 			int err = errno;
 			error("Disconnect failed");
 			hci_close_dev(dd);
-			return error_failed(conn, msg, err);
+			return error_failed_errno(conn, msg, err);
 		}
 	}
 
@@ -2409,10 +2410,10 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &addr_ptr,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (check_address(addr_ptr) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	create_name(filename, PATH_MAX, STORAGEDIR, adapter->address,
 			"linkkeys");
@@ -2448,7 +2449,7 @@
 	char filename[PATH_MAX + 1];
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	create_name(filename, PATH_MAX, STORAGEDIR, adapter->address,
 			"linkkeys");
@@ -2481,10 +2482,10 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &addr_ptr,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (check_address(addr_ptr) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	str2ba(adapter->address, &local);
 
@@ -2518,16 +2519,16 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &addr_ptr,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (check_address(addr_ptr) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	str2ba(addr_ptr, &bdaddr);
 
 	val = get_encryption_key_size(adapter->dev_id, &bdaddr);
 	if (val < 0)
-		return error_failed(conn, msg, -val);
+		return error_failed_errno(conn, msg, -val);
 
 	reply = dbus_message_new_method_return(msg);
 
@@ -2554,7 +2555,7 @@
 		return error_not_ready(conn, msg);
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (adapter->discov_active || adapter->pdiscov_active)
 		return error_discover_in_progress(conn, msg);
@@ -2586,14 +2587,14 @@
 		error("Unable to start periodic inquiry: %s (%d)",
 				strerror(errno), errno);
 		hci_close_dev(dd);
-		return error_failed(conn, msg, err);
+		return error_failed_errno(conn, msg, err);
 	}
 
 	if (status) {
 		error("HCI_Periodic_Inquiry_Mode failed with status 0x%02x",
 				status);
 		hci_close_dev(dd);
-		return error_failed(conn, msg, bt_error(status));
+		return error_failed_errno(conn, msg, bt_error(status));
 	}
 
 	adapter->pdiscov_requestor = g_strdup(dbus_message_get_sender(msg));
@@ -2627,7 +2628,7 @@
 		return error_not_ready(conn, msg);
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (!adapter->pdiscov_active)
 		return error_not_authorized(conn, msg);
@@ -2641,7 +2642,7 @@
 		if (err == -ENODEV)
 			return error_no_such_adapter(conn, msg);
 		else
-			return error_failed(conn, msg, -err);
+			return error_failed_errno(conn, msg, -err);
 	}
 
 	reply = dbus_message_new_method_return(msg);
@@ -2676,7 +2677,7 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_BOOLEAN, &resolve,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
@@ -2706,7 +2707,7 @@
 	dbus_bool_t resolve = adapter->pdiscov_resolve_names;
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
@@ -2734,7 +2735,7 @@
 		return error_not_ready(conn, msg);
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (adapter->discov_active)
 		return error_discover_in_progress(conn, msg);
@@ -2767,14 +2768,14 @@
 		error("Unable to start inquiry: %s (%d)",
 				strerror(errno), errno);
 		hci_close_dev(dd);
-		return error_failed(conn, msg, err);
+		return error_failed_errno(conn, msg, err);
 	}
 
 	if (rp.status) {
 		error("HCI_Inquiry command failed with status 0x%02x",
 				rp.status);
 		hci_close_dev(dd);
-		return error_failed(conn, msg, bt_error(rp.status));
+		return error_failed_errno(conn, msg, bt_error(rp.status));
 	}
 
 	method = dbus_message_get_member(msg);
@@ -2807,7 +2808,7 @@
 		return error_not_ready(conn, msg);
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	/* is there discover pending? or discovery cancel was requested
 	 * previously */
@@ -2828,7 +2829,7 @@
 		if (err == -ENODEV)
 			return error_no_such_adapter(conn, msg);
 		else
-			return error_failed(conn, msg, -err);
+			return error_failed_errno(conn, msg, -err);
 	}
 
 	/* Reply before send DiscoveryCompleted */
@@ -2881,7 +2882,7 @@
 	struct remote_device_list_t param = { NULL, 0 };
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	/* Add Bonded devices to the list */
 	create_name(filename, PATH_MAX, STORAGEDIR, adapter->address, "linkkeys");
@@ -2940,12 +2941,12 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &string,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	/* Date format is "YYYY-MM-DD HH:MM:SS GMT" */
 	len = strlen(string);
 	if (len && (strptime(string, "%Y-%m-%d %H:%M:%S", &date) == NULL))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	/* Bonded and trusted: mandatory entries(no matter the date/time) */
 	create_name(filename, PATH_MAX, STORAGEDIR, adapter->address, "linkkeys");
@@ -2997,10 +2998,10 @@
 	if (!dbus_message_get_args(msg, NULL,
 			DBUS_TYPE_STRING, &address,
 			DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (check_address(address) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
@@ -3031,10 +3032,10 @@
 	if (!dbus_message_get_args(msg, NULL,
 			DBUS_TYPE_STRING, &address,
 			DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (check_address(address) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	str2ba(adapter->address, &local);
 
@@ -3063,10 +3064,10 @@
 	if (!dbus_message_get_args(msg, NULL,
 			DBUS_TYPE_STRING, &address,
 			DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (check_address(address) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
@@ -3138,7 +3139,7 @@
 		return error_unknown_method(conn, msg);
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
@@ -3168,10 +3169,10 @@
 
 	if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &address,
 						DBUS_TYPE_INVALID) == FALSE)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (check_address(address) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
@@ -3198,7 +3199,7 @@
 
 	if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &path,
 						DBUS_TYPE_INVALID) == FALSE)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
hcid/dbus-database.c +25 -24

193 lines not on this page · raw message

hcid/dbus-error.c +1 -109

170 lines not on this page · raw message

hcid/dbus-error.h +2 -17
diff -x Entries -u -r -N utils/hcid/dbus-error.h utils2/hcid/dbus-error.h
@@ -22,47 +22,32 @@
  *
  */
 
-#define ERROR_INTERFACE "org.bluez.Error"
+#define ERROR_INTERFACE "org.bluez.core.Error"
 
-DBusHandlerResult error_failed(DBusConnection *conn, DBusMessage *msg, int err);
 DBusHandlerResult error_not_ready(DBusConnection *conn, DBusMessage *msg);
-DBusHandlerResult error_invalid_arguments(DBusConnection *conn, DBusMessage *msg);
 DBusHandlerResult error_unknown_method(DBusConnection *conn, DBusMessage *msg);
 DBusHandlerResult error_not_authorized(DBusConnection *conn, DBusMessage *msg);
 DBusHandlerResult error_rejected(DBusConnection *conn, DBusMessage *msg);
-DBusHandlerResult error_out_of_memory(DBusConnection *conn, DBusMessage *msg);
 DBusHandlerResult error_no_such_adapter(DBusConnection *conn, DBusMessage *msg);
 DBusHandlerResult error_no_such_service(DBusConnection *conn, DBusMessage *msg);
-DBusHandlerResult error_not_available(DBusConnection *conn, DBusMessage *msg);
-DBusHandlerResult error_not_supported(DBusConnection *conn, DBusMessage *msg);
 DBusHandlerResult error_request_deferred(DBusConnection *conn, DBusMessage *msg);
-DBusHandlerResult error_not_connected(DBusConnection *conn, DBusMessage *msg);
-DBusHandlerResult error_does_not_exist(DBusConnection *conn, DBusMessage *msg, const char *str);
-DBusHandlerResult error_canceled(DBusConnection *conn, DBusMessage *msg, const char *str);
+/* Used only for hcid device audit feature */
 DBusHandlerResult error_not_in_progress(DBusConnection *conn, DBusMessage *msg, const char *str);
 DBusHandlerResult error_unsupported_major_class(DBusConnection *conn, DBusMessage *msg);
-DBusHandlerResult error_connection_attempt_failed(DBusConnection *conn, DBusMessage *msg, int err);
 DBusHandlerResult error_bonding_already_exists(DBusConnection *conn, DBusMessage *msg);
 DBusHandlerResult error_bonding_does_not_exist(DBusConnection *conn, DBusMessage *msg);
 DBusHandlerResult error_bonding_in_progress(DBusConnection *conn, DBusMessage *msg);
 DBusHandlerResult error_bonding_not_in_progress(DBusConnection *conn, DBusMessage *msg);
 DBusHandlerResult error_authentication_canceled(DBusConnection *conn, DBusMessage *msg);
 DBusHandlerResult error_discover_in_progress(DBusConnection *conn, DBusMessage *msg);
-DBusHandlerResult error_connect_in_progress(DBusConnection *conn, DBusMessage *msg);
-DBusHandlerResult error_connect_not_in_progress(DBusConnection *conn, DBusMessage *msg);
 DBusHandlerResult error_record_does_not_exist(DBusConnection *conn, DBusMessage *msg);
 DBusHandlerResult error_passkey_agent_already_exists(DBusConnection *conn, DBusMessage *msg);
 DBusHandlerResult error_passkey_agent_does_not_exist(DBusConnection *conn, DBusMessage *msg);
 DBusHandlerResult error_auth_agent_already_exists(DBusConnection *conn, DBusMessage *msg);
 DBusHandlerResult error_auth_agent_does_not_exist(DBusConnection *conn, DBusMessage *msg);
-DBusHandlerResult error_binding_does_not_exist(DBusConnection *conn, DBusMessage *msg);
-DBusHandlerResult error_service_already_exists(DBusConnection *conn, DBusMessage *msg);
 DBusHandlerResult error_service_does_not_exist(DBusConnection *conn, DBusMessage *msg);
 DBusHandlerResult error_service_search_in_progress(DBusConnection *conn, DBusMessage *msg);
-DBusHandlerResult error_connect_canceled(DBusConnection *conn, DBusMessage *msg);
 DBusHandlerResult error_sdp_failed(DBusConnection *conn, DBusMessage *msg, int err);
 DBusHandlerResult error_audit_already_exists(DBusConnection *conn, DBusMessage *msg);
-DBusHandlerResult error_trusted_device_already_exists(DBusConnection *conn, DBusMessage *msg);
-DBusHandlerResult error_trusted_device_does_not_exists(DBusConnection *conn, DBusMessage *msg);
 DBusHandlerResult error_disconnect_in_progress(DBusConnection *conn, DBusMessage *msg);
 DBusHandlerResult error_service_start_in_progress(DBusConnection *conn, DBusMessage *msg);
hcid/dbus-sdp.c +22 -21

166 lines not on this page · raw message

hcid/dbus-security.c +7 -6
diff -x Entries -u -r -N utils/hcid/dbus-security.c utils2/hcid/dbus-security.c
@@ -50,6 +50,7 @@
 #include "dbus-common.h"
 #include "dbus-service.h"
 #include "dbus-error.h"
+#include "common-error.h"
 #include "dbus-security.h"
 #include "dbus-hci.h"
 
@@ -259,7 +260,7 @@
 				DBUS_TYPE_STRING, &path,
 				DBUS_TYPE_STRING, &addr,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	memset(&ref, 0, sizeof(ref));
 
@@ -314,7 +315,7 @@
 				DBUS_TYPE_STRING, &path,
 				DBUS_TYPE_STRING, &addr,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	memset(&ref, 0, sizeof(ref));
 
@@ -354,7 +355,7 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &path,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	default_agent = passkey_agent_new(NULL, conn, dbus_message_get_sender(msg),
 						path, NULL);
@@ -395,7 +396,7 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &path,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	name = dbus_message_get_sender(msg);
 
@@ -570,7 +571,7 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &path,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	default_auth_agent = auth_agent_new(conn,
 					dbus_message_get_sender(msg), path);
@@ -611,7 +612,7 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &path,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	name = dbus_message_get_sender(msg);
 
hcid/dbus-service.c +11 -10
diff -x Entries -u -r -N utils/hcid/dbus-service.c utils2/hcid/dbus-service.c
@@ -49,6 +49,7 @@
 #include "server.h"
 #include "dbus-common.h"
 #include "dbus-error.h"
+#include "common-error.h"
 #include "manager.h"
 #include "adapter.h"
 #include "dbus-service.h"
@@ -326,7 +327,7 @@
 
 	if (service->action) {
 		if (conn)
-			error_failed(conn, service->action, ecode);
+			error_failed_errno(conn, service->action, ecode);
 		dbus_message_unref(service->action);
 		service->action = NULL;
 	}
@@ -467,10 +468,10 @@
 	struct service *service = data;
 
 	if (service->external || service->pid)
-		return error_failed(conn, msg, EALREADY);
+		return error_failed_errno(conn, msg, EALREADY);
 
 	if (service_start(service, conn) < 0)
-		return error_failed(conn, msg, ENOEXEC);
+		return error_failed_errno(conn, msg, ENOEXEC);
 
 	service->action = dbus_message_ref(msg);
 
@@ -483,7 +484,7 @@
 	struct service *service  = data;
 
 	if (service->external || !service->bus_name)
-		return error_failed(conn, msg, EPERM);
+		return error_failed_errno(conn, msg, EPERM);
 
 	stop_service(service, FALSE);
 
@@ -539,10 +540,10 @@
 	if (!dbus_message_get_args(msg, NULL,
 			DBUS_TYPE_STRING, &address,
 			DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (check_address(address) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
@@ -600,10 +601,10 @@
 	if (!dbus_message_get_args(msg, NULL,
 			DBUS_TYPE_STRING, &address,
 			DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (check_address(address) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	trusted = read_trust(BDADDR_ANY, address, service->ident);
 
@@ -628,10 +629,10 @@
 	if (!dbus_message_get_args(msg, NULL,
 			DBUS_TYPE_STRING, &address,
 			DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (check_address(address) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
hcid/dbus-test.c +9 -8
diff -x Entries -u -r -N utils/hcid/dbus-test.c utils2/hcid/dbus-test.c
@@ -45,6 +45,7 @@
 #include "adapter.h"
 #include "dbus-hci.h"
 #include "dbus-error.h"
+#include "common-error.h"
 #include "dbus-test.h"
 
 #define L2INFO_TIMEOUT (2 * 1000)
@@ -424,11 +425,11 @@
 	if (dbus_error_is_set(&err)) {
 		error("Can't extract message arguments:%s", err.message);
 		dbus_error_free(&err);
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 	}
 
 	if (check_address(address) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	str2ba(address, &peer);
 	str2ba(adapter->address, &local);
@@ -507,11 +508,11 @@
 	if (dbus_error_is_set(&err)) {
 		error("Can't extract message arguments:%s", err.message);
 		dbus_error_free(&err);
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 	}
 
 	if (check_address(address) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	str2ba(address, &peer);
 	str2ba(adapter->address, &local);
@@ -567,11 +568,11 @@
 	if (dbus_error_is_set(&err)) {
 		error("Can't extract message arguments:%s", err.message);
 		dbus_error_free(&err);
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 	}
 
 	if (check_address(address) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	str2ba(address, &peer);
 	str2ba(adapter->address, &local);
@@ -609,11 +610,11 @@
 	if (dbus_error_is_set(&err)) {
 		error("Can't extract message arguments:%s", err.message);
 		dbus_error_free(&err);
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 	}
 
 	if (check_address(address) < 0)
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	str2ba(address, &peer);
 	str2ba(adapter->address, &local);
hcid/manager.c +11 -10
diff -x Entries -u -r -N utils/hcid/manager.c utils2/hcid/manager.c
@@ -49,6 +49,7 @@
 #include "dbus.h"
 #include "dbus-helper.h"
 #include "dbus-common.h"
+#include "common-error.h"
 #include "dbus-error.h"
 #include "dbus-hci.h"
 #include "dbus-service.h"
@@ -67,7 +68,7 @@
 	dbus_uint32_t version = 0;
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
@@ -86,7 +87,7 @@
 	char path[MAX_PATH_LENGTH], *path_ptr = path;
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	if (default_adapter_id < 0)
 		return error_no_such_adapter(conn, msg);
@@ -159,7 +160,7 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &pattern,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	/* hci_devid() would make sense to use here, except it
 	   is restricted to devices which are up */
@@ -200,11 +201,11 @@
 	int i, sk;
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	sk = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
 	if (sk < 0)
-		return error_failed(conn, msg, errno);
+		return error_failed_errno(conn, msg, errno);
 
 	dl = g_malloc0(HCI_MAX_DEV * sizeof(*dr) + sizeof(*dl));
 
@@ -215,7 +216,7 @@
 		int err = errno;
 		close(sk);
 		g_free(dl);
-		return error_failed(conn, msg, err);
+		return error_failed_errno(conn, msg, err);
 	}
 
 	dr = dl->dev_req;
@@ -267,7 +268,7 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &pattern,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	service = search_service(conn, pattern);
 	if (!service)
@@ -291,7 +292,7 @@
 	DBusMessageIter array_iter;
 
 	if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
@@ -317,7 +318,7 @@
 	if (!dbus_message_get_args(msg, NULL,
 				DBUS_TYPE_STRING, &pattern,
 				DBUS_TYPE_INVALID))
-		return error_invalid_arguments(conn, msg);
+		return error_invalid_arguments(conn, msg, NULL);
 
 	service = search_service(conn, pattern);
 	if (!service)
@@ -341,7 +342,7 @@
 		return error_service_start_in_progress(conn, msg);
 
 	if (service_start(service, conn) < 0)
-		return error_failed(conn, msg, ENOEXEC);
+		return error_failed_errno(conn, msg, ENOEXEC);
 
 	service->action = dbus_message_ref(msg);