Commit Graph

302 Commits

Author SHA1 Message Date
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
Denis Kenzior 1426d84ad7 Get rid of dbus_gsm_free_string_array
Use g_strfreev instead.
2009-07-29 12:26:04 -05:00
Denis Kenzior 99c1c92708 Move & Rename dbus_gsm_connection
Move to ofono/dbus.h ofono_dbus_get_connection
2009-07-29 12:26:04 -05:00
Denis Kenzior 555e2e689d Refactor SIM file access code
SIM File Access conditions would be reported similarly between various
stacks, so it seems like the core logic of figuring out the access
conditions belongs up in the daemon.

This also fixes various problems, including:
  - access conditions read from bytes 10-12, instead of 9-11.
  - read/update, invalidate/rehabilitate and increase conditions
    read from the wrong bits (0-3 instead of 4-7 and vice versa)
2009-07-27 17:09:56 -05:00
Denis Kenzior 5fcbc68f3e Kill unused variable warn 2009-07-27 17:09:54 -05:00
Denis Kenzior 30c1b5e05f Kill implicit declaration warn 2009-07-27 17:09:53 -05:00
Denis Kenzior e8fbf4b699 Kill 'Suggest parantheses around truth value' warn 2009-07-27 17:09:49 -05:00
Andrzej Zaborowski aa71d09516 Cache EF-PNN, EF-OPL sim files on disk.
This uses plain files in /var/lib/ofono for storing contents of the
operator lists to avoid possibly numerous queries to the SIM on every
startup.  Files are indexed with IMSI.  I'm not 100% sure about the
autoconf magic.

Users need to rerun bootstrap-configure after applying this.

