Commit Graph

7059 Commits

Author SHA1 Message Date
Aleksander Morgado
3ebc8413b0 udev: tag all devices from idVendor 0x0711 as manual-scan-only
Magic Control Technology Corp (0x0711) manufacturers several USB<->RS232
adapters.
2013-03-05 19:41:08 +01:00
Aleksander Morgado
8450b7b2a3 core: don't automatically probe ports of USB<->serial adapters
We should not automatically probe ports marked as coming from USB to serial
adapters, as we're not sure that a modem is behind the adapter. Still, let the
user request a manual scan and have these devices probed in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=647556
https://bugzilla.gnome.org/show_bug.cgi?id=691076
2013-03-05 19:41:08 +01:00
Ben Chan
3678ae5378 iface-modem-3gpp: handle non-deferrable registration state updates
This patch changes MMIfaceModem3gpp to differentiate between deferrable
and non-deferrable 3GPP registration state updates. Periodic or
unsolicited registration state updates are deferrable, while internal
updates, e.g. due to modem being disabled, are non-deferrable.
2013-03-05 19:31:17 +01:00
Ben Chan
1e67312aaf broadband-modem: fix disabling of unsolicited registration events 2013-03-05 19:16:05 +01:00
Gerald Richter
113916beb5 sierra: add MC8790 to APP1 PPP whitelist 2013-03-04 08:32:23 -06:00
Aleksander Morgado
9ee9845b1e iface-modem-3gpp: avoid re-setting deferred registration update while disabling
Don't clear the current deferred registration update until having disabled
and cleaned up unsolicited registrations state messages, or we may end up
re-setting the deferred registration update again meanwhile
2013-03-01 18:21:19 +01:00
Ben Chan
f93bba25f2 iface-modem-3gpp: clear deferred registration state update when disabling 2013-03-01 08:44:43 +01:00
Aleksander Morgado
c79d266e62 udev: update all udev rules to always match both VID/PID together
If the rules to tag specific USB interface numbers only apply on the PID, we'll
end up seeing that if the port has a parent with another PID, and that other
PID also has a rule, port will get tagged multiple times. Easier to see with an
example:

The ZTE MF637 (VID 0x19D2, PID 0x0121) had the following rules:

ATTRS{idProduct}=="0121", ENV{.MM_USBIFNUM}=="04", ENV{ID_MM_ZTE_PORT_TYPE_MODEM}="1"
ATTRS{idProduct}=="0121", ENV{.MM_USBIFNUM}=="01", ENV{ID_MM_ZTE_PORT_TYPE_AUX}="1"

In our ZTE rules we also have some for the device with PID 0x0002, like:

ATTRS{idProduct}=="0002", ENV{.MM_USBIFNUM}=="02", ENV{ID_MM_ZTE_PORT_TYPE_MODEM}="1"
ATTRS{idProduct}=="0002", ENV{.MM_USBIFNUM}=="04", ENV{ID_MM_ZTE_PORT_TYPE_AUX}="1"

And it seems that we can grab multiple PIDs from a single port, i.e. from the
parent objects in the hierarchy:

udevadm info -a -n /dev/ttyUSB4 | grep idProduct
    ATTRS{idProduct}=="0121"
    ATTRS{idProduct}=="0020"
    ATTRS{idProduct}=="0002"

Where that 0x0002 idProduct is not from the modem, but from the EHCI Host
Controller (with idVendor 0x1d6b in my case).

So... we end up seeing that both set of rules will apply to the ports, and we
misleadingly get:

    (ttyUSB3) type 'at' claimed by /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2
    ZTE: AT port 'tty/ttyUSB2' flagged as primary
    (ttyUSB2) type 'at' claimed by /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2
    ZTE: AT port 'tty/ttyUSB1' flagged as secondary
    (ttyUSB1) type 'at' claimed by /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2
    ZTE: AT port 'tty/ttyUSB4' flagged as primary
    b_port(): (ttyUSB4) type 'at' claimed by /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2
    (/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2) tty/ttyUSB2 at (primary)
    (/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2) tty/ttyUSB1 at (secondary)
    (/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2) tty/ttyUSB2 data (primary)
    (/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2) tty/ttyUSB0 qcdm

Which is wrong, as ttyUSB4 should have been our primary port, not ttyUSB2.

