Commit Graph

302 Commits

Author SHA1 Message Date
Jeevaka Badrappan 2b8a358601 sim: fix issue with sizeof call
In some compilers, sizeof the functional argument is
not returning the actual sizeof the argument.
2011-01-17 17:05:26 +01:00
Denis Kenzior a4675c50aa sim: Minor style fixes 2011-01-10 15:42:24 -06:00
Lucas De Marchi 99dd118c5b sim: query remaining pin retries
Check the remaining pin retries after each operation that might have
changed it, i.e. locking, unlocking, reseting or changing pin.
2011-01-10 15:38:59 -06:00
Andrzej Zaborowski bb9e26f2a5 sim: Set sane number len in empty EFmsisdn records
Valid number length range is 1 - 11 bytes, other values, such as 0xff,
could potentially crash external parsers.
2010-12-21 14:25:09 -06:00
Jeevaka Badrappan a8c94c044f sim: fix minor issue in ofono_sim_get_phase 2010-12-12 04:37:52 -06:00
Jeevaka Badrappan 5154d5e38d sim: be more paranoid for triggering EFest read 2010-11-29 14:57:04 -06:00
Lucas De Marchi b210838e87 core: explicitly compare pointers to NULL
This patch was generated by the following semantic patch
(http://coccinelle.lip6.fr/)

// <smpl>
@fix disable is_null,isnt_null1@
expression *E;
@@

- !E
+ E == NULL
// </smpl>
2010-11-29 13:27:15 -06:00
Rémi Denis-Courmont e7c4442c69 core: Remove stray newlines in messages sent to log 2010-11-26 13:50:15 -06:00
Jeevaka Badrappan 2d0cb92155 src: coding style fixes - rule M6 2010-11-22 05:07:52 -06:00
Andrzej Zaborowski 3083841f72 sim: Add sim_service_available()
This is meant to query EFsst or EFust.

The function is not public api because the service constants are in
src/simutil.h.
2010-11-10 09:09:05 -06:00
Denis Kenzior d7403d521b sim: Check both EFust and EFest for FDN & BDN
We were checking EFest only for whether BDN and FDN were enabled.
According to 31.102 Section 5.3.2 we should be checking both EFust
(availability of the service) and EFest (whether it is enabled)
2010-11-05 09:14:32 -05:00
Denis Kenzior e613c686a6 sim: Don't read EFest if the file is not available 2010-11-05 09:14:32 -05:00
Guillaume Lucas aa2c87886f sim: use mask for check of sim file status
It is the first bit of the sim file status who indicates if a file
is valid or not. So a mask must be used to check this.
2010-11-05 09:14:32 -05:00
Denis Kenzior dc43b56154 sim: Fix minor style issue 2010-10-25 10:39:09 -05:00
Jeevaka Badrappan 233bd42820 sim: add barred dialing support 2010-10-25 10:39:09 -05:00
Denis Kenzior 107a38de85 sim: Pass dbus types
Can't really assume they're the same as glib types
2010-10-22 11:58:59 -05:00
Denis Kenzior 8b40f6c1a0 sim: Get rid of unneeded empty line 2010-10-22 11:57:18 -05:00
Denis Kenzior 39a3080a4b sim: Break out common FDN property signaling 2010-10-22 11:56:35 -05:00
Petteri Tikander 7de5e48df8 sim: check existence of imsi-code
For instance: when handling sim_get_properties
in PRE_SIM-state imsi is not received/stored.
2010-10-22 11:23:08 -05:00
Petteri Tikander d82600c893 sim: check if Fixed Dial is enabled in SIM-card
If SIM-card is inserted, status is checked from EFsst
(is FDN activated) and EFadn (is ADN invalidated).
If USIM-card is inserted, status is checked from EFest
(is FDN activated).

If FD is enabled, halt SIM initialization procedure.
New property (FixedDialing) is added. If FD is enabled,
this has been signalled via DBUS.
2010-10-22 11:21:23 -05:00
Denis Kenzior b92662634d sim: Read EFust and EFest after phase is known 2010-10-19 14:20:57 -05:00
Denis Kenzior 04755acc3a sim: Fix setting the correct phase from EFphase 2010-10-19 14:07:41 -05:00
Denis Kenzior 0564176a9c sim: Fix crash on sim re-insertion 2010-10-15 06:26:34 -05:00
Denis Kenzior a4d90fd4eb sim: Refactor iidf reading
Get rid of image_data since it can lead to potential memory leaks when
sim is removed while the IIDF operations are in progress.
2010-10-13 08:41:41 -05:00
Denis Kenzior ccf4b34522 sim: Use ay return signature for GetIcon 2010-10-13 05:04:47 -05:00
Denis Kenzior 56e0a7644f simfs: Reflow to get rid of unnecessary label 2010-10-13 05:04:46 -05:00
Denis Kenzior 90f531768f sim: Use g_dbus_create_reply
Instead of compound statements
2010-10-13 05:04:46 -05:00
Denis Kenzior b750de3ec6 sim: Don't re-check for id != 0
We already check the id is valid in the get_icon function, there's no
reason to re-check it.
2010-10-13 05:04:46 -05:00
Kristen Carlson Accardi 42c29c795f sim: implement GetIcon 2010-10-13 05:04:46 -05:00
Jeevaka Badrappan 4196182770 Fix multi-line comment style issues 2010-09-21 21:16:01 -05:00
Denis Kenzior cd8df455e1 sim: Use sim_fs_check_version 2010-09-09 08:50:29 -05:00
Denis Kenzior 5754eaf7e9 sim: Break out sim file reading into simfs 2010-09-09 08:50:28 -05:00
Denis Kenzior e3bd339e16 sim: Unify sim_read and sim_read_bytes 2010-09-09 08:50:28 -05:00
Kristen Carlson Accardi 95d957b62e sim: read EFiidf
EFiidf can be larger than 256 bytes, so allow callers to read
portions of the EFiidf from a specified offset.  Cache EFiidf
files as blocks of 256 bytes so that it's not necessary to
read the entire (potentially large) file.
2010-09-09 08:45:32 -05:00
Denis Kenzior 4b43650116 sim: cleanup sim atom private structure
The number of elements was getting out of hand and out of order
2010-09-01 12:06:59 -05:00
Denis Kenzior 0cf73b73eb sim: tweak efimg length 2010-09-01 12:06:56 -05:00
Yang Gu d43b2c0a61 sim: Read EFsst 2010-08-31 13:07:54 -05:00
Denis Kenzior 4292b2dbed sim: Turn around the order of arguments
The void *user argument was first.  It should be last instead to be
consistent with the other watch functions.
2010-08-30 14:29:34 -05:00
Kristen Carlson Accardi d3eb346b40 sim: read EFimg 2010-08-26 18:40:12 -05:00
Denis Kenzior 74a88dda81 sim: Check PIN even if no EFli / EFpl not read 2010-08-25 10:00:09 -05:00
Denis Kenzior 687e171949 sim: Retrieve EFphase according to the spec 2010-08-23 14:29:22 -05:00
Denis Kenzior 38300af0da sim: Reorder SIM initialization 2010-08-23 14:29:22 -05:00
Denis Kenzior cbf783c334 sim: Reset mnc_length when removing SIM
In case the next SIM doesn't have it or something else weird happens.
2010-08-23 14:29:22 -05:00
Denis Kenzior f78eaf94cf sim: Update the SIM initialization comment 2010-08-23 14:29:22 -05:00
Denis Kenzior fc70af8ea1 sim: Minor style fix 2010-08-23 14:29:21 -05:00
Yang Gu c679babdc5 sim: Read EFust and EFest 2010-08-23 14:29:21 -05:00
Denis Kenzior 8eb9425f32 sim: Use less space for locked_pins
Use only as required, since we only track PINs in this one, not PUKs
2010-08-05 10:19:04 -05:00
Denis Kenzior 764afde1fe sim: Fix LockedPins in case SIM wants a PUK first
In the case that oFono is started with the SIM asking for a PUK, we
don't report LockedPins properly.
2010-08-05 10:00:57 -05:00
Marcel Holtmann 1fedd096a0 Check sanity the MNC length value from the SIM card
In case the SIM entry is wrong or we force reading of it, nasty things
like this can happen:

ofonod[12456]: Control:> AT+CRSM=176,28589,0,0,4\r
ofonod[12456]: Control:< +CRSM: 144,0,"00FFFF"\r\n\r\nOK\r\n
*** buffer overflow detected ***: ./src/ofonod terminated
======= Backtrace: =========
/lib64/libc.so.6(__fortify_fail+0x37)[0x3e42efb417]
/lib64/libc.so.6[0x3e42ef9310]
/lib64/libc.so.6(__strncpy_chk+0x17b)[0x3e42ef85cb]
2010-06-22 17:21:03 +02:00
Denis Kenzior f2f5810942 sim: move ServiceDiallingNumbers to ServiceNumbers
In line with the API documentation
2010-05-27 14:58:29 -05:00
Denis Kenzior 73bfae4f46 sim: Read EFiccid after EFphase 2010-05-19 23:48:34 -05:00
Denis Kenzior bbd6a1d48a sim: No need for this define 2010-05-19 23:47:41 -05:00
Daniel Wagner b338033307 Read EF_ICCID property of SIM
Tested with phonesim.
2010-05-19 23:41:03 -05:00
Denis Kenzior 50264a311d Style: Proper indentation 2010-04-15 16:49:42 -05:00
Andrzej Zaborowski aad4d0de78 Add Sim Toolkit atom
- Add ofono_stk atom in stk.c
- Move envelope command from sim driver to stk driver
2010-04-15 16:49:40 -05:00
Denis Kenzior 228e1e735c Fix: Minor style issues 2010-04-15 16:49:40 -05:00
Denis Kenzior c63b2c9d44 Fix: Uncomplicate the logic for SIM initialization
If we get a sim inserted notify before we are registered, we need to
initialize the SIM once ofono_sim_register is called.  The logic for
doing so is rather twisted, simplify it.
2010-04-15 16:49:40 -05:00
Andrzej Zaborowski 6dc4799d1b Add SIM "Present" property. 2010-04-15 16:49:40 -05:00
Andrzej Zaborowski ddfe8acf11 Drivers can notify core of SIM insertion / removal
Add ofono_sim_inserted_notify function to notify the core of SIM
insertion / removal.

Make every plugin generate a sim inserted event on start.  For devices
with removable card, the event should be emitted after the
plugin detects such event.  For devices that need to wait for SIM card
initialization, they can emit this event later.
2010-04-15 16:49:40 -05:00
Andrzej Zaborowski 22cbe98146 Extend sim-ready watch with card insert/eject 2010-04-15 16:49:40 -05:00
Andrzej Zaborowski 42ef218668 Use stkutil named constants in sim.c 2010-03-31 13:06:14 -05:00
Denis Kenzior 9390dbaf31 Refactor: Remove MobileNetworkCodeLength property
Replaced by MNC/MCC properties which is more intuitive for use by
external applications.
2010-03-25 10:21:37 -05:00
Denis Kenzior a5d54581ad Move sim manager interface definition to dbus.h 2010-03-22 15:39:13 -05:00
Pekka Pessi 9a398a1087 Fix: Check password length based on its type
The different password types have different length requirements, so
update is_valid_pin to validate according to the password type being
validated (PIN / PUK / NET)
2010-03-19 13:48:04 -05:00
Denis Kenzior 62007cd074 Fix: Fixup error paths in sim_op_check_cached 2010-03-16 15:45:04 -05:00
Andrzej Zaborowski 3a9cd4fc03 Use stk_envelope_type constant name in sim.c 2010-02-27 11:40:16 -06:00
Denis Kenzior 87ca1b0c8f Fix: Don't use ofono_debug directly in the core
Use DBG macro which is integrated with the new debug framework.
2010-02-08 11:54:03 -06:00
Denis Kenzior 0382f64353 Refactor: Rename & Restructure cphs_support
- Rename to cphs_service_table to be more inline with the specification.
- Since the spec allows arbitrary length service tables, use an unsigned
  char * return instead of a short.
- Use bit_field function instead of defining an enum
2010-01-12 11:27:31 -06:00
Denis Kenzior 2b231c3f84 Rename: Rename CPHS Phase enums
Be more consistent with the 3GPP Phase names
2010-01-12 11:23:21 -06:00
Andrzej Zaborowski 637ca18af4 Retrieve CPHS phase (if any) from SIM. 2010-01-12 10:35:51 -06:00
Denis Kenzior 45f2f9315f Set phase to unknown until we probe it 2010-01-06 14:17:27 -06:00
Denis Kenzior beb3e032e4 Refactor: Preserve Phase obtained from the SIM 2010-01-06 13:19:47 -06:00
Andrzej Zaborowski b4c3e1c1cc Index SIM cache by phase also. 2010-01-06 13:14:20 -06:00
Marcel Holtmann 144080e749 Update copyright information 2010-01-01 17:00:10 -08:00
Denis Kenzior 955e6a61ee Style: Fix a few more occurences of if/else
See Linux coding style document for details
2009-12-17 21:45:39 -06:00
Denis Kenzior 0bd6739766 Style: Fixup style issues 2009-12-17 21:45:39 -06:00
Andrzej Zaborowski da6f3e63e0 Handle EF-CBSMID contents. 2009-12-17 21:45:39 -06:00
Denis Kenzior 60118757b2 Fix: Don't crash when cached ef structure differs 2009-10-05 16:20:55 -05:00
Denis Kenzior be55ba4ab3 Refactor: Move elementary file type checking
Every single EF read callback checks the file type reported out of the
SIM is what it expects.  Instead this should be done in one place and
the errors reported accordingly
2009-10-02 18:25:56 -05:00
Denis Kenzior bb746b3e9d Fix efli being removed prematurely 2009-09-28 11:18:50 -05:00
Denis Kenzior bbe49a1b6e Fix whitespace 2009-09-24 10:23:37 -05:00
Denis Kenzior 5b2852d8b4 Add initial support for LockedPins property 2009-09-24 10:23:37 -05:00
Denis Kenzior dc644108bf Ignore EFli if the first entry is empty 2009-09-23 17:28:15 -05:00
Andrzej Zaborowski c98e99aef2 Remove unused struct field. 2009-09-23 14:27:49 -05:00
Andrzej Zaborowski cb19aa987f Rename eflp_format to efli_format, semantically opposite. 2009-09-23 14:27:26 -05:00
Denis Kenzior cfcf7e6516 Simplify: Use dbus_message_iter_get_args 2009-09-22 11:24:21 -05:00
Denis Kenzior b8dcd905fb Remove unused structure 2009-09-22 11:24:21 -05:00
Marcel Holtmann 5f4340f186 Fix unused variable issue from last commits 2009-09-23 10:47:29 -07:00
Denis Kenzior 17cedf0eb7 Don't try to Lock or Unlock SIM PIN2 2009-09-22 00:07:07 -05:00
Denis Kenzior 2c4c27654c Make sure we try to lock/unlock/change only PINs 2009-09-22 00:07:07 -05:00
Denis Kenzior 5fd083f6f4 Refactor: Do not use int instead of enum
27.007 does not define an enumeration for SIM PIN/PUK values.  This
should be handled by ofono enum instead
2009-09-22 00:07:07 -05:00
Denis Kenzior f599036ed0 Add LockPin and UnlockPin functions 2009-09-22 00:07:06 -05:00
Denis Kenzior 63416e2851 Rearrange sim password enum 2009-09-22 00:07:06 -05:00
Denis Kenzior 1faf467d87 Get rid of 1 line function 2009-09-22 00:07:06 -05:00
Denis Kenzior 9f27be58bc Move some stuff around 2009-09-22 00:07:06 -05:00
Andrzej Zaborowski ee02b14836 Do PIN authentication
This adds checking whether PIN is required during SIM initialisation and
delaying the sim ready notifications until after correct PIN is given.
2009-09-22 00:07:06 -05:00
Denis Kenzior 91555b9165 Refactor language preference parsing
- Make sure to handle capital / lower case ISO639 strings
- Properly handle the case where files are empty / unused
- Don't emit the signal unless the preferences are useable
- Simplify the logic and be a bit more readable
2009-09-17 14:10:12 -05:00
Denis Kenzior ef5eb6139a Simplify function logic 2009-09-17 12:18:48 -05:00
Denis Kenzior 8dd574d842 Fix potential memory leak 2009-09-17 12:04:56 -05:00
Denis Kenzior b3ec3f5fef Rename function to be more clear 2009-09-17 12:04:45 -05:00
Denis Kenzior e2a4c4bee8 Use existing function for converting to iso639 2009-09-17 11:53:37 -05:00
Andrzej Zaborowski 623c23c12f Present list of preferred languages on SimManager interfce.
We try to detect the old (2G / 2G+, 51.011) EFlp format and deal
with the file contents accordingly.
2009-09-17 11:42:49 -05:00
Denis Kenzior 8858669857 Port sim ready watch to __ofono_watchlist 2009-09-11 14:05:39 -05:00
Denis Kenzior 110dfb9e2e Fix style issue 2009-09-08 14:15:40 -05:00
Andrzej Zaborowski 17cb0ce3c4 Move create_dirs to storage.c, add file read/write utilities 2009-09-08 13:34:07 -05:00
Denis Kenzior 422df0edfb change int vendor to unsigned int vendor 2009-09-01 21:39:02 -05:00
Denis Kenzior aecf42646e Add vendor flag capability to sim 2009-09-01 18:14:58 -05:00
Denis Kenzior aeebbfa67e Don't return sdn numbers until ready 2009-08-31 15:12:38 -05:00
Denis Kenzior d1ab58479d Simplify EFsdn reading code 2009-08-31 15:12:38 -05:00
Denis Kenzior a7202d8d83 Rename MNCLength to MobileNetworkCodeLength 2009-08-31 15:12:37 -05:00
Denis Kenzior 37deaa6651 Refactor sim mnc length 2009-08-31 15:12:37 -05:00
Denis Kenzior 526e1a6164 Style Fix 2009-08-31 15:12:37 -05:00
Andrzej Zaborowski 7ecebc9a31 Expose service dialling numbers stored on SIM through SimManager. 2009-08-31 15:12:37 -05:00
Andrzej Zaborowski f21930f04e Decode and encode alpha-identifier fields
Add identifier argument to sim_adn_parse and sim_adn_build.

Also fix the number length passed to extract_bcd_number in sim_adn_parse.
2009-08-31 15:12:37 -05:00
Andrzej Zaborowski 6552bc668d Read EFad and expose the IMSI MNC length (2-3) 2009-08-31 15:12:37 -05:00
Denis Kenzior 919aae6cd9 Fix unused function remove_all_watches 2009-08-20 15:39:13 -05:00
Denis Kenzior 5e72405120 Evolve SIM driver 2009-08-19 18:35:06 -05:00
Denis Kenzior 19858da361 Fix compile warning 2009-08-08 22:39:50 -05:00
Denis Kenzior b951aa9a32 Refactor SIM file cache 2009-08-07 19:51:30 -05:00
Denis Kenzior 2cfd8a9894 Make the sim op queue have a removable gsource 2009-08-07 19:51:29 -05:00
Denis Kenzior 32e4232b7c Don't use g_timeout_add to retrieve imsi 2009-08-07 19:51:29 -05:00
Denis Kenzior f93962078c Refactor setting MSISDN
- Empty lists should be supported, as clearing the MSISDN is OK
- Initialization of empty MSISDN record should also be possible
- Overwriting of unused records should be possible
- Simplify resource cleanup
2009-08-07 15:49:30 -05:00
Denis Kenzior 6f9e386424 Keep new numbers in the main sim data structure
No sense to allocate / free memory for a single pointer
2009-08-07 15:49:30 -05:00
Denis Kenzior 7eb440e864 Move error label to a more logical place 2009-08-07 15:49:30 -05:00
Denis Kenzior e5082b4b78 Move variable declarations to a move logical place 2009-08-07 15:49:30 -05:00
Andrzej Zaborowski 988f0ffbed Make SubscriberNumbers writable.
This implements writing SubscriberNumbers if the SIM allows this
(optional to the SIM provider).  Because the property is an array
of phone numbers, setting the property needs to write multiple
records on the SIM so it's not atomic and potentially can fail
partially.  In this case we have to report a write error to DBus
client but at the same time file may be changed and we send a
PropertyChanged.
2009-08-07 15:49:30 -05:00
Andrzej Zaborowski d6aae60983 Make SIM op queue more robust.
This allows ofono_sim_read and ofono_sim_write callbacks to queue new
read or write operations.  The callback must not be called between
removing the operation from queue and checking queue length.
2009-08-07 15:49:30 -05:00
Denis Kenzior 2d12b296e0 Don't hardcode info len to 6 2009-08-05 12:35:08 -05:00
Denis Kenzior 28817cc671 Don't emit SubscriberNumbers multiple times
We would emit the signal even if the record could not be parsed
2009-08-04 15:10:49 -05:00
Denis Kenzior 2ce16d2b0c Put defines near the top 2009-08-04 15:08:06 -05:00
Denis Kenzior d145a47108 Port Andrew's TFR patch 2009-08-04 15:01:52 -05:00
Denis Kenzior 090b771762 Make sim_op_info_cb caching a bit more readable 2009-08-04 15:01:49 -05:00
Denis Kenzior 320defb9c6 Make cache a gboolean 2009-08-04 15:01:46 -05:00
Denis Kenzior 6182c92ef7 Make sim_op_retrieve_cb a bit more readable 2009-08-04 15:01:42 -05:00
Andrzej Zaborowski 749a83d033 Check write() return values in sim.c for errors. 2009-08-04 15:01:39 -05:00
Andrzej Zaborowski 3cb6e1c90b Fix invalid queue use in sim_write_cb
Since we pop the queue's head, we can't use sim_op_error
2009-08-04 15:01:36 -05:00
Marcel Holtmann bbc2a56986 Fix over-complicated code flow that results in uninitialized variables 2009-08-03 11:20:46 -07:00
Andrzej Zaborowski fbec2de660 Make sure SIM read callbacks die cleanly. 2009-08-03 12:43:32 -05:00
Denis Kenzior a11bce5467 Make is_read a gboolean 2009-08-03 12:41:44 -05:00
Andrzej Zaborowski 4cdf56cabe Implement ofono_sim_write
Writes use sim->simop_q queue together with reads.
2009-08-03 12:40:39 -05:00
Andrzej Zaborowski 0809e33659 Fix possible memory leak on SIM reading error.
This would also stall the SIM op queue if there's a read error for a record
other than the first.  The other solution would be "goto next;" (keep
reading further records).
2009-07-31 09:56:44 -05:00
Andrzej Zaborowski ebf6fca07a Clean up in sim.c.
Remove unused variables and fields.
Move EFadn format parsing to a common function because various files use
this same format.
2009-07-31 09:55:46 -05:00
Andrzej Zaborowski 049e573691 Use STORAGEDIR autoconf voodoo from Bluez. 2009-07-29 17:22:12 -05:00
Denis Kenzior 3e6d4237cb Remove all uses of modem.h 2009-07-29 16:53:19 -05:00
Denis Kenzior 19eeb7f1ba Rename modem_add_interface / modem_remove_interface
Move to ofono_modem_add_interface, ofono_modem_remove_interface
and put in ofono/modem.h
2009-07-29 16:44:16 -05:00
Denis Kenzior 54816de04d Get rid of dbus-gsm.h 2009-07-29 12:26:06 -05:00
Denis Kenzior 9cd9338ba1 Rename dbus_gsm_dict_append_array 2009-07-29 12:26:05 -05:00
Denis Kenzior 6728542a01 Rename dbus_gsm_dict_append 2009-07-29 12:26:05 -05:00
Denis Kenzior d9025e13e1 Move & Rename PROPERTIES_ARRAY_SIGNATURE 2009-07-29 12:26:05 -05:00
Denis Kenzior 55787fe876 Rename dbus_gsm_signal_array_property_changed 2009-07-29 12:26:05 -05:00