Commit Graph

81 Commits

Author SHA1 Message Date
Aleksander Morgado
494a70a8ff core: handle the 'usb'->'usbmisc' subsystem rename in the kernel
We'll try to cope with getting devices being reported in either 'usb' or
'usbmisc', trying to avoid the need of checking kernel version during runtime.
2012-08-29 17:26:46 +02:00
Aleksander Morgado
306b4eb509 core: allow grabbing QMI ports 2012-08-29 17:14:47 +02:00
Aleksander Morgado
3b1d3063ba manager: remove the MMDevice object when the last port of the device is released 2012-08-06 20:06:47 +02:00
Aleksander Morgado
8ae87f5c38 manager: fix removal of device from our HT of devices 2012-08-06 20:06:47 +02:00
Aleksander Morgado
61e285497c port-probe-cache: removed, no longer needed
The `MMDevice' acts as port probe cache for us now, directly storing all port
probes of the same device.
2012-08-06 20:06:45 +02:00
Aleksander Morgado
e8339385da manager: use the new method to check support of a given full device 2012-08-06 20:06:45 +02:00
Aleksander Morgado
0aff871b04 device: split `MMDevice' creation and plugin setting
We want to be able to create the MMDevice way before we have decided which
plugin to use.
2012-08-06 20:06:44 +02:00
Aleksander Morgado
815693661c core: compile all ports before creating the modem object
Before this, we only exported the modem to DBus when all ports were organized,
in order to make sure that we select as primary port the one we really want and
not the first AT port grabbed. Given that to get all the ports organized we also
needed to wait to get all the ports grabbed, we can now also defer the creation
of the modem object until all the ports get grabbed. This allows us to create
different types of objects based on the ports available (e.g. we can now create
QMI-supported modem objects if we see a QMI port around).
2012-08-06 20:06:44 +02:00
Aleksander Morgado
cfeebcd63a manager: no need to remove modems in idle
There is no problem in getting the modem removed just after finishing the
disabling sequence.
2012-03-30 16:18:48 +02:00
Aleksander Morgado
3094e3f26b manager: try to get all modems disabled before while shutting down 2012-03-30 16:11:55 +02:00
Aleksander Morgado
0372e73abd port-probe-cache: ensure we cleanup every possible leftover 2012-03-30 13:47:00 +02:00
Aleksander Morgado
c52762ea67 build: require gudev >= 147
Since udev 147 the gudev API is no longer marked as experimental, and therefore
`G_UDEV_API_IS_SUBJECT_TO_CHANGE' is no longer needed.
2012-03-16 14:53:25 +01:00
Aleksander Morgado
d5deb2bb14 manager: use new simplified authentication setup 2012-03-16 14:53:15 +01:00
Aleksander Morgado
85dc060c82 manager: print modem debug info as soon as it gets exported 2012-03-15 14:15:05 +01:00
Aleksander Morgado
8b7b614105 core: rework port grabbing and organization
Make port roles more flexible.  We have modems that do PPP
on interfaces other than the primary interface, and that
wasn't possible with the old code.  So clean up all that
logic and move the port organization code into the core
so we can reduce code in the plugins.

In the new world order, the plugins say whether the port
is a QCDM port, an AT port, or ignored.  If it's an AT
port the plugins get to tag it as primary, secondary, or
PPP, or any combination of the 3.  This allows for modems
where PPP should really be done on the secondary port
(Huawei E220, Sierra devices) so that the primary port
stays open for command and status.

After all ports are grabbed by the generic classes, they get
"organized", which assigns various ports to the roles of
PRIMARY, SECONDARY, DATA, and QCDM based on specific rules
and hints that the plugin provided (which are expressed as
MMAtPortFlags).

The plugin code is responsible for determining the port
hints (ie MMAtPortFlags) at probe time, instead of having
a combination of the plugin and the modem class do the
job.  This simplifies things greatly for the plugins at
the expense of more complicated logic in the core.

This is the port of commit 96505d42ed62327101dcee7c2bf31177b0bb1c9f
to the 06-api branch.
2012-03-15 14:15:05 +01:00
Aleksander Morgado
885042e365 api,header: define common object prefixes in the daemon header 2012-03-15 14:14:55 +01:00
Dan Williams
713937f1f0 manager: make sure modems get exported when all their ports are finished
My LG Rumor2 phone (ttyACM0 - AT, ttyUSB0 - QCDM) was never getting
exported after the QCDM port finished probing.  Not entirely sure
why, but we should check whether we need to export a modem or not
any time a port gets grabbed.
2012-03-15 14:14:48 +01:00
Aleksander Morgado
51dc93e3d5 manager: plug small leak 2012-03-15 14:14:41 +01:00
Aleksander Morgado
b7960f82ac manager: don't try to export already exported modems 2012-03-15 14:14:34 +01:00
Aleksander Morgado
c58db4e015 core: start using our newly defined errors 2012-03-15 14:14:25 +01:00
Aleksander Morgado
86aa9df849 core: start using MMBroadbandModem objects
We chain up the Generic plugin created MMBroadbandModem objects within the
GDBusObjectManagerServer in MMManager, so that they get properly exported in
DBus.
2012-03-15 14:14:24 +01:00
Aleksander Morgado
07640b0c74 manager: make it export the Object Manager interface 2012-03-15 14:14:21 +01:00
Aleksander Morgado
0cc17ed82f manager: let it be initable
The MMManager object creation may fail due to environment reasons (i.e. no
plugins found, or problems exporting DBus interfaces), so we can use the
initable interface to properly handle those situations.
2012-03-15 14:14:21 +01:00
Aleksander Morgado
bc78453d79 manager: keep the GDBus connection reference in a 'connection' property 2012-03-15 14:14:21 +01:00
Aleksander Morgado
68fcfa4530 manager: use G_TYPE_INSTANCE_GET_PRIVATE() just to create the private struct
A new 'priv' pointer is added in the MMManager struct, which will contain the
address of the private structure.
2012-03-15 14:14:21 +01:00
Aleksander Morgado
60c7f7d9ee core: implement the Manager1 DBus interface, based on GDBus
The MMManager object now derives from the gdbus-codegen-generated
MmGdbusOrgFreedesktopModemManager1Skeleton object, and implements the handlers
for the SetLogging() and ScanDevices() DBus methods.

The main program is also modified to be based on GDBus.
2012-03-15 14:14:21 +01:00
Aleksander Morgado
d9b2b6f8ec manager: clear cached port probe when device is removed 2012-03-15 14:14:21 +01:00
Aleksander Morgado
916cf5dd3e manager: integrate the Plugin Manager
All plugin handling and port support checks now done by the Plugin Manager.
2012-03-15 14:14:20 +01:00
Aleksander Morgado
62030debf2 plugin-base: rename 'cancel_supports_port' to 'supports_port_cancel'
We now have 'supports_port' (async method) and 'supports_port_finish' (to get
the result of the async method), so it makes sense to rename the method to
'supports_port_cancel'.
2012-03-15 14:14:19 +01:00
Aleksander Morgado
dc30536456 plugin-base: rewrite port supports check as fully asynchronous
Before this change, supports check was either synchronous (e.g. in some
UNSUPPORTED cases) or asynchronous (when IN_PROGRESS was returned).

With this fix, the supports check requested to the plugin will always be
completed asynchronously; either directly in an idle before launching any real
probing operation, or once the probing operation is finished.

Therefore, it is not expected to get a IN_PROGRESS reply in
mm_plugin_supports_port_finish(), only UNSUPPORTED|SUPPORTED|DEFERRED.
2012-03-15 14:14:19 +01:00
Aleksander Morgado
d47176a32c core: avoid using DBusGMethodInvocation in auth API
While porting to GDBus, use opaque pointers. This allows us to include either a
DBusGMethodInvocation or a GDBusMethodInvocation in the 'context' pointer.

Once fully ported to GDBus, we can safely change it back to make the context be
a GDBusMethodInvocation.
2012-03-15 14:14:19 +01:00
Dan Williams
4dad94d500 core: rework port grabbing and organization
Make port roles more flexible.  We have modems that do PPP
on interfaces other than the primary interface, and that
wasn't possible with the old code.  So clean up all that
logic and move the port organization code into the core
so we can reduce code in the plugins.

In the new world order, the plugins say whether the port
is a QCDM port, an AT port, or ignored.  If it's an AT
port the plugins get to tag it as primary, secondary, or
PPP, or any combination of the 3.  This allows for modems
where PPP should really be done on the secondary port
(Huawei E220, Sierra devices) so that the primary port
stays open for command and status.

Modem subclasses no longer get asked to handle port grabbing
themselves.  Instead, that's now done by the generic classes
(MMGenericCdma and MMGenericGsm) and the plugins are notified
when a port is grabbed so they can add unsolicited response
handlers for it.  After all ports are grabbed by the generic
classes, they get "organized", which assigns various ports
to the roles of PRIMARY, SECONDARY, DATA, and QCDM based
on specific rules and hints that the plugin provided (which
are expressed as MMAtPortFlags).  The plugins then have
a chance to perform fixups on the primary port if they choose.

The plugin code is responsible for determining the port
hints (ie MMAtPortFlags) at probe time, instead of having
a combination of the plugin and the modem class do the
job.  This simplifies things greatly for the plugins at
the expense of more complicated logic in the core.
2012-02-28 10:06:04 -06:00
Dan Williams
dec9cc66eb core: register SMS errors with dbus-glib 2012-01-16 14:11:25 -06:00
Nathan Williams
1b73fa1541 Add a DBus interface for setting the log level.
Lifted almost entirely from similar code in NetworkManager.

BUG=chromium-os:15197
TEST='dbus-send --print-reply --system --dest=org.freedesktop.ModemManager /org/freedesktop/ModemManager org.freedesktop.ModemManager.SetLogging string:DEBUG'
Also try valid log levels 'ERR', 'WARN', 'INFO', and an invalid log level, such as 'ABCDE'.

Change-Id: I2bddcd0319f4966dd293b119f68e7cc1697949b7
Reviewed-on: http://gerrit.chromium.org/gerrit/3134
Tested-by: Nathan J. Williams <njw@chromium.org>
Reviewed-by: Eric Shienbrood <ers@chromium.org>
2011-06-30 12:25:02 -05:00
Dan Williams
6657e45a1e core: trivial whitespace cleanup
Tabs -> spaces
2011-06-09 16:53:05 -05:00
Nathan Williams
9f8d42a994 core: handle udev 'change' events
That's what the udev replay gives us these days (as of udev-152).
2011-06-09 16:51:35 -05:00
Aleksander Morgado
f2ba435446 manager: protect ScanDevices() d-bus method with manager control policy rule 2011-06-06 17:20:17 +02:00
Aleksander Morgado
3fb53d3348 manager: new ScanDevices() d-bus method to request a new device scan loop 2011-06-06 17:20:17 +02:00
Aleksander Morgado
df0d9b480c plugin base: let plugins decide if they should be sorted last
Note that even if a plugin says it wants to be sorted last, the generic plugin
will always be the last one. Also, there is no order guaranteed between two
plugins that request to be sorted last.
2011-06-06 17:20:17 +02:00
Aleksander Morgado
673005e602 manager: avoid assertion warning when enumerating devices 2011-05-09 18:21:46 +02:00
Dan Williams
3ee40ddbce core: add logging when ports get removed 2011-01-24 00:05:20 -06:00
Dan Williams
16039244bb core: rework logging
Make it more flexible, add logging to a file, and absolute and
relative timestamps.
2011-01-23 20:51:48 -06:00
Dan Williams
592d71ff76 core: work around udev parallel startup race
Ignore devices that aren't completely configured by udev yet.  If
ModemManager is started in parallel with udev, explicitly requesting
devices may return devices for which not all udev rules have yet been
applied (a bug in udev/gudev).  Since we often need those rules to match
the device to a specific ModemManager driver, we need to ensure that all
rules have been processed before handling a device.

Do this by adding an item to the environment of each device that MM
might possibly be interested in, and ignoring devices that don't
have that.  When the device is fully processed by udev, MM will get
an 'add' event and the device will have all rules applied.
2010-12-08 17:04:59 -06:00
Dan Williams
46106660fe core: print out modem hardware VID/PID and subsystem 2010-10-22 11:34:55 -05:00
Dan Williams
5fc9f259e2 trivial: print out useful debugging info before asserting 2010-06-24 09:19:55 -07:00
Dan Williams
adfe264b67 core: ensure claimed ports don't fall back to Generic (rh #597296)
Found by jklimes.  If some plugin already supports this port, it's
pointless to let Generic figure out if it supports the port since
we're just going to hand it to the other plugin anyway.
2010-06-22 01:58:54 -07:00
Dan Williams
b8f0f40349 core: fix memory leaks
Since MMModem is an interface and doesn't store stuff like the
modem's physdev internally (since it's an interface) these things
are handled via GObject properties.  And since g_object_get()
returns allocated values, we need to free the returned value
from mm_modem_get_device() after we're done with it.
2010-05-07 13:56:23 -07:00
Dan Williams
f63188eb26 core: log modem data port 2010-05-05 01:04:20 -07:00
Dan Williams
26a3fe3f53 trivial: use property name constant 2010-05-04 17:31:22 -07:00
Dan Williams
1864d8da07 core: add platform device support and whitelist 2010-04-29 12:17:56 -07:00