Commit Graph

235 Commits

Author SHA1 Message Date
laforge c20bdfa5ea Implement GSMD version printout (Matt Mets <matt.mets@cibomahto.com>)
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2727 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-08-17 08:33:56 +00:00
laforge c5eec55398 SIM Phonebook access implementation.
This patch adds primitive-but-working support for SIM phonebook access,
including phonebook memory storage and entry read/write/delete.  Also,
libgsmd-tools shell is modified to perform listing actions.

API changes:
	lgsm_pb_read_entryies -> lgsm_pb_read_entries
	lgsm_pb_list_storage (new):
		List of supported phonebook memory storage.
	lgsm_pb_set_storage (new);
		Select phonebook memory storage.

	lgsmd_pb_del_entry -> lgsm_pb_del_entry
	lgsmd_pb_write_entry -> lgsm_pb_write_entry


git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2726 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-08-17 08:32:50 +00:00
laforge 86c7ff07f1 From: Andrzej Zaborowski <balrog@zabor.org>
Date: Tue, 31 Jul 2007 22:26:36 +0200
Subject: [PATCH] Operations on the preferred operators list.

This makes use of the AT+CPOL variants to add / delete / list entries in the
preferred operators list on the SIM.  There's some inconsistency, similarly as
with operator selection, in that we return operator names in long
alphanumeric format but we take only operators in numeric format as
parameters.  Either the client will have to convert between the formats or
we should always use for example the long alphanumeric format, or maybe
do something else.


git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2725 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-08-17 08:32:14 +00:00
laforge 34fbfd275b From: Andrzej Zaborowski <balrog@zabor.org>
Date: Tue, 31 Jul 2007 22:28:28 +0200
Subject: [PATCH] Correctly split long usock reads into packets.

This is a patch for an unrelated to the above discussion timing issue in
libgsmd. In particular, when the modem responds fast enough, gsmd generates
usock packets fast enough for libgsmd to read multiple packets in a single read
and concatenate them thus discarding all packets but first. This happens on
Neo1973 when requesting for example the list of preferred operators or all
operators or, sometimes, list of short messages.


git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2724 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-08-17 08:31:49 +00:00
laforge be174b7816 From: Andrzej Zaborowski <balrog@zabor.org>
Date: Fri, 27 Jul 2007 19:39:15 +0200
Subject: [PATCH] Cell Broadcast message decoding and presentation in libgsmd-tool.

This time Cell Broadcast is tested to work, I should have made tests earlier. 
Now I'm correctly getting a CB message with the human readable name of the city
and district when I'm connecting.  In the previous patches the CB PDU was not
being decoded at all.


git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2723 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-08-17 08:31:21 +00:00
laforge 90bf3b4473 From: Andrzej Zaborowski <balrog@zabor.org>
Date: Fri, 27 Jul 2007 14:29:44 +0200
Subject: [PATCH] Multiline unsolicited responses parsing.

+CMT, +CBM and +CDS responses two lines long in PDU mode and the parser has
problem with them.  As it was mentioned earlier there's no way for the parser
to know if a new line is part of the most recent command response or
unsolicited response, or a completely new unsolicited response, without looking
at the contents of the first line.  My idea is that the parser for the
particular response decides if the response is too short, and returns -EAGAIN
in which case the AT parser will append the following line to the response and
resubmit it to the response parser.  The disadvantage is that the generic
parser gets one more special case to remember about, but it works quite well,
hopefully there are no more cases where we will need to modify the parser.  (We
may need to use a separate multiline buffer (like the current mlbuf variable)
to account for situations when a multiline unsolicited response comes in the
middle of receiving a different response, which is also possible.  Also, mlbuf
should probably be moved into the parser state struct instead of being a
global).

This patch also moves initialisation of SMS options to after we are registered
to the network, so that we don't get errors from the modem.  Perhaps we want to
have a dynamic list of callbacks to call on succesfull registration.

Among other changes also prevents setting dev_state.on if the radio powering-on
fails.
---
 include/gsmd/event.h   |    8 +++++
 include/gsmd/sms.h     |    1 +
 src/gsmd/atcmd.c       |   26 +++++++++++++++++
 src/gsmd/sms_cb.c      |   73 ++++++++++++++++++++++++------------------------
 src/gsmd/unsolicited.c |    8 +++++
 src/gsmd/usock.c       |   21 ++++++++++++--
 src/util/event.c       |   10 +++----
 7 files changed, 103 insertions(+), 44 deletions(-)


