]> code.delx.au - pulseaudio/commitdiff
bluetooth: return sensible error code in set_profile()
authorLennart Poettering <lennart@poettering.net>
Wed, 17 Jun 2009 02:51:57 +0000 (04:51 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 17 Jun 2009 02:51:57 +0000 (04:51 +0200)
src/modules/bluetooth/module-bluetooth-device.c
src/pulse/def.h

index 9fec4edfdd48d3d1607bba0fee1d17f1f15c820c..6bcd0b80962a3754238f4fc4ff30f033653c03d1 100644 (file)
@@ -1920,7 +1920,7 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
 
     if (!(device = pa_bluetooth_discovery_get_by_path(u->discovery, u->path))) {
         pa_log_error("Failed to get device object.");
-        return -1;
+        return -PA_ERR_IO;
     }
 
     /* The state signal is sent by bluez, so it is racy to check
@@ -1930,11 +1930,11 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
        module will be unloaded. */
     if (device->headset_state < PA_BT_AUDIO_STATE_CONNECTED && *d == PROFILE_HSP) {
         pa_log_warn("HSP is not connected, refused to switch profile");
-        return -1;
+        return -PA_ERR_IO;
     }
     else if (device->audio_sink_state < PA_BT_AUDIO_STATE_CONNECTED && *d == PROFILE_A2DP) {
         pa_log_warn("A2DP is not connected, refused to switch profile");
-        return -1;
+        return -PA_ERR_IO;
     }
 
     if (u->sink) {
index d5bbefe3682fca0581bcba238865777d1ec806b1..08399ca84735aba42f23a289b1cfe1837458d54f 100644 (file)
@@ -393,6 +393,7 @@ enum {
     PA_ERR_OBSOLETE,               /**< Obsolete functionality. \since 0.9.15 */
     PA_ERR_NOTIMPLEMENTED,         /**< Missing implementation. \since 0.9.15 */
     PA_ERR_FORKED,                 /**< The caller forked without calling execve() and tried to reuse the context. \since 0.9.15 */
+    PA_ERR_IO,                     /**< An IO error happened. \since 0.9.16 */
     PA_ERR_MAX                     /**< Not really an error but the first invalid error code */
 };