mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-25 13:00:28 +01:00
devices: wwan: add support for changing capabilities of modem after
initialization Signed-off-by: Muhammad Asif <thevancedgamer@mentallysanemainliners.org>
This commit is contained in:
parent
deb29f785a
commit
fabab906a3
3 changed files with 52 additions and 8 deletions
|
|
@ -327,6 +327,23 @@ modem_state_cb(NMModem *modem, int new_state_i, int old_state_i, gpointer user_d
|
|||
NM_DEVICE_STATE_REASON_MODEM_FAILED);
|
||||
}
|
||||
|
||||
static void
|
||||
caps_changed_cb(NMModem *modem, guint modem_caps, guint current_caps, gpointer user_data)
|
||||
{
|
||||
NMDeviceModem *self = NM_DEVICE_MODEM(user_data);
|
||||
NMDeviceModemPrivate *priv = NM_DEVICE_MODEM_GET_PRIVATE(self);
|
||||
|
||||
if (priv->caps != modem_caps) {
|
||||
priv->caps = modem_caps;
|
||||
_notify(self, PROP_CAPABILITIES);
|
||||
}
|
||||
|
||||
if (priv->current_caps != current_caps) {
|
||||
priv->current_caps = current_caps;
|
||||
_notify(self, PROP_CURRENT_CAPABILITIES);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
modem_removed_cb(NMModem *modem, gpointer user_data)
|
||||
{
|
||||
|
|
@ -677,6 +694,7 @@ set_modem(NMDeviceModem *self, NMModem *modem)
|
|||
g_signal_connect(modem, NM_MODEM_AUTH_REQUESTED, G_CALLBACK(modem_auth_requested), self);
|
||||
g_signal_connect(modem, NM_MODEM_AUTH_RESULT, G_CALLBACK(modem_auth_result), self);
|
||||
g_signal_connect(modem, NM_MODEM_STATE_CHANGED, G_CALLBACK(modem_state_cb), self);
|
||||
g_signal_connect(modem, NM_MODEM_CAPABILITIES_CHANGED, G_CALLBACK(caps_changed_cb), self);
|
||||
g_signal_connect(modem, NM_MODEM_REMOVED, G_CALLBACK(modem_removed_cb), self);
|
||||
|
||||
g_signal_connect(modem,
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ enum {
|
|||
AUTH_RESULT,
|
||||
REMOVED,
|
||||
STATE_CHANGED,
|
||||
CAPABILITIES_CHANGED,
|
||||
LAST_SIGNAL,
|
||||
};
|
||||
|
||||
|
|
@ -338,6 +339,14 @@ nm_modem_set_state(NMModem *self, NMModemState new_state, const char *reason)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
nm_modem_set_capabilities(NMModem *self,
|
||||
NMDeviceModemCapabilities modem_caps,
|
||||
NMDeviceModemCapabilities current_caps)
|
||||
{
|
||||
g_signal_emit(self, signals[CAPABILITIES_CHANGED], 0, (guint) modem_caps, (guint) current_caps);
|
||||
}
|
||||
|
||||
void
|
||||
nm_modem_set_prev_state(NMModem *self, const char *reason)
|
||||
{
|
||||
|
|
@ -2004,4 +2013,16 @@ nm_modem_class_init(NMModemClass *klass)
|
|||
2,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT);
|
||||
|
||||
signals[CAPABILITIES_CHANGED] = g_signal_new(NM_MODEM_CAPABILITIES_CHANGED,
|
||||
G_OBJECT_CLASS_TYPE(object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
G_TYPE_NONE,
|
||||
2,
|
||||
G_TYPE_UINT,
|
||||
G_TYPE_UINT);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,14 +33,15 @@
|
|||
#define NM_MODEM_DEVICE_UID "device-uid"
|
||||
|
||||
/* Signals */
|
||||
#define NM_MODEM_PPP_STATS "ppp-stats"
|
||||
#define NM_MODEM_PPP_FAILED "ppp-failed"
|
||||
#define NM_MODEM_PREPARE_RESULT "prepare-result"
|
||||
#define NM_MODEM_NEW_CONFIG "new-config"
|
||||
#define NM_MODEM_AUTH_REQUESTED "auth-requested"
|
||||
#define NM_MODEM_AUTH_RESULT "auth-result"
|
||||
#define NM_MODEM_REMOVED "removed"
|
||||
#define NM_MODEM_STATE_CHANGED "state-changed"
|
||||
#define NM_MODEM_PPP_STATS "ppp-stats"
|
||||
#define NM_MODEM_PPP_FAILED "ppp-failed"
|
||||
#define NM_MODEM_PREPARE_RESULT "prepare-result"
|
||||
#define NM_MODEM_NEW_CONFIG "new-config"
|
||||
#define NM_MODEM_AUTH_REQUESTED "auth-requested"
|
||||
#define NM_MODEM_AUTH_RESULT "auth-result"
|
||||
#define NM_MODEM_REMOVED "removed"
|
||||
#define NM_MODEM_STATE_CHANGED "state-changed"
|
||||
#define NM_MODEM_CAPABILITIES_CHANGED "capabilities-changed"
|
||||
|
||||
typedef enum {
|
||||
NM_MODEM_IP_METHOD_UNKNOWN = 0,
|
||||
|
|
@ -215,6 +216,10 @@ void nm_modem_set_state(NMModem *self, NMModemState new_state, const cha
|
|||
void nm_modem_set_prev_state(NMModem *self, const char *reason);
|
||||
const char *nm_modem_state_to_string(NMModemState state);
|
||||
|
||||
void nm_modem_set_capabilities(NMModem *self,
|
||||
NMDeviceModemCapabilities modem_caps,
|
||||
NMDeviceModemCapabilities current_caps);
|
||||
|
||||
NMModemIPType nm_modem_get_supported_ip_types(NMModem *self);
|
||||
|
||||
/* For the modem-manager only */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue