[PATCH 3/9] Add __btd_error_not_supported()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 audio/control.c |    8 ++------
 src/device.c    |    4 +---
 src/error.c     |    7 +++++++
 src/error.h     |    1 +
 4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/audio/control.c b/audio/control.c
index 76f46e9..e9f59fc 100644
--- a/audio/control.c
+++ b/audio/control.c
@@ -1020,9 +1020,7 @@ static DBusMessage *volume_up(DBusConnection *conn, DBusMessage *msg,
 					"Device not Connected");
 
 	if (!control->target)
-		return g_dbus_create_error(msg,
-					ERROR_INTERFACE ".NotSupported",
-					"AVRCP Target role not supported");
+		return __btd_error_not_supported(msg);
 
 	err = avctp_send_passthrough(control, VOL_UP_OP);
 	if (err < 0)
@@ -1050,9 +1048,7 @@ static DBusMessage *volume_down(DBusConnection *conn, DBusMessage *msg,
 					"Device not Connected");
 
 	if (!control->target)
-		return g_dbus_create_error(msg,
-					ERROR_INTERFACE ".NotSupported",
-					"AVRCP Target role not supported");
+		return __btd_error_not_supported(msg);
 
 	err = avctp_send_passthrough(control, VOL_DOWN_OP);
 	if (err < 0)
diff --git a/src/device.c b/src/device.c
index 6d110dc..3393634 100644
--- a/src/device.c
+++ b/src/device.c
@@ -540,9 +540,7 @@ static DBusMessage *set_blocked(DBusConnection *conn, DBusMessage *msg,
 	case 0:
 		return dbus_message_new_method_return(msg);
 	case EINVAL:
-		return g_dbus_create_error(msg,
-					ERROR_INTERFACE ".NotSupported",
-					"Kernel lacks blacklist support");
+		return __btd_error_not_supported(msg);
 	default:
 		return g_dbus_create_error(msg, ERROR_INTERFACE ".Failed",
 						"%s", strerror(-err));
diff --git a/src/error.c b/src/error.c
index e268163..4429903 100644
--- a/src/error.c
+++ b/src/error.c
@@ -62,3 +62,10 @@ DBusMessage *__btd_error_already_exists(DBusMessage *msg)
 				ERROR_INTERFACE ".AlreadyExists",
 				"Already Exists");
 }
+
+DBusMessage *__btd_error_not_supported(DBusMessage *msg)
+{
+	return g_dbus_create_error(msg, ERROR_INTERFACE
+					".NotSupported",
+					"Operation is not supported");
+}
diff --git a/src/error.h b/src/error.h
index 284889f..7dbb8b3 100644
--- a/src/error.h
+++ b/src/error.h
@@ -32,3 +32,4 @@ DBusHandlerResult error_common_reply(DBusConnection *conn, DBusMessage *msg,
 
 DBusMessage *__btd_error_invalid_args(DBusMessage *msg);
 DBusMessage *__btd_error_already_exists(DBusMessage *msg);
+DBusMessage *__btd_error_not_supported(DBusMessage *msg);
-- 
1.7.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux