X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=src%2Fhost%2Flayer23%2Fsrc%2Fmobile%2Fapp_mobile.c;h=164f3edb11371e4579691e0c7d7ecd718c425dc6;hb=cc10636f91dbd514ffe712325e10b7c1509678f3;hp=1461e3bbae302fbec71b9e67a0a702c3310f36ee;hpb=f8903f06d19f67d7dde85004e5e306cef7d199b6;p=osmocom-bb.git diff --git a/src/host/layer23/src/mobile/app_mobile.c b/src/host/layer23/src/mobile/app_mobile.c index 1461e3b..164f3ed 100644 --- a/src/host/layer23/src/mobile/app_mobile.c +++ b/src/host/layer23/src/mobile/app_mobile.c @@ -37,10 +37,12 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include + +#include extern void *l23_ctx; extern struct llist_head ms_list; @@ -100,7 +102,8 @@ int mobile_signal_cb(unsigned int subsys, unsigned int signal, break; case GSM_SIM_TYPE_TEST: gsm_subscr_testcard(ms, set->test_rplmn_mcc, - set->test_rplmn_mnc); + set->test_rplmn_mnc, set->test_lac, + set->test_tmsi); break; default: /* no SIM, trigger PLMN selection process */ @@ -142,8 +145,7 @@ int mobile_exit(struct osmocom_ms *ms, int force) gsm_subscr_exit(ms); gsm48_cc_exit(ms); gsm_sim_exit(ms); - lapdm_exit(&ms->l2_entity.lapdm_acch); - lapdm_exit(&ms->l2_entity.lapdm_dcch); + lapdm_channel_exit(&ms->lapdm_channel); ms->shutdown = 2; /* being down */ vty_notify(ms, NULL); @@ -158,8 +160,11 @@ int mobile_init(struct osmocom_ms *ms) { int rc; - lapdm_init(&ms->l2_entity.lapdm_dcch, ms); - lapdm_init(&ms->l2_entity.lapdm_acch, ms); + gsm_settings_arfcn(ms); + + lapdm_channel_init(&ms->lapdm_channel, LAPDM_MODE_MS); + lapdm_channel_set_l1(&ms->lapdm_channel, l1ctl_ph_prim_cb, ms); + gsm_sim_init(ms); gsm48_cc_init(ms); gsm_subscr_init(ms); @@ -198,6 +203,13 @@ int mobile_init(struct osmocom_ms *ms) ms->shutdown = 0; ms->started = 0; + if (!strcmp(ms->settings.imei, "000000000000000")) { + printf("***\nWarning: Mobile '%s' has default IMEI: %s\n", + ms->name, ms->settings.imei); + printf("This could relate your identitiy to other users with " + "default IMEI.\n***\n"); + } + l1ctl_tx_reset_req(ms, L1CTL_RES_T_FULL); printf("Mobile '%s' initialized, please start phone now!\n", ms->name); return 0; @@ -328,11 +340,11 @@ int l23_app_work(int *_quit) /* global exit */ int l23_app_exit(void) { - unregister_signal_handler(SS_L1CTL, &gsm322_l1_signal, NULL); - unregister_signal_handler(SS_L1CTL, &mobile_signal_cb, NULL); - unregister_signal_handler(SS_GLOBAL, &global_signal_cb, NULL); + osmo_signal_unregister_handler(SS_L1CTL, &gsm322_l1_signal, NULL); + osmo_signal_unregister_handler(SS_L1CTL, &mobile_signal_cb, NULL); + osmo_signal_unregister_handler(SS_GLOBAL, &global_signal_cb, NULL); - gps_close(); + osmo_gps_close(); return 0; } @@ -348,23 +360,25 @@ int l23_app_init(int (*mncc_recv)(struct osmocom_ms *ms, int, void *), const char *config_file, uint16_t vty_port) { struct telnet_connection dummy_conn; - int rc; + int rc = 0; mncc_recv_app = mncc_recv; - gps_init(); + osmo_gps_init(); vty_init(&vty_info); ms_vty_init(); dummy_conn.priv = NULL; vty_reading = 1; - rc = vty_read_config_file(config_file, &dummy_conn); - 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'\n", config_file); - return rc; + if (config_file != NULL) { + rc = vty_read_config_file(config_file, &dummy_conn); + 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'\n", config_file); + return rc; + } } vty_reading = 0; telnet_init(l23_ctx, NULL, vty_port); @@ -372,9 +386,9 @@ int l23_app_init(int (*mncc_recv)(struct osmocom_ms *ms, int, void *), return rc; printf("VTY available on port %u.\n", vty_port); - register_signal_handler(SS_GLOBAL, &global_signal_cb, NULL); - register_signal_handler(SS_L1CTL, &mobile_signal_cb, NULL); - register_signal_handler(SS_L1CTL, &gsm322_l1_signal, NULL); + osmo_signal_register_handler(SS_GLOBAL, &global_signal_cb, NULL); + osmo_signal_register_handler(SS_L1CTL, &mobile_signal_cb, NULL); + osmo_signal_register_handler(SS_L1CTL, &gsm322_l1_signal, NULL); if (llist_empty(&ms_list)) { struct osmocom_ms *ms;