Add btd_error_not_supported()
diff --git a/audio/control.c b/audio/control.c
index ce34eb4..e710f8f 100644
--- a/audio/control.c
+++ b/audio/control.c
@@ -1019,9 +1019,7 @@
"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)
@@ -1049,9 +1047,7 @@
"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 3a9cc76..6363ed0 100644
--- a/src/device.c
+++ b/src/device.c
@@ -538,9 +538,7 @@
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 415511d..0ea007a 100644
--- a/src/error.c
+++ b/src/error.c
@@ -62,3 +62,10 @@
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 de40f57..71b40d9 100644
--- a/src/error.h
+++ b/src/error.h
@@ -32,3 +32,4 @@
DBusMessage *btd_error_invalid_args(DBusMessage *msg);
DBusMessage *btd_error_already_exists(DBusMessage *msg);
+DBusMessage *btd_error_not_supported(DBusMessage *msg);