Commit Graph

899 Commits

Author SHA1 Message Date
Dan Williams
ca97f0e79f broadband-modem-sierra: fix trivial copy & paste error 2013-03-27 18:02:50 -05:00
Dan Williams
95b46c16f1 broadband-modem-sierra: add after-sim-unlock delay
Older devices may crash if asked to connect right after sending the
PIN and unlocking the SIM; they simply stop responding to AT commands
around the first request for access technology and then reboot.  A
delay seems prevents this behavior.

Since it's not uncommon to require a delay after SIM unlock, add one
for newer sierra_net devices as well, even though we're not quite
sure if they need one or not.  It doesn't hurt, at least.
2013-03-25 15:49:08 -05:00
Dan Williams
8ebce66f96 sierra: fix time check warnings for modems that don't support time
'result' may be NULL even if no error is set.  Errors aren't set
because we want to continue the !TIME/!SYSTIME sequence regardless
of errors, so we can figure out which command the modem supports.

Trying to get a uint32 out of a NULL GVariant makes glib complain,
and it's wrong, so don't do that.
2013-03-25 15:08:31 -05:00
Aleksander Morgado
4e6400d3c8 zte: add port type hints for the ZTE MF195
https://bugzilla.gnome.org/show_bug.cgi?id=691480
2013-03-12 18:48:45 +01:00
Aleksander Morgado
14c03f98ad mbm: fix 3gpp dialling sequence when result comes through polling 2013-03-05 20:47:58 +01:00
Aleksander Morgado
144cc7011e mbm: tag the ttys instead of the parent usb device
We can just tag the ttys instead of the parent usb device, so that the core
logic which looks in the plugin-specified port tags works properly. There is no
need to explicitly tag the net port, as the probing for this port ends when a
plugin suggestion comes from another port probing on the same device.
2013-03-05 20:32:03 +01:00
Gerald Richter
113916beb5 sierra: add MC8790 to APP1 PPP whitelist 2013-03-04 08:32:23 -06: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
3f3950bd12 plugins: log about all port type hints received from udev 2013-02-26 21:02:12 +01:00
Aleksander Morgado
ca49af0c5d mbm: fix CFUN result parsing 2013-02-22 17:54:16 +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
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
d0c18b4277 bearer-novatel-lte: fix reference counting of the 'data' port 2013-02-20 10:09:42 +01: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
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
30639606d3 broadband-modem: new step during 'enabling_started' to initialize the modem
We previously had the modem initialization command merged with some other port
setup commands in the 'modem_init' step of the 'Modem' interface. Instead of
doing this, we now split the logic into two separate steps:

A first 'enabling_modem_init' modem initialization step is to be run just after
the ports have been opened, but only during the first enabling operation, and
only if the modem was not hotplugged. A hotplugged modem is assumed to be
properly initialized already, so no need to ATZ-it. Also, we will now wait 500ms
by default after the modem initialization command has been sent, to let it
settle down.

The second 'modem_init' step will be run during the 'Modem' interface
initialization, and it currently only holds specific setup of the primary and
secondary serial ports. We'll be modifying this logic a bit in the next commits,
so no big deal to have that step name unchanged.
2013-02-18 13:47:34 +01:00
Dan Williams
253242256c broadband-modem-longcheer: fix getting and setting of allowed modes
When setting allowed modes, a ",2" crept into the MODODR command when
porting the plugin from 0.6.  That shouldn't be there.

