Commit Graph

10 Commits

Author SHA1 Message Date
Dan Williams
6ca5765eb6 core: add chaining helper functions to callback info
Helpful when chaining a number of commands together when you want
to schedule the callback info only after all of them complete.
2010-03-19 10:54:10 -07:00
Dan Williams
50ad39b28e core: protect against modem removal in critical callbacks (rh #553953)
There are more places to handle, but these are the most critical.  If
the modem is removed while a command is in-progress, the mm-callback-info
code will set info->modem to NULL.  Make sure we check for that in
callbacks and return a reasonable error.  Previous code would just
blindly forge ahead and die on a null dereference.
2010-01-19 03:18:10 -08:00
Dan Williams
5a4a9a6239 core: add refcounts to MMCallbackInfo 2009-12-07 18:39:18 -08:00
Dan Williams
8dd2421e9c core: don't allow double-scheduled callbacks
If the modem becomes invalid (it crashes and resets, for example)
the callback-info's modem_destroyed_cb() function will handle
cleanup.  Buf if the callback-info's callback does more work than
just returning the result (like simple_state_machine) it could
double-schedule the callback.  Don't let that happen.

We need better modem-removal handling, but this fixes a crash for
now.
2009-11-26 13:40:32 -08:00
Dan Williams
c0253c7c29 core: convert MMCallbackInfo modem refs to weak refs
Full references prevented destruction of the modem object if
it was unplugged or somehow removed.  To fix that using full
references on the modems would require that all usage of
MMCallbackInfo to be aware of the validity of the modem and to
ensure the callback was called whenever the modem became invalid.
That, needless to say, would suck.  Since any in-progress calls
can't complete when the modem is invalid anyway, just have the
MMCallbackInfo object return a generic error when the modem goes
away and the call is still in-progress.
2009-10-12 19:51:10 -07:00
Alexander Sack
12ac98e9f6 license: add license header to all files and set copyright based on git log 2009-08-06 12:43:51 +02:00
Tambet Ingo
d1d94de6a1 Lots of random fixes:
Rework the MMCallbackInfo callback invocation.
Always use g_error_literal() where it makes sense.
Replace sleep() calls, with timeouts to not block the whole MM.
2008-12-09 15:41:51 +02:00
Tambet Ingo
ac4409e7ce Rewrite serial device communications.
Instead of vague "send something, wait something" the responses are now
analyzed by (overridable) parsers. Makes all the modem implementations much
easier since each caller knows without any code whether the call succeeded
or failed.

Another thing that makes modem code simpler (and the whole thing more robust),
is the queueing of sent commands. Each queued command has a command and a
callback which is quaranteed to get called, even if sending failed.

Define and implement error reporting.
2008-09-11 08:35:32 +03:00
Tambet Ingo
1bb60347b5 Implement reading IMEI, IMSI, manufacturer, model, and version (revision). 2008-09-01 15:45:55 +03:00
Tambet Ingo
cc31458b18 Initial commit. 2008-07-31 09:43:00 +03:00