plugins: always set a proper error domain in GErrors
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
|
||||
#include "mm-plugin-cinterion.h"
|
||||
#include "mm-broadband-modem-cinterion.h"
|
||||
#include "mm-errors-types.h"
|
||||
#include "mm-log.h"
|
||||
|
||||
G_DEFINE_TYPE (MMPluginCinterion, mm_plugin_cinterion, MM_TYPE_PLUGIN_BASE)
|
||||
@@ -45,7 +46,10 @@ grab_port (MMPluginBase *base,
|
||||
|
||||
/* The Cinterion plugin cannot do anything with non-AT ports */
|
||||
if (!mm_port_probe_is_at (probe)) {
|
||||
g_set_error (error, 0, 0, "Ignoring non-AT port");
|
||||
g_set_error_literal (error,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_UNSUPPORTED,
|
||||
"Ignoring non-AT port");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@@ -26,6 +26,8 @@
|
||||
|
||||
#include <gmodule.h>
|
||||
|
||||
#include <mm-errors-types.h>
|
||||
|
||||
#include "mm-plugin-generic.h"
|
||||
#include "mm-broadband-modem.h"
|
||||
#include "mm-serial-parsers.h"
|
||||
@@ -55,7 +57,10 @@ grab_port (MMPluginBase *base,
|
||||
/* The generic plugin cannot do anything with non-AT and non-QCDM ports */
|
||||
if (!mm_port_probe_is_at (probe) &&
|
||||
!mm_port_probe_is_qcdm (probe)) {
|
||||
g_set_error (error, 0, 0, "Ignoring non-AT/non-QCDM ports");
|
||||
g_set_error (error,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_UNSUPPORTED,
|
||||
"Ignoring non-AT/non-QCDM ports");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -66,7 +71,10 @@ grab_port (MMPluginBase *base,
|
||||
devfile = g_udev_device_get_device_file (port);
|
||||
if (!devfile) {
|
||||
if (!driver || !g_str_equal (driver, "bluetooth")) {
|
||||
g_set_error (error, 0, 0, "Could not get port's sysfs file.");
|
||||
g_set_error (error,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_FAILED,
|
||||
"Could not get port's sysfs file.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@@ -41,7 +41,10 @@ grab_port (MMPluginBase *base,
|
||||
|
||||
/* The Gobi plugin only handles AT and QCDM ports (for now) */
|
||||
if (!mm_port_probe_is_at (probe) && !mm_port_probe_is_qcdm (probe)) {
|
||||
g_set_error (error, 0, 0, "Ignoring non-AT/non-QCDM port");
|
||||
g_set_error_literal (error,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_UNSUPPORTED,
|
||||
"Ignoring non-AT/non-QCDM port");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -50,7 +53,10 @@ grab_port (MMPluginBase *base,
|
||||
driver = mm_port_probe_get_port_driver (probe);
|
||||
|
||||
if (!mm_plugin_base_get_device_ids (base, subsys, name, &vendor, &product)) {
|
||||
g_set_error (error, 0, 0, "Could not get modem product ID.");
|
||||
g_set_error_literal (error,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_FAILED,
|
||||
"Could not get modem product ID");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -106,4 +112,3 @@ mm_plugin_gobi_class_init (MMPluginGobiClass *klass)
|
||||
|
||||
pb_class->grab_port = grab_port;
|
||||
}
|
||||
|
||||
|
@@ -91,7 +91,10 @@ grab_port (MMPluginBase *base,
|
||||
|
||||
/* The Nokia plugin cannot do anything with non-AT ports */
|
||||
if (!mm_port_probe_is_at (probe)) {
|
||||
g_set_error (error, 0, 0, "Ignoring non-AT port");
|
||||
g_set_error_literal (error,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_UNSUPPORTED,
|
||||
"Ignoring non-AT port");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -101,7 +104,10 @@ grab_port (MMPluginBase *base,
|
||||
driver = mm_port_probe_get_port_driver (probe);
|
||||
|
||||
if (!mm_plugin_base_get_device_ids (base, subsys, name, &vendor, &product)) {
|
||||
g_set_error (error, 0, 0, "Could not get modem product ID.");
|
||||
g_set_error_literal (error,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_FAILED,
|
||||
"Could not get modem product ID");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user