git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2722 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-08-17 08:30:42 +00:00
laforge 4e578aa3ef From: Andrzej Zaborowski <balrog@zabor.org>
Date: Thu, 26 Jul 2007 16:00:52 +0200
Subject: [PATCH] Cell Broadcast messages enabling/disabling and notifications.

This adds GSMD_CB_SUBSCRIBE and GSMD_CB_UNSIBSCRIBE commands handling and
proper handling of th +CMTI, +CMT, +CBMI, +CBM, +CDSI, +CDS unsolicited codes.
It's also an overhaul of sms_cb.c which I first though stood for sms
*callbacks* :)	rather than "cell broadcast" so all SMS and CB related code now
sits in this file.  The Neo1973 modem doesn't seem to support storing CB
messages and delivery status messages into memory, so the default is now set to
output them directly to TE when they're enabled. None of the CB code is tested
on real CBs, but I think it's a good start.


git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2721 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-08-17 08:30:04 +00:00
laforge 348c9af2fc From: Andrzej Zaborowski <balrog@zabor.org>
Date: Thu, 26 Jul 2007 00:32:38 +0200
Subject: [PATCH] SMSC and Preferred Storage operations.

This adds setting and retrieval of SMS storage stats (memory type, used
entries, all entries), and of the default service centre (SMSC) number for
outgoing messages.  The operation of setting a new SMSC number is untested
because my SIM doesn't seem to allow this (that or I did something wrong). New
"libgmsd-tool -m shell" commands for testing are also added.

Other changes in this patch:
 * The third, optional, parameter to +CMGL: is a string, not an integer as I
wrongly assumed earlier, this is now corrected.
 * Rename libgsmd API functions starting with lgsmd_.. to lgsm_.. for
consistency with all other identifiers.
 * Move lgsm_send_simple() to libgsmd.c and add a prototype in
lgsm_internals.h, this eliminates some compile-time warnings.



git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2720 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-08-17 08:29:08 +00:00
laforge 1c4526b52e Operator Selection (Andrzej Zaborowski)
This adds gsmd/libgsmd/libgmsd-tool commands to:
 * query available operators,
 * register to given operator,
 * register automatically (like gsmd did until now),
 * deregister,
 * get current operator name,
 * query signal quality,
 * query current connection state (a bit hacky, but it's the only way
   I found to satisfy the synchronous prototype in misc.h).

The operator cache is not used as it wouldn't give any benefit here. Retrieving
the list of present operators takes very long but there doesn't seem to exist
any way around it and all other phones I used also take that long.

The libgmsd call for registration to an automatically chosen operator now takes
a parameter of a different type so all libgsmd clients need to be updated (this
patch updates libgsmd-tool already, but not libmokogsmd which is not a part of
gsmd project).


git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2713 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-08-16 05:48:59 +00:00
laforge 929473af86 Dynamic registration of unsolicited responses (Andrzej Zaborowski)
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2712 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-08-16 04:25:26 +00:00
laforge f5423c22b8 From 5b7c50fd08b8f76f761958c8a8243e6c23118fa3 Mon Sep 17 00:00:00 2001
From: Andrzej Zaborowski <balrog@zabor.org>
Date: Thu, 12 Jul 2007 14:26:46 +0200
Subject: [PATCH] Incoming SMS events

This is a proposed patch to emit a gsmd event when a new SMS arrives, also
modifies libgsmd-tool to display the notification.  It makes sms_cb.c compile
but only really implements the bits necessary to make it build and for the
notifications to work.	I chose AT+CNMI mode 1 (i.e. store messages in memory
and report the location through +CMTI, rather than print the message right away
through +CMT) because the parser doesn't support multiline unsolicited
responses - in fact it can't support those because in a situation when a normal
command is executing and an unsolicited response comes in (which is the case
when sending a message to yourself) it is impossible for the parser to
distinguish whether the line after the unsolicited response is part of that
response or part of the command's response.


