• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5# TODO(pprabhu) Use ConfigObj for this configuration file.
6
7# This is the default modem configuration file loaded by all modems.
8# This file declares a series of python maps and lists. See comments before each
9# declaration for details.
10# This configuration is either replaced or ammended by modem specific
11# configuration files.
12
13# Name of the modemmanager plugin to be used with the current modem.
14# This name is declared by the plugin in modemmanager during initialization.
15#
16# Modem configuration file may override this name.
17mm_plugin = '"Generic"'
18
19# This is a list of state machines loaded by wardmodem.
20#
21# This list is used *after* the plugin list has been loaded. So, the plugin list
22# overrides this list.
23state_machines = {
24    'level_indicators_machine',
25    'modem_power_level_machine',
26    'network_identity_machine',
27    'network_operator_machine',
28    'network_registration_machine',
29    'request_response',
30}
31
32# Fallback machine.
33# If not None, |fallback_machine|.|fallback_function| is used to serve all
34# requests for which there is no matching wardmodem action.
35# Here, |fallback_machine| is the well-known-name of the machine to use, and
36# |fallback_function| is the name of the function to use.
37fallback_machine = 'request_response'
38fallback_function = 'act_on'
39
40# The AT commands between modemmanager and modem are prefixed and terminated
41# slightly differently based on the modem. These are the defaults that work with
42# the modems that we developed with. Override them if you need a different
43# terminator.
44mm_to_modem_at_prefix = ''
45mm_to_modem_at_suffix = '\r\n'
46modem_to_mm_at_prefix = '\r\n'
47modem_to_mm_at_suffix = '\r\n'
48
49# This map specifies the wardmodem action to be taken for AT commands from the
50# external world.
51#
52# Format:
53#   {at_command: (state_machine_name, function, (idx1, idx2, ...))}
54#
55#   Here,
56#     - at_command [string] is the AT Command received,
57#     - state_machine_name [string] is name of a state machine loaded by
58#       wardmodem.
59#     - function [string] is a function exported by the state machine mapped to
60#       by state_machine_name
61#     - (idx1, idx2, ...) [tuple of int] Optionally, lists the (int) indices of
62#       the arguments that should be passed on from the AT command to the called
63#       function.
64#
65#   Note: the at_command might use the special character '*' to indicate an
66#   argument that should be ignored while matching.
67#
68# Modem configuration file ammends this map.
69at_to_wm_action_map = {
70    'AT+CFUN?': ('modem_power_level_machine', 'get_current_level'),
71    'AT+CFUN=0': ('modem_power_level_machine', 'set_level_minimum'),
72    'AT+CFUN=1': ('modem_power_level_machine', 'set_level_full'),
73    'AT+CFUN=4': ('modem_power_level_machine', 'set_level_low'),
74    # The following commands obtain information used by the network to identify
75    # the user.
76    'AT+CIMI': ('network_identity_machine', 'read_imsi_from_modem'),
77    # Multiple commands that read information from the SIM.
78    # @see ETSI_TS_127_V11.6.0 section 8.18
79    # EF_AD:28589 @see ETSI_TS_151_V14.4.0 section 10.3.18
80    'AT+CRSM=176,28589,*,*,*': ('network_identity_machine',
81                                'read_sim_admin_data', (4)),
82    # EF_IMSI:28423 @see ETSI_TS_151_V14.4.0 section 10.3.2
83    'AT+CRSM=176,28423,*,*,*': ('network_identity_machine',
84                                'read_sim_imsi', (4)),
85    # EF_SPN:28486 @see ETSI_TS_151_V14.4.0 section 10.3.11
86    'AT+CRSM=176,28486,*,*,*': ('network_identity_machine',
87                                'read_service_provider_name', (4)),
88
89    'AT+COPS=3,*': ('network_operator_machine',
90                    'set_operator_format', (1)),
91    'AT+COPS?': ('network_operator_machine', 'get_operator_name'),
92    'AT+COPS=0': ('network_operator_machine', 'set_operator_autoselect'),
93
94    'AT+CEREG=*': ('network_registration_machine',
95                   'set_registration_change_message_verbosity', (0)),
96    'AT+CEREG?': ('network_registration_machine',
97                  'get_current_registration_status'),
98
99    'AT+CIND?': ('level_indicators_machine',
100                 'get_current_levels'),
101}
102
103# This map specifies the AT commands to be sent back to the external world upon
104# responses from the wardmodem.
105#
106# Format:
107#   {response_function: at_response}
108#
109#   Here,
110#     - response_function [string] is the wardmodem response function
111#     - at_response [string] is the AT response to be sent to modemmanager.
112#       Once again, '*' included in at_response is interpreted as a placeholder
113#       and will be replaced by the arguments provided by wardmodem.
114#
115#   Example: If the map contains a row {'wm_says_hello': 'AT+Ur0sum=*,*,cats'}
116#   Then for wardmodem response ('wm_says_hello', 'my', 2) is interpreted as the
117#   AT response 'AT+Ur0sum=my,2,cats'.
118#
119# Modem configuration file ammends this map.
120wm_response_to_at_map = {
121    'wm_response_ok': 'OK',
122    'wm_response_error': 'ERROR',
123    # Some modems respond with a RING for error conditions sometimes.
124    'wm_response_ring': 'RING',
125    # Some responses don't have any AT command prefix at all. For those.
126    'wm_response_text_only': '*',
127
128    # Responses from modem_power_level_machine
129    'wm_response_power_level_minimum': '+CFUN: 0',
130    'wm_response_power_level_full': '+CFUN: 1',
131    'wm_response_power_level_low': '+CFUN: 4',
132    'wm_response_power_level_factory_test': '+CFUN: 5',
133    'wm_response_power_level_offline': '+CFUN: 7',
134
135    # Responses from network_identity_machine
136    'wm_response_sim_info_success': '+CRSM: 144,0,"*"',
137    'wm_response_sim_info_error_too_long': '+CRSM: 103,0,""',
138
139    # Operator name responses
140    'wm_response_operator_name': '+COPS: 2,*,"*",0',
141    'wm_response_operator_name_none': '+COPS: 2,*,"Unknown",0',
142
143    # Network registration status reporting.
144    'wm_response_network_registration_status_not_registered': '+CEREG: *,0',
145    'wm_response_network_registration_status_0': '+CEREG: 0, *',
146    'wm_response_network_registration_status_1': '+CEREG: 1, *',
147    'wm_response_network_registration_status_2': '+CEREG: 2, *, *, *, *',
148
149    # Level indicators reporting.
150    'wm_response_level_indicators': '+CIND: *,*,*,*,*,*,*,*',
151}
152
153# Request Response map.
154# These are the properties used by the RequestResponse state machine to cater to
155# informational queries about the modem.
156#
157# Format:
158#   {incoming_at: (outgoing_ok, outgoing_error)}
159#
160#   Here,
161#     - incoming_at: The incoming AT command to respond to
162#     - outgoing_ok: The exact response to be returned, if the machine is
163#       enabled. This can be a "string" or a "list of strings".
164#       Example: If |outgoing_ok| is ['AT1', 'AT2']. The response sent is:
165#       'AT1'
166#       'AT2'
167#       'OK'
168#       Example: If |outgoing_ok| is 'AT1'. The response sent is (no trailing
169#       'OK'):
170#       'AT1'
171#       This mode is required sometimes for responses from the modem that are
172#       not followed by an 'OK'.
173#
174#     - outgoing_error: The exact response to be returned, if the machine is
175#       disabled. This may be omitted. In that case, the default ERROR
176#       command is returned. If included, it must be of type str.
177#
178# Any entry from modem configuration file overrides the entry here.
179wm_request_response_map = {
180    # #########################################################################
181    # The following AT request-response pairs are tied down to a modem firmware.
182    # They are static across the lifetime of the modem.
183
184    # These commands belong to the basic Hayes AT command set.
185    'ATE0': 'OK',
186    'ATV1': 'OK',
187    'AT+CMEE=1': 'OK',
188    'ATX4': 'OK',
189    'AT&C1': 'OK',
190    'ATZ': 'OK',
191    'ATI': ['All the modem information in the world'],
192    # These commands are from ITU recommendation V.250
193    'AT+GCAP': ['LTE2, +CGSM, +CIS707-A, CIS-856-A, +MS, +ES, +DS, +FCLASS, '
194               '+CLTE0'],
195    # These commands are from ETSI_TS_127_007_V11.6.0
196    # Name of the modem vendor
197    'AT+CGMI': ['Bearded Yeti Intergalactic'],
198    # Name of the modem model
199    'AT+CGMM': ['Bearded Snow Leopard'],
200    # Firmware revision
201    'AT+CGMR': ['Bearded infinity'],
202    # The mobile device IMEI (Bound to the mobile device)
203    'AT+CGSN': ['123456789012345'],
204    # Queries regarding supported technologies
205    'AT*CNTI=2': ['GSM, GPRS, EDGE, UMTS, HSDPA, HSPA, LTE, 1xRTT, EvDO, EvDO, '
206                 'Rel0, EvDO RelA'],
207    'AT+WS46=?': ['+WS46: (12,22,25)'],
208    # List the allowed power level settings.
209    'AT+CFUN=?': ['+CFUN: (0-1,4-7),(0-1)'],
210    # List the allowed PDP context ranges.
211    'AT+CGDCONT=?': ['+CGDCONT: (1-16),"IP",,,(0-2),(0-4)',
212                     '+CGDCONT: (1-16),"PPP",,,(0-2),(0-4)',
213                     '+CGDCONT: (1-16),"IPV6",,,(0-2),(0-4)'],
214    # Read the ICCID from the SIM.
215    'AT+CRSM=176,12258,0,0,10': ['+CRSM: 144,0,"98765432100123456789"'],
216    # List allowed facility locks:
217    'AT+CLCK=?': ['+CLCK: ("AB","AC","AG","AI","AO","IR","OI","OX","PN","PU"'
218                  ',"PP","SC")'],
219    # List of supported USSD operations.
220    # 0: Disable response from network
221    # 1: Enable response from network
222    # 2: Cancel an ongoing session. This may not be supported by older modems.
223    'AT+CUSD=?': ['+CUSD: (0-2)'],
224    # List of supported character set encodings.
225    'AT+CSCS=?': ['+CSCS: ("IRA","GSM","UCS2")'],
226    # List of supported indicators
227    'AT+CIND=?': ['+CIND: ("battchg",(0-5)),("signal",(0-5)),("service",(0-1))'
228                  ',("call",(0-1)),("roam",(0-1)),("smsfull",(0-1)),'
229                  '("GPRS coverage",(0-1)),("callsetup",(0-3))'],
230    # List of supported SMS forwarding modes.
231    'AT+CNMI=?': ['+CNMI: (0,1,2),(0,1,2,3),(0,2),(0,1,2),(0,1)'],
232    # List of supported preferred SMS storage commands.
233    'AT+CPMS=?': ['+CPMS: ("SM","SR"),("SM","SR"),("SM","SR")'],
234    # List of supported SMS modes
235    'AT+CMGF=?': ['+CMGF: (0-1)'],
236
237    # ##########################################################################
238    # These AT commands should actually be handled in some other state machine.
239    # They are here temporarily till those machines can be implemented.
240    # TODO(pprabhu) Implement these state machines as needed by tests.
241    # Here till pin-locking is implemented.
242    'AT+CPIN?': ['+CPIN: READY'],
243    # Here till event reporting is implemented.
244    'AT+CMER=3,0,0,1': 'OK',
245    # Here till we actually need a character encoding.
246    'AT+CSCS="IRA"': 'OK',
247    'AT+CSCS?': ['+CSCS: "IRA"'],
248    # Here till SMS support is implemented.
249    'AT+CMGF=0': 'OK',
250    'AT+CMGL=4': 'OK',
251    'AT+CPMS="","SM","SM"': ['+CPMS: 0,15,0,15,0,15'],
252    'AT+CPMS="SM",': ['+CPMS: 0,15,0,15,0,15'],
253    'AT+CPMS="SR",': ['+CPMS: 0,15,0,15,0,15'],
254    'AT+CNMI=2,1,2,1,0': 'ERROR',
255    # Here till USSD support is implemented.
256    'AT+CUSD=1': 'OK',
257    'AT+CUSD=0': 'OK',
258    # Here till we implemnt varying signal strength.
259    'AT+CSQ': ['+CSQ: 0,0'],
260    # Here till we implement facility locks.
261    'AT+CLCK="SC",2': ['+CLCK: 0'],
262    'AT+CLCK="PN",2': ['+CLCK: 0'],
263    'AT+CLCK="PU",2': ['+CLCK: 0'],
264    'AT+CLCK="PP",2': ['+CLCK: 0'],
265
266}
267
268# ##############################################################################
269# This section contains configuration information used by specific state
270# machines.
271
272##### modem_power_level_state_machine
273
274# A list of allowed power levels.
275modem_power_level_allowed_levels = ['MINIMUM', 'FULL', 'LOW']
276
277# The initial state in which the state machine is created.
278# This is how the modem comes up upon creation.
279modem_power_level_initial_level = 'FULL'
280
281# Default behaviour wrt to modem power level changes.
282# If True, the modem is reset before changing power level.
283modem_power_level_reset_by_default = False
284
285##### network_identification_machine
286
287# Parts of IMSI
288# This is usually 15 digit long.
289network_identity_default_mcc = '311'  # USA country code
290network_identity_default_mnc = '480'  # Verizon network code
291network_identity_default_msin = '123456789'  # Arbitrary unique ID.
292network_identity_default_mdn = '6500000000'
293
294##### network_operator_machine
295# This is a list of operators. Each entry is a list with the
296# long_alphanumeric, short_alphanumeric and numeric representation of the
297# operator name, and the access technology supported  by this operator.
298# Viz: [['Long name of an operator', 'shortname', '666', '7']]
299network_operators = [
300    {'LONG_ALPHANUMERIC': 'Verizon Wireless',
301     'SHORT_ALPHANUMERIC': 'VZW',
302     'NUMERIC': '311480',
303     'TECHNOLOGY': 'E_UTRAN'},
304]
305
306# The index of the operator in the list above to choose when automatic
307# selelction mode is set.
308network_operator_default_index = 0
309
310##### level_indicators_machine
311level_indicators_items = ['battchg', 'signal', 'service', 'call', 'roam',
312                          'smsfull', 'gprs_coverage', 'call_setup']
313level_indicators_defaults = [5, 5, 1, 0, 0, 0, 0, 0]
314