libmm-glib: don't change default DBus timeout when running Modem.Command()
Just warn if the default DBus timeout is shorter than the one being requested.
This commit is contained in:
@@ -1487,19 +1487,17 @@ mm_modem_command (MMModem *self,
|
|||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
gint old_timeout;
|
|
||||||
|
|
||||||
g_return_if_fail (MM_GDBUS_IS_MODEM (self));
|
g_return_if_fail (MM_GDBUS_IS_MODEM (self));
|
||||||
|
|
||||||
old_timeout = g_dbus_proxy_get_default_timeout (G_DBUS_PROXY (self));
|
if (g_dbus_proxy_get_default_timeout (G_DBUS_PROXY (self)) < timeout)
|
||||||
g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (self), (timeout + 1) * 1000);
|
g_warning ("Requested command timeout is shorter than the default DBus timeout");
|
||||||
mm_gdbus_modem_call_command (self,
|
mm_gdbus_modem_call_command (self,
|
||||||
cmd,
|
cmd,
|
||||||
timeout,
|
timeout,
|
||||||
cancellable,
|
cancellable,
|
||||||
callback,
|
callback,
|
||||||
user_data);
|
user_data);
|
||||||
g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (self), old_timeout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gchar *
|
gchar *
|
||||||
@@ -1528,22 +1526,18 @@ mm_modem_command_sync (MMModem *self,
|
|||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
gchar *result;
|
gchar *result;
|
||||||
gboolean success;
|
|
||||||
gint old_timeout;
|
|
||||||
|
|
||||||
g_return_val_if_fail (MM_GDBUS_IS_MODEM (self), NULL);
|
g_return_val_if_fail (MM_GDBUS_IS_MODEM (self), NULL);
|
||||||
|
|
||||||
old_timeout = g_dbus_proxy_get_default_timeout (G_DBUS_PROXY (self));
|
if (g_dbus_proxy_get_default_timeout (G_DBUS_PROXY (self)) < timeout)
|
||||||
g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (self), (timeout + 1) * 1000);
|
g_warning ("Requested command timeout is shorter than the default DBus timeout");
|
||||||
success = mm_gdbus_modem_call_command_sync (self,
|
|
||||||
cmd,
|
|
||||||
timeout,
|
|
||||||
&result,
|
|
||||||
cancellable,
|
|
||||||
error);
|
|
||||||
g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (self), old_timeout);
|
|
||||||
|
|
||||||
if (!success)
|
if (!mm_gdbus_modem_call_command_sync (self,
|
||||||
|
cmd,
|
||||||
|
timeout,
|
||||||
|
&result,
|
||||||
|
cancellable,
|
||||||
|
error))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
Reference in New Issue
Block a user