git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2711 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-08-16 04:20:03 +00:00
laforge 66ddffab0a From 294d27e78680d497da22e3a8ad679f50d1ba29e5 Mon Sep 17 00:00:00 2001
From: Andrzej Zaborowski <balrog@zabor.org>
Date: Wed, 11 Jul 2007 16:11:10 +0200
Subject: [PATCH] SMS support in gsmd and in libgsmd.

This adds the proper support for sms related calls in libgsmd and their
implementation in gsmd.

I assumed that conversion between data coding schemes is to be done on the
client side because the {packing,unpacking}* calls were exported.  TEXT mode
support is non-functional, but the code only has to be filled in the right
places to make it work, if it is ever needed.

I had been lucky to be able to test with the different kinds of messages with
exotic formats because I just got a bunch of network messages today (urging to
top-up the credit).

I tried to not modify the libgsmd api, although I would prefer to have a
totally different api, possibly with synchronous calls that just return the
result of an operation, for a exmaple a whole list of messages, rather than the
client waiting for an unknown number of events each with one message.


git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2710 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-08-16 04:18:54 +00:00
laforge 00361c2946 From: Andrzej Zaborowski <balrog@zabor.org>
Date: Wed, 11 Jul 2007 16:03:16 +0200
Subject: [PATCH] Multiline commands support.  Miscellaneous bugs.

This adds support for commands like +CMGS and +CMGW that span mroe than one
line and the lines can't be sent to modem as separate commands because every
next line has to wait for a "> " prompt from modem before writing (otherwise
beginnings of the lines get eaten).

This patch also corrects a number of miscellaneous glitches that I have hit. I
can split them each out if needed, but they are all quite obvious. The
cms_error variable is introduced because there are CME and possibly other
errors with the same codes, which resulted in that when I was sending a message
and got error 42 ("congestion") on sending, openmoko-dialer asked for PIN
because CMS event 42 happens to be PIN inquiry. The change in libgsmd-tool
fixes the issue described by Philipp Zabel on the list, with usock locking up.


git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2709 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-08-16 04:16:26 +00:00
alphaone a07e020b6d * Add missing parameter to write
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2686 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-08-10 11:48:55 +00:00
alphaone 947e4fa6cc gsmd.c: Send \r before draining tty so the modem discards any garbage that
was sent before.


git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2685 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-08-10 11:38:15 +00:00
laforge d5876c34c4 Add '2nd try' of the multiline parser:
Every extended response causes a flush of the previous mlbuf and starts
collecting new response lines.  Also, final_cb is now really only reached for
final responses and the code for case 'A' won't overwrite the command buffer
with the response anymore. I throw in '\n' as a separator for multi-line
responses, and the callback is called for each response this way.

(Philipp Zabel)



git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2581 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-07-31 07:38:23 +00:00
laforge 5dcc1231bd in some cases the Qualcomm chip in the HTC Universal switches to V0 mode
behind our backs. We need support for "0" instead of "OK" in the
synchronous initial command and in the alive check. Note that this
nearly duplicates the "OK" check in atcmd.c. (Philip Zabel)


git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2580 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-07-31 07:29:00 +00:00
laforge 31538ce00e don't power off the phone at gsmd startup.
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2579 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-07-31 07:11:08 +00:00
laforge 5540e791be the latest gsmd sends the alive detector's ATE0 to the GSM modem, even
if interpreter_ready == 0. The attached patch sees to it that if
interpreter_ready is zero, gsmd_alive_start is only called once the
"AT-Command Interpreter ready" message was seen. (Philipp Zabel)


git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2578 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-07-31 07:07:24 +00:00
laforge 35f9fe79b3 Use ATH instead of ATH0 for QC compatibility (Philipp Zabel)
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2577 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-07-31 07:01:29 +00:00
laforge afd63f4229 Add higher baudrates: 230k, 460k, 921k (Alex Osborne)
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2576 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-07-31 06:29:54 +00:00
shoragan dc7bb164e1 Flush stdout after handling each event.
This should fix http://bugzilla.openmoko.org/cgi-bin/bugzilla/show_bug.cgi?id=606

git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2381 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-07-12 16:23:59 +00:00
laforge e5e0fee194 * add GTA02 machine type definition for gsmd
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2294 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-06-18 11:28:19 +00:00
laforge 3ec5e21505 Ignore 1:1 echos of commands sent. This is mainly to work around modems that
are initially in 'E1' state, i.e. have echo enabled.  This means that our first
ATE0V1 command will get echoed before we receive OK. (Philipp Zabel)