With this patch on, the rules apply only to the VID/PID pair, and we end up
getting what we really wanted:

    (ttyUSB3) type 'at' claimed by /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2
    (ttyUSB2) type 'at' claimed by /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2
    ZTE: AT port 'tty/ttyUSB1' flagged as secondary
    (ttyUSB1) type 'at' claimed by /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2
    ZTE: AT port 'tty/ttyUSB4' flagged as primary
    b_port(): (ttyUSB4) type 'at' claimed by /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2
    (/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2) tty/ttyUSB4 at (primary)
    (/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2) tty/ttyUSB1 at (secondary)
    (/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2) tty/ttyUSB4 data (primary)
    (/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2) tty/ttyUSB0 qcdm

https://bugzilla.gnome.org/show_bug.cgi?id=694759
2013-02-26 23:22:00 +01:00
Aleksander Morgado
89461cf7b3 iface-modem: allow falling back to 'failed' state
Allow mm_iface_modem_update_state() receive 'MM_MODEM_STATE_FAILED', and treat
it as any other change to failed state, but with
'MM_MODEM_STATE_FAILED_REASON_UNKNOWN'.
2013-02-26 21:17:43 +01:00
Aleksander Morgado
3f3950bd12 plugins: log about all port type hints received from udev 2013-02-26 21:02:12 +01:00
Aleksander Morgado
8d74b11bd3 plugin-manager: cancelled tasks are no longer deferred-until-suggested
The deferred-until-suggested tasks specify tasks that are open/ongoing;
cancelled tasks shouldn't have this flag set.

https://bugzilla.gnome.org/show_bug.cgi?id=694603
2013-02-25 15:28:47 +01:00
Ben Chan
8488782e14 iface-modem-3gpp: defer registration state update when registration is lost
This patch defers the update of 3GPP registration state by 15 seconds
when the registration state changes from 'registered' (home / roaming)
to 'searching'. This allows a temporary loss of 3GPP registration to
recover itself when relying on ModemManager to explicitly disconnect and
reconnect to the network.
2013-02-25 09:10:56 +01:00
Colin Walters
980ad52a47 build: Look for generated file in builddir, not srcdir 2013-02-25 08:51:50 +01:00
Aleksander Morgado
3f8b11e3f0 broadband-modem: fix CUSD response parsing
When reading the string reply in a +CUSD indication, don't blindly split
using whitespace or comma as field separator, as the string may be a text string
with both whitespaces and commas, e.g.:

+CUSD: 0,"hey hey, something here<LF>***<LF>and something more here"

Also, skip reading the encoding field for now, as we don't use it yet.
2013-02-22 21:54:57 +01:00
Aleksander Morgado
c19ee43cbe broadband-modem: avoid reading already freed memory in USSD operations 2013-02-22 21:49:19 +01:00
Aleksander Morgado
9976625f94 broadband-modem: USSD response may come even before finishing our request
MBM devices seem to include the '+CUSD: 0' indication before even returning OK to our '+CUSD=1'

