2 * (C) 2010 by Andreas Eversberg <jolly@eversberg.eu>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #include <osmocom/osmocom_data.h>
28 void gsm_support_init(struct osmocom_ms *ms)
30 struct gsm_support *sup = &ms->support;
33 memset(sup, 0, sizeof(*sup));
36 /* rf power capability */
37 sup->pwr_lev_900 = 3; /* CLASS 4: Handheld 2W */
38 sup->pwr_lev_1800 = 0; /* CLASS 1: Handheld 1W */
39 /* controlled early classmark sending */
40 sup->es_ind = 0; /* no */
42 sup->rev_lev = 1; /* phase 2 mobile station */
44 sup->vgcs = 0; /* no */
46 sup->vbs = 0; /* no */
48 sup->sms_ptp = 1; /* yes */
49 /* screening indicator */
50 sup->ss_ind = 1; /* phase 2 error handling */
51 /* pseudo synchronised capability */
52 sup->ps_cap = 0; /* no */
53 /* CM service prompt */
54 sup->cmsp = 0; /* no */
56 sup->solsa = 0; /* no */
57 /* location service support */
58 sup->lcsva = 0; /* no */
59 sup->loc_serv = 0; /* no */
61 sup->a5_1 = 0; /* currently not */
69 sup->p_gsm = 1; /* P-GSM only */
70 sup->e_gsm = 0; /* E-GSM */
71 sup->r_gsm = 0; /* R-GSM */
73 sup->low_capa = 4; /* p,e,r power class */
75 /* set supported frequencies */
76 if (sup->e_gsm || sup->r_gsm)
77 sup->freq_map[0] |= 1;
78 if (sup->p_gsm || sup->e_gsm || sup->r_gsm)
79 for(i = 1; i <= 124; i++)
80 sup->freq_map[i >> 3] |= (1 << (i & 7));
82 for(i = 512; i <= 885; i++)
83 sup->freq_map[i >> 3] |= (1 << (i & 7));
85 for(i = 975; i <= 1023; i++)
86 sup->freq_map[i >> 3] |= (1 << (i & 7));
87 // for(i = 978; i <= 978; i++)
88 // sup->freq_map[i >> 3] |= (1 << (i & 7));
90 for(i = 955; i <= 1023; i++)
91 sup->freq_map[i >> 3] |= (1 << (i & 7));
92 sup->dcs_capa = 1; /* dcs power class */
93 /* multi slot support */
94 sup->ms_sup = 0; /* no */
96 sup->ucs2_treat = 0; /* default */
97 /* support extended measurements */
98 sup->ext_meas = 0; /* no */
99 /* support switched measurement capability */
100 sup->meas_cap = 0; /* no */
105 sprintf(sup->imei, "000000000000000");
106 sprintf(sup->imeisv, "0000000000000000");
109 sup->min_rxlev_db = -80; // TODO
110 sup->sync_to = 6; /* how long to wait sync (0.9 s) */
111 sup->scan_to = 4; /* how long to wait for all sysinfos (>=4 s) */
114 /* (3.2.1) maximum channels to scan within each band */
115 struct gsm_support_scan_max gsm_sup_smax[] = {
125 int gsm_support_random_imei(struct gsm_support *sup)
131 void gsm_support_dump(struct gsm_support *sup,
132 void (*print)(void *, const char *, ...), void *priv)
134 print(priv, "Supported features of MS '%s':\n", sup->ms->name);
136 print(priv, " R-GSM");
137 if (sup->e_gsm || sup->r_gsm)
138 print(priv, " E-GSM");
139 if (sup->p_gsm || sup->p_gsm || sup->r_gsm)
140 print(priv, " P-GSM");
142 print(priv, " DCS1800");
143 print(priv, " (Phase %d mobile station)\n", sup->rev_lev + 1);
144 print(priv, " CECS : %s\n", (sup->es_ind) ? "yes" : "no");
145 print(priv, " VGCS : %s\n", (sup->vgcs) ? "yes" : "no");
146 print(priv, " VBS : %s\n", (sup->vbs) ? "yes" : "no");
147 print(priv, " SMS : %s\n", (sup->sms_ptp) ? "yes" : "no");
148 print(priv, " SS_IND : %s\n", (sup->ss_ind) ? "yes" : "no");
149 print(priv, " PS_CAP : %s\n", (sup->ps_cap) ? "yes" : "no");
150 print(priv, " CMSP : %s\n", (sup->cmsp) ? "yes" : "no");
151 print(priv, " SoLSA : %s\n", (sup->solsa) ? "yes" : "no");
152 print(priv, " LCSVA : %s\n", (sup->lcsva) ? "yes" : "no");
153 print(priv, " LOC_SERV : %s\n", (sup->loc_serv) ? "yes" : "no");
154 print(priv, " A5/1 : %s\n", (sup->a5_1) ? "yes" : "no");
155 print(priv, " A5/2 : %s\n", (sup->a5_2) ? "yes" : "no");
156 print(priv, " A5/3 : %s\n", (sup->a5_3) ? "yes" : "no");
157 print(priv, " A5/4 : %s\n", (sup->a5_4) ? "yes" : "no");
158 print(priv, " A5/5 : %s\n", (sup->a5_5) ? "yes" : "no");
159 print(priv, " A5/6 : %s\n", (sup->a5_6) ? "yes" : "no");
160 print(priv, " A5/7 : %s\n", (sup->a5_7) ? "yes" : "no");
161 print(priv, " A5/1 : %s\n", (sup->a5_1) ? "yes" : "no");
162 print(priv, " Min RXLEV: %d\n", sup->min_rxlev_db);