When getting allowed modes, 2 is UMTS preferred and 4 is GSM preferred,
which the previous code combined into only UMTS preferred.
2013-02-15 13:40:01 -06:00
Aleksander Morgado
5860de182d sierra: fix access tech reporting logic 2013-02-08 12:08:44 +01:00
Dan Williams
cd2545c2b6 broadband-modem-mbm: handle HSPA access technology in ERINFO response
HSUPA/HSPA capable devices (ex F5521gw) can report '3' here, which
we'll decide to interpret as HSPA.  It might actually be HSDPA + HSUPA,
but whatever...
2013-02-07 12:49:55 -06:00
Dan Williams
a4ad95e3da broadband-modem-longcheer: fix handling of preferred modes
Treat NONE the same as ANY and handle specific preferred modes too.
2013-02-06 16:18:51 -06:00
Dan Williams
34da83450e anydata: support QMI-based devices
Some devices (like the ADU960S) support QMI, so if the modem has a
QMI port, use it.
2013-02-06 12:00:04 -06:00
Dan Williams
90ecbe325a broadband-modem-novatel: read HDR revision for access technology
Specialize what the superclass gave us, if we can.
2013-02-06 11:57:00 -06:00
Dan Williams
8253d6f9de broadband-modem-novatel: use ERI subsystem information to better determine roaming
We use the Icon ID here because a value of 1 *always* means not roaming,
while the other values don't appear to be consistent.  For example,
an ERI value of "0" is supposed to mean roaming according to the
standards, but the Novatel devices appear to use 0 to mean home.
Since we're not sure, don't depend on the ERI value itself, just
depend on the Icon ID, where we know for sure that 1 means "home".
2013-02-06 11:57:00 -06:00
Ben Chan
86fcfe3121 novatel-lte: use +CFUN=4 for power down 2013-01-30 23:12:10 +01:00
Ben Chan
87a556dbb1 novatel-lte: retry $NWQMISTATUS check upon error during disconnect
$NWQMISTATUS sometimes returns 'ERROR'. This patch modifies the Novatel
LTE plugin to retry $NWQMISTATUS (up to 5 times) to determine if the
disconnect operation succeeds. It also changes the plugin to assume that
the disconnect operation succeeds if $NWQMISTATUS fails to report the
current connection status.
2013-01-30 23:11:59 +01:00
Ben Chan
9474654f67 novatel-lte: skip soft reset if modem is newly plugged in
Soft resetting a Novatel LTE modem can a significant amount of time
(3-4 seconds). If the modem is newly plugged in, skip the unnecessary
soft reset when enabling the modem.
2013-01-18 11:27:58 +01:00
Aleksander Morgado
2550cb20a9 huawei: only retry DHCP? check on specific errors
We don't want to retry DHCP? on every possible GError reported; specially if the
error is about the port being forced to get closed when the modem gets
unplugged or the like. So just retry on very specific errors reported.

The main cause for retry is really when the modem replies the following:
-->  AT^DHCP?
<--  ERROR

Which in our case gets translated to a 'unknown' mobile equipment error. We'll
also consider any kind of mobile equipment error, as the modems may reply a
CME ERROR instead.
2013-01-16 10:56:53 +01:00
Aleksander Morgado
2b3f353770 huawei: check NDISDUP support only once 2013-01-16 10:56:53 +01:00
Aleksander Morgado
f2a9ea3779 huawei: use NDISDUP only if net port from cdc_ncm or cdc_ether 2013-01-16 10:56:53 +01:00
Aleksander Morgado
8c5bd6375f huawei: refactor the connection and disconnection sequences in the bearer
We will now use a step-based state machine to handle the connection and
disconnection sequences. All the previous behaviour is kept, except for these
new things:

 * Instead of just subclassing the 'dialling' step in the 3GPP connection
   sequence, completely subclass the whole 3GPP connection sequence. We do this
   because we don't need to preconfigure PDP contexts with AT+CGDCONT before
   issuing ^NDISDUP.

 * Don't allow IP types other than IPv4. These modems work only with IPv4
   bearers.

 * Remove cancellation signal handler; not needed as we can check the status of
   the cancellation in every 1s timeout.

 * Removed the event source id handling for timeouts; timeouts are never
   cancelled here.