(ttyACM0): --> 'AT+CUSD=1,"*111#",15<CR>'
(ttyACM0): <-- '<CR><LF>+CUSD: 0,"reply here"<CR><LF>'
(ttyACM0): <-- '<CR><LF>OK<CR><LF>'
2013-02-22 21:49:19 +01:00
Aleksander Morgado
b1bb8e30b4 broadband-modem: don't assume the returned string is always hex-encoded 2013-02-22 19:43:49 +01:00
Aleksander Morgado
ca49af0c5d mbm: fix CFUN result parsing 2013-02-22 17:54:16 +01:00
Aleksander Morgado
b22bba509a broadband-modem: increase default AT command timeout for USSD operations
May really take more than 3s.
2013-02-22 17:47:25 +01:00
Aleksander Morgado
50ecf2a7d9 mbm: implement custom modem_power_down()
Cache last valid allowed mode always, so that we re-use it when powering up
again.
2013-02-22 17:33:49 +01:00
Aleksander Morgado
c0ce165d09 mbm: implement custom load_power_state()
We need to handle modems which appear in low-power mode (e.g. CFUN=4), so
implement a custom check of the power state. We cannot use the default check
as MBM modems use CFUN also for allowed mode handling.
2013-02-22 16:35:56 +01:00
Aleksander Morgado
75d20c15d4 api: notify in the interface about the reason why the modem is FAILED
We currently implement 'SIM missing' and 'SIM error', which are probably the
most common ones.
2013-02-22 16:35:56 +01:00
Aleksander Morgado
a18140e8ed plugin: avoid using uninitialized variable
Reported by: Jose Maria Gonzalez <jmgonzalezc@indra.es>
2013-02-21 11:15:37 +01:00
Aleksander Morgado
0377ccaa59 manager: during initial scan, add new ports in idles
Treat each port independently in its own idle, as if we're receiving independent
udev events, otherwise, GSources may not be properly scheduled in the main loop.
2013-02-20 19:16:05 +01:00
Aleksander Morgado
5b072b9198 plugin: plug memleak
A new reference to probe was acquired through mm_device_get_probe(), just unref it
when no longer needed. Note that mm_port_probe_run() will take its own reference
for as long as required to complete the operation.
2013-02-20 17:00:14 +01:00
Aleksander Morgado
688bb2cb3a plugin: plug memleaks
This is really just to have a nice valgrind/memcheck output report, no big deal
if they were never freed.
2013-02-20 16:48:41 +01:00
Aleksander Morgado
9bef8531c1 iridium: use generic disconnection logic
The generic disconnection logic now already handles getting the port fully
closed and a wait time before reopening it, so no need for a custom
disconnection logic any more.
2013-02-20 16:07:02 +01:00
Aleksander Morgado
000bb64225 serial-port: allow specifying some wait time between closing and reopening
We will now by default wait some time (1s) between port getting fully closed and
the port being reopened again. This logic seems to work for multiple modems
where there is a single port for both AT and data, like my Nokia C7 and Iridium
modems. If this wait time is not applied, the port ends up returning EAGAIN for
every write that we try to do afterwards.
2013-02-20 15:54:54 +01:00
Aleksander Morgado
9a6fce0a08 serial-port: remove unneeded property name
Was incorrectly included in a previous commit
2013-02-20 11:41:53 +01:00
Aleksander Morgado
d0c18b4277 bearer-novatel-lte: fix reference counting of the 'data' port 2013-02-20 10:09:42 +01:00
Aleksander Morgado
2267fb0480 plugin: plug memleaks 2013-02-20 09:59:20 +01:00
Aleksander Morgado
f27737e031 bearer: plug memleak 2013-02-20 09:53:14 +01:00
Aleksander Morgado
061760a4f8 broadband-modem: plug memleak 2013-02-20 09:50:04 +01:00
Ben Chan
bb73ce0aaf iface-modem: fix modem state consolidation upon bearer disconnection
Patch "iface-modem: fix invalid modem state consolidation" (commit
69aff6183a) incorrectly consolidates the
modem state upon the disconnection of a bearer. The modem state remains
'connected' after the last bearer is disconnected. This patch fixes
that.
2013-02-20 09:17:08 +01:00
Evan Nemerson
add455c7e5 build: fix passing arguments to configure from autogen.sh (bgo #694157) 2013-02-19 09:19:11 -06:00
Aleksander Morgado
8fb57bb553 zte: load unlock retries with +ZPINPUK
e.g:

  AT+ZPINPUK=? |
               | ZPINPUK: 3,10
               | OK
2013-02-19 15:37:43 +01:00
Aleksander Morgado
5fe69d0ebb at-serial-port: plug memleak 2013-02-19 13:17:57 +01:00
Aleksander Morgado
f9583cb530 core: update logging levels of several messages
'info' log level, the default if none specified, included too many logs which
aren't that useful, to try to minimize the noise we produce by default.
2013-02-19 13:13:57 +01:00
Aleksander Morgado
37ddfe202e plugin-manager: log time required for device probing 2013-02-19 12:52:01 +01:00
Aleksander Morgado
ed2b32c682 plugin-manager: if minimum time consumed and all deferred tasks, abort probing
For the case where we just get a device with all net ports (i.e. all deferred
until result suggested), just abort the probing if the minimum probing time is
consumed.
2013-02-19 12:45:10 +01:00
Aleksander Morgado
1a11af0f86 broadband-bearer: fallback to primary AT port if no data AT port available
Spotted by Dan Williams <dcbw@redhat.com> with his ADU960S.
2013-02-19 09:50:52 +01:00
Aleksander Morgado
d593116d68 base-modem: don't run port init sequence if we're just sending a command
This may happen when sending commands to the modem while in non-enabled state,
like when sending the PIN. In this case, just send the command, don't fully
initialize the port with the initialization sequence.
2013-02-18 16:06:18 +01:00
Aleksander Morgado
7a58647af7 broadband-bearer: fully reopen data port before flashing
When disconnecting the data port, first fully close and reopen the port before
flashing. This helps with some modems where the flashing mechanism doesn't
fully work, like this ZTE modem:

    Before:
    [1360325270.357678] [mm-bearer.c:690] mm_bearer_disconnect(): Disconnecting bearer '/org/freedesktop/ModemManager1/Bearer/0'
    [1360325270.357796] [mm-iface-modem.c:1198] mm_iface_modem_update_state(): Modem /org/freedesktop/ModemManager1/Modem/1: state changed (connected -> disconnecting)
    [1360325270.358503] [mm-broadband-bearer.c:1539] disconnect_3gpp(): Sending PDP context deactivation in secondary port...
    [1360325270.358549] [mm-serial-port.c:927] mm_serial_port_open(): (ttyUSB4) device open count is 2 (open)
    [1360325270.358633] [mm-at-serial-port.c:392] debug_log(): (ttyUSB4): --> 'AT+CGACT=0,2<CR>'
    [1360325270.375131] [mm-at-serial-port.c:392] debug_log(): (ttyUSB4): <-- '<CR><LF>OK<CR><LF>'
    [1360325270.375251] [mm-serial-port.c:967] mm_serial_port_close(): (ttyUSB7) device open count is 1 (close)
    [1360325270.375282] [mm-serial-port.c:927] mm_serial_port_open(): (ttyUSB7) device open count is 2 (open)
    [1360325270.375300] [mm-broadband-bearer.c:1497] cgact_secondary_ready(): Flash primary port...
    [1360325270.375833] [mm-serial-port.c:967] mm_serial_port_close(): (ttyUSB4) device open count is 1 (close)
    [1360325271.377539] [mm-broadband-bearer.c:1455] primary_flash_3gpp_ready(): PDP disconnection already sent in secondary port
    [1360325271.377634] [mm-serial-port.c:967] mm_serial_port_close(): (ttyUSB7) device open count is 1 (close)
    [1360325271.377680] [mm-port.c:149] mm_port_set_connected(): (ttyUSB7): port now disconnected
    [1360325271.377721] [mm-bearer.c:623] disconnect_ready(): Disconnected bearer '/org/freedesktop/ModemManager1/Bearer/0'
    [1360325286.415396] [mm-serial-port.c:927] mm_serial_port_open(): (ttyUSB7) device open count is 2 (open)
    [1360325286.415510] [mm-at-serial-port.c:392] debug_log(): (ttyUSB7): --> 'AT+ZPAS?<CR>'
    [1360325287.400589] [mm-broadband-modem.c:1717] modem_load_signal_quality(): loading signal quality...
    [1360325287.400679] [mm-serial-port.c:927] mm_serial_port_open(): (ttyUSB7) device open count is 3 (open)
    [1360325289.401873] [mm-iface-modem.c:762] access_technologies_check_ready(): Couldn't refresh access technologies: 'Serial command timed out'
    [1360325289.401940] [mm-serial-port.c:967] mm_serial_port_close(): (ttyUSB7) device open count is 2 (close)
    [1360325289.401998] [mm-at-serial-port.c:392] debug_log(): (ttyUSB7): --> 'AT+CIND?<CR>'
    [1360325292.403162] [mm-serial-port.c:927] mm_serial_port_open(): (ttyUSB7) device open count is 3 (open)
    [1360325292.403247] [mm-serial-port.c:967] mm_serial_port_close(): (ttyUSB7) device open count is 2 (close
    ...

    After:
    [1360326617.604527] [mm-bearer.c:690] mm_bearer_disconnect(): Disconnecting bearer '/org/freedesktop/ModemManager1/Bearer/0'
    [1360326617.604622] [mm-iface-modem.c:1198] mm_iface_modem_update_state(): Modem /org/freedesktop/ModemManager1/Modem/0: state changed (connected -> disconnecting)
    [1360326617.605006] [mm-broadband-bearer.c:1535] disconnect_3gpp(): Sending PDP context deactivation in secondary port...
    [1360326617.605034] [mm-serial-port.c:929] mm_serial_port_open(): (ttyUSB4) device open count is 2 (open)
    [1360326617.605088] [mm-at-serial-port.c:392] debug_log(): (ttyUSB4): --> 'AT+CGACT=0,2<CR>'
    [1360326617.620075] [mm-at-serial-port.c:392] debug_log(): (ttyUSB4): <-- '<CR><LF>OK<CR><LF>'
    [1360326617.620206] [mm-broadband-bearer.c:1493] cgact_secondary_ready(): Flash primary port...
    [1360326617.620241] [mm-serial-port.c:1334] mm_serial_port_flash(): (ttyUSB7) reopening before flash (2)
    [1360326617.620265] [mm-serial-port.c:969] mm_serial_port_close(): (ttyUSB7) device open count is 1 (close)
    [1360326617.620286] [mm-serial-port.c:969] mm_serial_port_close(): (ttyUSB7) device open count is 0 (close)
    [1360326617.620320] [mm-serial-port.c:985] mm_serial_port_close(): (ttyUSB7) closing serial port...
    [1360326617.620356] [mm-port.c:149] mm_port_set_connected(): (ttyUSB7): port now disconnected
    [1360326617.621355] [mm-serial-port.c:1017] mm_serial_port_close(): (ttyUSB7) serial port closed
    [1360326617.621403] [mm-serial-port.c:860] mm_serial_port_open(): (ttyUSB7) opening serial port...
    [1360326617.622836] [mm-serial-port.c:417] real_config_fd(): (ttyUSB7): port attributes not fully set
2013-02-18 15:41:26 +01:00
Aleksander Morgado
553bebe825 serial-port: new method to reopen a port
We will fully close the port and the re-open it again keeping the same
open_count that we had before.
2013-02-18 15:41:26 +01:00
Aleksander Morgado
f8e3a8adb9 broadband-bearer: try to run CGACT first on the primary port
It may happen that the primary port is not the data port; if so, try with the
primary port first, and otherwise fallback to the secondary port.
2013-02-18 15:41:26 +01:00
Aleksander Morgado
92f0c579c4 broadband-bearer: update disconnection logic
We were maintaining the port we used for dialling (the data port) open during
the connection, as specified by the CDMA or 3GPP specific logic. We'll now close
that open count reference ourselves within the CDMA or 3GPP disconnection logic
itself.
2013-02-18 15:41:26 +01:00
Aleksander Morgado
b6402a4e21 bearer,3gpp: dial operation specifies which data port to use
Instead of deciding in advance which data port to use, we let the dialling
operation gather it. For the generic dialling logic, ATD-based, always an
'AT' port will be used as data port, even if we grabbed a 'net' port. Those
plugins that can work with 'net' ports will grab the specific 'net' port
themselves.
2013-02-18 15:41:26 +01:00
Aleksander Morgado
15d34d56fd bearer: new helper 'MMBearerConnectResult' type
Instead of returning 3 variables in connect_finish(), return a single reference
counted struct. This simplifies how the result is built and passed within a
GSimpleAsyncResult to each _finish() method.

This also simplifies the dialling step in the 3GPP connection sequence, as we
can use the same new type.
2013-02-18 15:41:26 +01:00
Aleksander Morgado
1746949277 ports: add port initialization sequences instead of iface-modem's modem_init()
Instead of a custom modem_init() step in the 'Modem' interface, just add a
sequence of port initialization commands in each port.

While enabling for the first time a non-hotplugged modem, we will issue the
port initialization commands only after having run the enabling_modem_init()
step (i.e. after ATZ usually).
2013-02-18 13:47:35 +01:00
Aleksander Morgado
be37f41f06 at-serial-port: new properties to define and manage a set of init commands
We are now able to specify a list of AT commands to be run whenever the port is
opened for the first time (i.e. open_count from 0 to 1). These commands are
to be treated as a 'port initialization' sequence, where port-configuration
specific AT commands are defined (e.g. ATE0).
2013-02-18 13:47:35 +01:00