git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2180 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-06-06 19:42:14 +00:00
laforge afdbbbc624 first implementation (ugly) of operator name query
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2135 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-06-03 06:21:35 +00:00
laforge 8ea4f8cf9c * add timeout to initial modem detection
* make sure we only fork into background after the modem has been detected
* clean up the loglevel of some log statements


git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2131 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-06-02 14:00:28 +00:00
laforge 028df7942f Add 'modem alive' detection. We inquire every five minutes if the modem is still alive.
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2130 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-06-02 13:45:46 +00:00
laforge 9c50224314 remove stupid default serial port /dev/ttyUSB0
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2128 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-06-02 11:49:58 +00:00
laforge 912d24fcd3 implement manual override for vendor/machine type
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2127 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-06-02 11:43:55 +00:00
laforge bb9bf7b6d0 follow automake/libtool convention for building dlopen'ed modules
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2126 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-06-02 11:43:30 +00:00
laforge ce66dca754 add missing header file
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2124 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-06-02 11:07:07 +00:00
laforge 1c1d1d68d2 add machine / vendor plugin infrastructure (Philip Zabel)
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2123 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-06-02 11:00:07 +00:00
mickey 25d5ef89ff gsmd: power off the phone when gsmd starts up to have a consistent starting point
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@1964 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-05-16 10:32:07 +00:00
laforge 4a965b6b43 make CLIP/COLP numbers zero-terminated (Closes: #525)
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@1892 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-05-01 23:39:49 +00:00
laforge a9ecb72215 * compile fix (include sys/select.h) to make it build on *BSD (Holger Freyther)
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@1870 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-04-29 16:26:26 +00:00
laforge a4b4951f07 zero LAC and CI if +CREG is 0 / 2 (and not 1). (Closes: #454)
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@1827 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-04-25 08:54:42 +00:00
laforge f4f201c63c The standard says that the parameter is not optional. Some modems
(correctly) return "ERROR" in response to "AT+COPS". (Philipp Zabel)


git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@1812 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-04-21 08:46:47 +00:00
laforge bba162cb3e parse numeric responses for RING, NO CARRIER and BUSY (Philip Zabel)
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@1766 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-04-15 09:57:12 +00:00
laforge f243da86ed * add (still incomplete) SMS and phonebook support from Sean Chiang
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@1765 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-04-15 09:47:23 +00:00
laforge 6766b42717 fix typo (Philipp Zabel)
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@1530 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-03-28 11:47:01 +00:00
laforge 08e6075437 add parsing of +CMS errors according to GSM 07.05 (Philipp Zabel)
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@1529 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-03-28 11:46:45 +00:00
laforge 3e46025338 fix GSM signal strength parsing (Closes: 291)
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@1520 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-03-28 00:21:15 +00:00
laforge dc0249fe1a * add CTZV stub
* dont escape % sign in non-format strings


git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@1317 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-03-10 22:08:06 +00:00
laforge 3026b93e26 * include stdio from talloc.h
* add new generic extended-response parser
* add operator cache, using ext-resp-parser
* add proper detection of supported %CPI modes and select highest available one
* add %CTZV to vendor_ti init string


git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@1316 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-03-10 22:05:17 +00:00
laforge 2797211645 * properly implement PIN/PUK handling throughout gsmd/libgsmd/util
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@1314 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-03-10 02:22:04 +00:00
laforge a831d70619 * deal correctly with 'gsm power cycling'
* consider % as prefix for extended response, even though non-standard


git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@1313 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-03-10 02:21:28 +00:00
laforge 0b07830f6f fix typo in last commit
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@1309 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-03-09 19:32:06 +00:00
laforge 0b4fdb68e2 move CTZR into vendor_ti.c, since not all GSM Modems support it (Philipp Zabel)
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@1307 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-03-09 16:39:05 +00:00
laforge b76591c41e this was supposed to be part of the last commit (1281)
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@1282 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-03-08 21:51:11 +00:00
laforge aefa11c794 * introduce ciphering indication parsing and event generation
* stubs for volume control
* add data structure resembing gsm device state


git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@1281 99fdad57-331a-0410-800a-d7fa5415bdb3
2007-03-08 21:48:59 +00:00