2013-01-16 10:56:53 +01:00
Aleksander Morgado
2499f5760b huawei: explicitly check for the ^NDISDUP command support
Don't assume that all modems exporting a 'net' port will support ^NDISDUP.
2013-01-16 10:56:53 +01:00
Franko Fang
696403e50a huawei: handle modems exposing 'net' ports with AT^NDISDUP
Modems with ECM (e.g. usb0) ports should use AT^NDISDUP in the control port to
request the connection and afterwards just fire up the DHCP client in the net
port.

This patch is originally developed by:
  Franko Fang <fangxiaozhi@huawei.com>

And afterwareds reviewed and updated by:
  Aleksander Morgado <aleksander@gnu.org>
2013-01-16 10:56:53 +01:00
Dan Williams
fc4034a72f broadband-modem-sierra: implement access technology reporting for CDMA devices
Use AT!STATUS to grab current access technology.
2013-01-14 13:50:26 -06:00
Dan Williams
56bdf4a37b broadband-modem-sierra: make CDMA AT!STATUS parsing code generic
We'll use it for access technology reporting too.
2013-01-14 13:50:26 -06:00
Dan Williams
b68a487e15 broadband-modem-sierra: don't check +CAD and +CSS for CDMA devices
We have !STATUS for that, which is much more detailed.  Use it.
2013-01-14 13:50:26 -06:00
Dan Williams
48b36b1afa broadband-modem-sierra: load own numbers via ~NAMVAL?0 for CDMA
Sierra CDMA devices don't always have QCDM ports, or if they do,
they aren't always usable.  Try Sierra-proprietary commands for
loading the modem's MDN and fall back to QCDM if that fails.
2013-01-14 13:50:26 -06:00
Dan Williams
f7d55a688a broadband-modem-novatel: fix signal strength processing for older devices
mm_get_int_from_str() does not allow anything in the string after the
number, eg "-91  asdfasdf" returns an error.  So we have to chop off
anything after the number we're interested in.
2013-01-14 13:50:26 -06:00
Aleksander Morgado
2bd4c63716 hso: remove duplicated code 2013-01-14 20:09:47 +01:00
Aleksander Morgado
9a07688524 huawei: check with next port if the first one is not AT 2013-01-11 16:13:55 +01:00
Aleksander Morgado
0f9873c23a sierra: load power state with !pcstate? in cdma-only modems 2013-01-11 11:21:08 +01:00
Aleksander Morgado
eec5d00a97 core,plugins: remove initial power down sequence
We no longer power down the modem during initialization, so remove that
implementation.
2013-01-11 10:05:46 +01:00
Aleksander Morgado
7c87555bf8 mbm: force initial power-up during first enabling
When both load_power_state() and modem_power_down() are not implemented, the
logic will launch the power-up command during (only the first) enabling of the
modem.

In this kind of modems, CFUN is directly related to allowed/preferred modes, so
during the initial power-up we'll just assume we want ANY mode.
2013-01-11 10:05:46 +01:00
Aleksander Morgado
5d02361501 iridium: ignore initial power state loading
No need to initially power-up the modem.
2013-01-11 10:05:45 +01:00
Aleksander Morgado
923d4dd8bd motorola: ignore initial power state loading
No need to initially power-up the modem.
2013-01-11 10:05:45 +01:00
Aleksander Morgado
f79f3b8770 nokia: ignore initial power state loading
No need to initially power-up the modem.
2013-01-11 10:05:45 +01:00
Aleksander Morgado
9f5cfefb00 sierra: in 3GPP, no need to check if already powered up before powering up
This logic is now implemented by the parent broadband modem object.

Also, implement a custom initial power state loading, so that CDMA-only modems
get marked as 'offline', in order to launch !pcstate=1 to power them up during
the first enabling. The custom initial power state loading will run the parent's
implementation in non-CDMA-only modems.
2013-01-11 10:05:45 +01:00
Aleksander Morgado
e3db373be4 wavecom: no need to check if already powered up before powering up
This logic is now implemented by the parent broadband modem object.
2013-01-11 10:05:45 +01:00