[PATCH] iface-modem: allow power off from any state
We shouldn't be limiting the power off state from a non-enabled one only, in the same way we always allow doing a reset from any state. --- src/mm-iface-modem.c | 53 +--- 1 file changed, 21 insertions(+), 32 deletions(-) diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c index 06441e22..21b8b6ff 100644 --- a/src/mm-iface-modem.c +++ b/src/mm-iface-modem.c @@ -1806,45 +1806,34 @@ handle_set_power_state_auth_ready (MMBaseModem *self, return; } -/* Only 'off', 'low' or 'up' expected */ -if (ctx->power_state != MM_MODEM_POWER_STATE_LOW && -ctx->power_state != MM_MODEM_POWER_STATE_ON && -ctx->power_state != MM_MODEM_POWER_STATE_OFF) { -g_dbus_method_invocation_return_error (ctx->invocation, - MM_CORE_ERROR, - MM_CORE_ERROR_INVALID_ARGS, - "Cannot set '%s' power state", - mm_modem_power_state_get_string (ctx->power_state)); -handle_set_power_state_context_free (ctx); -return; -} - modem_state = MM_MODEM_STATE_UNKNOWN; g_object_get (self, MM_IFACE_MODEM_STATE, _state, NULL); -/* Going into LOW or ON only allowed in disabled state */ -if ((ctx->power_state == MM_MODEM_POWER_STATE_LOW || - ctx->power_state == MM_MODEM_POWER_STATE_ON) && -modem_state != MM_MODEM_STATE_DISABLED) { -g_dbus_method_invocation_return_error (ctx->invocation, - MM_CORE_ERROR, - MM_CORE_ERROR_WRONG_STATE, - "Cannot set power state: not in disabled state"); -handle_set_power_state_context_free (ctx); -return; -} - -/* Going into OFF, only allowed if locked, disabled or failed */ -if (ctx->power_state == MM_MODEM_POWER_STATE_OFF && -modem_state != MM_MODEM_STATE_FAILED && -modem_state != MM_MODEM_STATE_LOCKED && -modem_state != MM_MODEM_STATE_DISABLED) { +switch (ctx->power_state) { +case MM_MODEM_POWER_STATE_LOW: +case MM_MODEM_POWER_STATE_ON: +/* Going into LOW or ON only allowed in disabled state */ +if (modem_state != MM_MODEM_STATE_DISABLED) { +g_dbus_method_invocation_return_error (ctx->invocation, + MM_CORE_ERROR, + MM_CORE_ERROR_WRONG_STATE, + "Cannot set power state: not in disabled state"); +handle_set_power_state_context_free (ctx); +return; +} +break; +case MM_MODEM_POWER_STATE_OFF: +/* Going into OFF always allowed */ +break; +default: +/* Only 'off', 'low' or 'up' expected */ g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, - MM_CORE_ERROR_WRONG_STATE, - "Cannot set power state: modem either enabled or initializing"); + MM_CORE_ERROR_INVALID_ARGS, + "Cannot set '%s' power state", + mm_modem_power_state_get_string (ctx->power_state)); handle_set_power_state_context_free (ctx); return; } -- 2.15.1 ___ ModemManager-devel mailing list ModemManager-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel
Re: [PATCH] ublox: ignore ttyACM0
On Tue, Mar 6, 2018 at 10:10 PM, Aleksander Morgadowrote: > On Tue, Mar 6, 2018 at 5:56 PM, Aleksander Morgado > wrote: >> We used ttyACM0 as secondary port until now, just because we had an >> extra AT capable TTY around in addition to the main control ttyACM2 >> port. >> >> Turns out, using this ttyACM0 may actually break the connection setup >> in the wwan interface in a bad way (e.g. not allowing DHCP setup). >> >> The suggestion from u-blox and Intel is to fully ignore ttyACM0; and >> given that we no longer need any primary/secondary port logic, we just >> remove all the associated udev tags. > > Should have said in the commit message that this applies to the > *TOBY-L4* btw. Will do that change in the commit message once this one > gets in, unless there's some more changes to do. > Pushed this one to git master already. >> --- >> plugins/ublox/77-mm-ublox-port-types.rules | 7 +++ >> plugins/ublox/mm-plugin-ublox.c| 29 >> - >> 2 files changed, 3 insertions(+), 33 deletions(-) >> >> diff --git a/plugins/ublox/77-mm-ublox-port-types.rules >> b/plugins/ublox/77-mm-ublox-port-types.rules >> index 0c5b0961..cb77f0e0 100644 >> --- a/plugins/ublox/77-mm-ublox-port-types.rules >> +++ b/plugins/ublox/77-mm-ublox-port-types.rules >> @@ -8,13 +8,12 @@ LABEL="mm_ublox_port_types" >> SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="?*", >> ENV{.MM_USBIFNUM}="$attr{bInterfaceNumber}" >> >> # Toby-L4 port types >> -# ttyACM0 (if #2): secondary >> +# ttyACM0 (if #2): secondary (ignore) >> # ttyACM1 (if #4): debug port (ignore) >> # ttyACM2 (if #6): primary >> # ttyACM3 (if #8): AT port for FOTA (ignore) >> -ATTRS{idVendor}=="1546", ATTRS{idProduct}=="1010", ENV{.MM_USBIFNUM}=="02", >> ENV{ID_MM_UBLOX_SECONDARY_PORT}="1" >> +ATTRS{idVendor}=="1546", ATTRS{idProduct}=="1010", ENV{.MM_USBIFNUM}=="02", >> ENV{ID_MM_PORT_IGNORE}="1" >> ATTRS{idVendor}=="1546", ATTRS{idProduct}=="1010", ENV{.MM_USBIFNUM}=="04", >> ENV{ID_MM_PORT_IGNORE}="1" >> -ATTRS{idVendor}=="1546", ATTRS{idProduct}=="1010", ENV{.MM_USBIFNUM}=="06", >> ENV{ID_MM_UBLOX_PRIMARY_PORT}="1" >> ATTRS{idVendor}=="1546", ATTRS{idProduct}=="1010", ENV{.MM_USBIFNUM}=="08", >> ENV{ID_MM_PORT_IGNORE}="1" >> >> -LABEL="mm_ublox_port_types_end" >> \ No newline at end of file >> +LABEL="mm_ublox_port_types_end" >> diff --git a/plugins/ublox/mm-plugin-ublox.c >> b/plugins/ublox/mm-plugin-ublox.c >> index 5ee09a20..fc9ec0c6 100644 >> --- a/plugins/ublox/mm-plugin-ublox.c >> +++ b/plugins/ublox/mm-plugin-ublox.c >> @@ -47,34 +47,6 @@ create_modem (MMPlugin *self, >> product)); >> } >> >> -static gboolean >> -grab_port (MMPlugin *self, >> - MMBaseModem *modem, >> - MMPortProbe *probe, >> - GError **error) >> -{ >> -MMPortSerialAtFlag pflags = MM_PORT_SERIAL_AT_FLAG_NONE; >> -MMKernelDevice *port; >> -MMPortType port_type; >> - >> -port_type = mm_port_probe_get_port_type (probe); >> -port = mm_port_probe_peek_port (probe); >> - >> -if (mm_kernel_device_get_property_as_boolean (port, >> "ID_MM_UBLOX_PRIMARY_PORT")) { >> -mm_dbg ("(%s/%s)' port flagged as primary", >> -mm_port_probe_get_port_subsys (probe), >> -mm_port_probe_get_port_name (probe)); >> -pflags = MM_PORT_SERIAL_AT_FLAG_PRIMARY; >> -} else if (mm_kernel_device_get_property_as_boolean (port, >> "ID_MM_UBLOX_SECONDARY_PORT")) { >> -mm_dbg ("(%s/%s) port flagged as secondary", >> -mm_port_probe_get_port_subsys (probe), >> -mm_port_probe_get_port_name (probe)); >> -pflags = MM_PORT_SERIAL_AT_FLAG_SECONDARY; >> -} >> - >> -return mm_base_modem_grab_port (modem, port, port_type, pflags, error); >> -} >> - >> >> /*/ >> /* Custom init context */ >> >> @@ -295,5 +267,4 @@ mm_plugin_ublox_class_init (MMPluginUbloxClass *klass) >> MMPluginClass *plugin_class = MM_PLUGIN_CLASS (klass); >> >> plugin_class->create_modem = create_modem; >> -plugin_class->grab_port= grab_port; >> } >> -- >> 2.15.1 >> > > > > -- > Aleksander > https://aleksander.es -- Aleksander https://aleksander.es ___ ModemManager-devel mailing list ModemManager-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel
Re: Setting up 4G in D-Link DWM-222 (was Re: 4G USB dongles known to work on Linux)
2018-03-09 12:44 GMT+01:00 Aleksander Morgado: > >> >> >| state: 'connected' > >> >> >|power state: 'on' > >> >> >|access tech: 'lte' > >> >> >| signal quality: '62' (recent) > >> >> > >> >> Well, that means you're connected in LTE :) > >> > > >> > > >> > That makes sense :-) I got confused by very slow connection rates. > >> > Anyway, > >> > is it expected not to connect when changing the current capabilities > to > >> > lte > >> > only? > >> > > >> > >> If you change the capabilities to lte-only, it should also connect > >> correctly. Is it not the case? > > > > > > It doesn't connect. The journal has these messages repeated several > times: > > > > Simple connect started... > > Simple connect state (4/8): Wait to get fully enabled > > Simple connect state (5/8): Register > > [/dev/cdc-wdm0] No transaction matched in received message > > > > Oh! Could you setup ModemManager in debug mode and get us some logs? > https://www.freedesktop.org/wiki/Software/ModemManager/Debugging/ Should I open a bug report or continue here in the mailing list? > >> > I have an additional problem. I have two SIM cards from different > >> > network > >> > providers but the modem is connected to any of those without matching > >> > the > >> > correct provider. May this be due to a limitation of the modem driver > >> > which > >> > cannot read the relevant data from the SIM card? I noticed this info > in > >> > the > >> > journal: > >> > > >> > ModemManager[1880]: couldn't load Operator identifier: > 'Couldn't > >> > get > >> > home network: QMI protocol error (16): 'NotProvisioned'' > >> > ModemManager[1880]: couldn't load Operator name: 'Couldn't get > >> > home > >> > network: QMI protocol error (16): 'NotProvisioned'' > >> > ModemManager[1880]: couldn't load list of Own Numbers: > 'Couldn't > >> > get > >> > MSISDN: QMI protocol error (16): 'NotProvisioned'' > >> > > >> > >> That looks like the info is missing in the SIM card? Which operators > >> are these again? > > > > > > I tried both with a data-only SIM from R and a standard mobile phone SIM > > from Movistar. I don't think it's related to the SIM card. Could it be a > > problem with the driver? I also noticed these lines earlier in the > journal: > > > > couldn't load IMSI: 'Couldn't get UIM IMSI: QMI protocol error > (37): > > 'UimUninitialized'' > > couldn't load Operator identifier: 'Couldn't get home network: > QMI > > protocol error (37): 'UimUninitialized'' > > couldn't load Operator name: 'Couldn't get home network: QMI > > protocol error (37): 'UimUninitialized'' > > couldn't load list of Own Numbers: 'Couldn't get MSISDN: QMI > > protocol error (37): 'UimUninitialized'' > > > > Are you only getting these when in lte-only mode? No, this happens in both cases. -- > Aleksander > https://aleksander.es > ___ ModemManager-devel mailing list ModemManager-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel
Re: Setting up 4G in D-Link DWM-222 (was Re: 4G USB dongles known to work on Linux)
>> >> >| state: 'connected' >> >> >|power state: 'on' >> >> >|access tech: 'lte' >> >> >| signal quality: '62' (recent) >> >> >> >> Well, that means you're connected in LTE :) >> > >> > >> > That makes sense :-) I got confused by very slow connection rates. >> > Anyway, >> > is it expected not to connect when changing the current capabilities to >> > lte >> > only? >> > >> >> If you change the capabilities to lte-only, it should also connect >> correctly. Is it not the case? > > > It doesn't connect. The journal has these messages repeated several times: > > Simple connect started... > Simple connect state (4/8): Wait to get fully enabled > Simple connect state (5/8): Register > [/dev/cdc-wdm0] No transaction matched in received message > Oh! Could you setup ModemManager in debug mode and get us some logs? https://www.freedesktop.org/wiki/Software/ModemManager/Debugging/ >> > I have an additional problem. I have two SIM cards from different >> > network >> > providers but the modem is connected to any of those without matching >> > the >> > correct provider. May this be due to a limitation of the modem driver >> > which >> > cannot read the relevant data from the SIM card? I noticed this info in >> > the >> > journal: >> > >> > ModemManager[1880]: couldn't load Operator identifier: 'Couldn't >> > get >> > home network: QMI protocol error (16): 'NotProvisioned'' >> > ModemManager[1880]: couldn't load Operator name: 'Couldn't get >> > home >> > network: QMI protocol error (16): 'NotProvisioned'' >> > ModemManager[1880]: couldn't load list of Own Numbers: 'Couldn't >> > get >> > MSISDN: QMI protocol error (16): 'NotProvisioned'' >> > >> >> That looks like the info is missing in the SIM card? Which operators >> are these again? > > > I tried both with a data-only SIM from R and a standard mobile phone SIM > from Movistar. I don't think it's related to the SIM card. Could it be a > problem with the driver? I also noticed these lines earlier in the journal: > > couldn't load IMSI: 'Couldn't get UIM IMSI: QMI protocol error (37): > 'UimUninitialized'' > couldn't load Operator identifier: 'Couldn't get home network: QMI > protocol error (37): 'UimUninitialized'' > couldn't load Operator name: 'Couldn't get home network: QMI > protocol error (37): 'UimUninitialized'' > couldn't load list of Own Numbers: 'Couldn't get MSISDN: QMI > protocol error (37): 'UimUninitialized'' > Are you only getting these when in lte-only mode? -- Aleksander https://aleksander.es ___ ModemManager-devel mailing list ModemManager-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel