X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=src%2Fhost%2Flayer23%2Fsrc%2Fapp_mobile.c;h=46e0e0675d8b4f163f23760c337f0e8bb583a80f;hb=341b3cee2c1e14f7e388de9566422c44710c18af;hp=02f25418412b6f1e3d43f4adf53547b680ba904c;hpb=2b5c2337edd5976fb095ce0a9748a92168ff385e;p=osmocom-bb.git diff --git a/src/host/layer23/src/app_mobile.c b/src/host/layer23/src/app_mobile.c index 02f2541..46e0e06 100644 --- a/src/host/layer23/src/app_mobile.c +++ b/src/host/layer23/src/app_mobile.c @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -33,6 +34,8 @@ #include #include #include +#include +#include #include #include @@ -40,6 +43,7 @@ #include extern struct log_target *stderr_target; +static const char *config_file = "osmocom.cfg"; static int started = 0; @@ -83,10 +87,9 @@ static int signal_cb(unsigned int subsys, unsigned int signal, } started = 1; ms = signal_data; - gsm_subscr_testcard(ms, 1, 1, "0000000000"); - ms->subscr.plmn_valid = 1; - ms->subscr.plmn_mcc = 1; - ms->subscr.plmn_mnc = 1; + /* insert test card, if enabled */ + if (ms->settings.simtype == GSM_SIM_TYPE_TEST) + gsm_subscr_testcard(ms); /* start PLMN + cell selection process */ nmsg = gsm322_msgb_alloc(GSM322_EVENT_SWITCH_ON); if (!nmsg) @@ -134,8 +137,13 @@ int mobile_exit(struct osmocom_ms *ms) int l23_app_init(struct osmocom_ms *ms) { - log_parse_category_mask(stderr_target, "DCS:DPLMN:DRR:DMM:DCC:DMNCC:DPAG"); + int rc; + log_parse_category_mask(stderr_target, "DRSL:DLAPDM:DCS:DPLMN:DRR:DMM:DCC:DMNCC:DPAG"); + + srand(time(NULL)); + + gsm_settings_init(ms); gsm48_cc_init(ms); gsm_support_init(ms); gsm_subscr_init(ms); @@ -144,10 +152,23 @@ int l23_app_init(struct osmocom_ms *ms) INIT_LLIST_HEAD(&ms->trans_list); ms->cclayer.mncc_recv = mncc_recv_dummy; gsm322_init(ms); + l23_app_work = mobile_work; register_signal_handler(SS_L1CTL, &signal_cb, NULL); l23_app_exit = mobile_exit; + telnet_init(ms, 4242); + rc = vty_read_config_file(config_file); + if (rc < 0) { + fprintf(stderr, "Failed to parse the config file: '%s'\n", + config_file); + fprintf(stderr, "Please check or create config file using: " + "'touch %s%s'\n", OSMOCOM_CONFDIR, config_file); + return rc; + } + + gsm_random_imei(&ms->settings); + return 0; }