Depends on [PATCH] Return SIM file access conditions from read_file_info.
2009-07-27 17:09:48 -05:00
Andrzej Zaborowski 5c981d421e Return SIM file access conditions from read_file_info. 2009-07-27 17:09:46 -05:00
Andrzej Zaborowski da0bdb1cbf Clean-up in sim.c. 2009-07-17 23:48:29 -05:00
Denis Kenzior 70d1a6bac7 Fix uninitialized variable 2009-07-14 15:46:56 -05:00
Denis Kenzior 000a983b2b Make sure record length is not zero
Record length can be reported as 0 by the driver if it is for a
a binary (non-record based) file.  Set it to the file length in
this case
2009-07-14 15:45:06 -05:00
Denis Kenzior 864e09481c Get rid of some div by zero errors 2009-07-14 15:45:06 -05:00
Denis Kenzior 7dd147117f Use ofono_set_sim_ready 2009-07-14 15:45:06 -05:00
Denis Kenzior 0fa6897213 Refactor OPL code 2009-07-14 15:45:05 -05:00
Denis Kenzior 5ea1326b00 Move SPDI to network.c 2009-07-14 15:45:05 -05:00
Denis Kenzior 382e39ec53 Move SPN reading to network.c 2009-07-14 15:45:05 -05:00
Denis Kenzior 8294c1e42c Get rid of unneeded 2009-07-14 15:45:05 -05:00
Denis Kenzior 82ede4d647 Move PNN reading to network.c 2009-07-14 15:45:05 -05:00
Denis Kenzior 38eebca61f Move PNN operator parsing to simutil 2009-07-14 15:45:05 -05:00
Denis Kenzior 80f43ff849 Move function to simutil.c 2009-07-14 15:45:05 -05:00
Denis Kenzior f6aa6e473c Move enum to simutil.h 2009-07-14 15:45:05 -05:00
Denis Kenzior 05c4ae4793 Remove unneeded function 2009-07-14 15:45:04 -05:00
Denis Kenzior d12210ba54 Remove unneeded variables 2009-07-14 15:45:04 -05:00
Denis Kenzior e13b933cbb Move enum to simutil.h 2009-07-14 15:45:04 -05:00
Denis Kenzior 1df261cdb9 Refactor MSISDN reading 2009-07-14 15:45:04 -05:00
Denis Kenzior 5207f4063e If reading one fails, don't bother reading rest 2009-07-14 15:45:04 -05:00
Denis Kenzior 285712e5d4 Add TODO comment 2009-07-14 15:45:04 -05:00
Denis Kenzior 097aeccc9a Change the way SIM is initialized 2009-07-14 15:45:04 -05:00
Denis Kenzior 541682f89d Add sim file reading / writing utilities 2009-07-14 15:45:04 -05:00
Denis Kenzior 04f6924099 Add IMSI getter method 2009-07-14 15:45:04 -05:00
Denis Kenzior acc65afcee Add get/set sim readiness functions 2009-07-14 15:45:04 -05:00
Denis Kenzior 165a78e7e9 Remove some SPN stuff from SIM 2009-07-14 15:45:03 -05:00
Denis Kenzior d0fbef76bd Add sim ready notify functions 2009-07-14 15:45:03 -05:00
Denis Kenzior ffb5d3da94 Remove unnecessary value 2009-07-14 15:45:03 -05:00
Denis Kenzior bed14e8527 Remove unneeded functions 2009-07-14 15:45:03 -05:00
Denis Kenzior b945c111b7 Move utility to its own file 2009-07-14 15:45:03 -05:00
Denis Kenzior 2de9ad258b Cleanup network_name_parse 2009-07-14 15:45:03 -05:00
Andrzej Zaborowski 98a4308b30 Read EF-PNN, EF-OPL and override network names accordingly. 2009-07-14 15:45:03 -05:00
Denis Kenzior ce996638b9 Fix suggest parantheses warning 2009-07-13 22:33:48 -05:00
Denis Kenzior 683cee1c1c Fix unused variable warning 2009-07-13 22:33:48 -05:00
Denis Kenzior c093a75f89 Convert SIM strings properly 2009-07-06 19:33:30 -05:00
Denis Kenzior 369f8d0c84 Minor style issues 2009-06-22 13:22:14 -05:00
Andrzej Zaborowski 6ee516ac09 Read EF-SPDI and use it for SPN display.
When the operator is one of those listed in EF-SPDI then we need to
treat it like a HPLMN in deciding whether the SPN or PLMN name should
be displayed.
2009-06-22 13:22:14 -05:00
Denis Kenzior 98a3826ab8 Don't bother reporting subscriber numbers by type 2009-06-18 04:02:15 -05:00
Denis Kenzior 6fdf580a5d Cleanup EFmsisdn reading patch 2009-06-18 04:02:13 -05:00
Andrzej Zaborowski 1c6d44d9c0 Read own numbers from EFmsisdn instead of AT+CNUM. 2009-06-18 04:02:08 -05:00
Denis Kenzior c3e3750ebb Minor style fixes 2009-06-18 04:02:06 -05:00
Andrzej Zaborowski 2b451eaeab Add record based file capability to sim_ops
Add capability to read / write / stat files on the SIM.  This now
supports cyclic, linear fixed and transparent SIM files.

Parse GET RESPONSE result to find structure of the file (cyclic, linear
fixed, or transparent), the file size and the record length.

Add both read and update capability for binary and record-based files.

Implement writing sim files through AT.
2009-06-18 04:02:05 -05:00
Denis Kenzior 6fdc96cb73 Remove unnecessary define 2009-05-29 18:37:36 -05:00
Denis Kenzior db2a98ae5a Cleanup SimManager interface
Future-Proof own numbers support.  For now we only report voice numbers
Rename attributes to be a bit better
2009-05-26 18:20:03 -05:00
Denis Kenzior ab68cd8e7e Create ofono_phone_number struct
Creates a new structure in driver.h called ofono_phone_number.
This is meant to replace const char *number, int number_type
arguments everywhere.

Fix up all existing code to use this structure instead.
2009-05-26 18:18:12 -05:00
Andrzej Zaborowski 70fce6b551 Add SimManager interface.
Implement basic SIM filesystem utilities.

Obtain Service Provider Name EF-SPN record.

Make NetworkRegistration use SPN for PLMN display. This implements PLMN
display rules in 31.102 "EFSPN".
2009-05-26 18:15:51 -05:00