diff options
Diffstat (limited to 'src/host/layer23/src/misc/app_cell_log.c')
-rw-r--r-- | src/host/layer23/src/misc/app_cell_log.c | 61 |
1 files changed, 33 insertions, 28 deletions
diff --git a/src/host/layer23/src/misc/app_cell_log.c b/src/host/layer23/src/misc/app_cell_log.c index 5b7f7b40..9c498006 100644 --- a/src/host/layer23/src/misc/app_cell_log.c +++ b/src/host/layer23/src/misc/app_cell_log.c @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <signal.h> @@ -30,28 +26,44 @@ #include <osmocom/bb/common/l23_app.h> #include <osmocom/bb/common/logging.h> #include <osmocom/bb/common/gps.h> +#include <osmocom/bb/common/l1l2_interface.h> +#include <osmocom/bb/common/ms.h> #include <osmocom/bb/misc/cell_log.h> +#include <osmocom/core/application.h> #include <osmocom/core/talloc.h> #include <osmocom/core/utils.h> #include <l1ctl_proto.h> -extern struct log_target *stderr_target; -extern void *l23_ctx; - extern uint16_t basic_band_range[][2]; extern uint16_t (*band_range)[][2]; char *logname = "/dev/null"; int RACH_MAX = 2; +static struct osmocom_ms *g_ms; + -int _scan_work(struct osmocom_ms *ms) +int _scan_start(void) { + int rc; + + rc = layer2_open(g_ms, g_ms->settings.layer2_socket_path); + if (rc < 0) { + fprintf(stderr, "Failed during layer2_open()\n"); + return rc; + } + + l1ctl_tx_reset_req(g_ms, L1CTL_RES_T_FULL); return 0; } -int _scan_exit(struct osmocom_ms *ms) +int _scan_work(void) +{ + return 0; +} + +int _scan_exit(void) { /* in case there is a lockup during exit */ signal(SIGINT, SIG_DFL); @@ -64,33 +76,31 @@ int _scan_exit(struct osmocom_ms *ms) return 0; } -int l23_app_init(struct osmocom_ms *ms) +int l23_app_init(void) { int rc; srand(time(NULL)); -// log_parse_category_mask(stderr_target, "DL1C:DRSL:DRR:DGPS:DSUM"); - log_parse_category_mask(stderr_target, "DSUM"); - log_set_log_level(stderr_target, LOGL_INFO); +// log_parse_category_mask(osmo_stderr_target, "DL1C:DRSL:DRR:DGPS:DSUM"); + log_parse_category_mask(osmo_stderr_target, "DSUM"); + log_set_log_level(osmo_stderr_target, LOGL_INFO); + l23_app_start = _scan_start; l23_app_work = _scan_work; l23_app_exit = _scan_exit; - rc = scan_init(ms); + g_ms = osmocom_ms_alloc(l23_ctx, "1"); + OSMO_ASSERT(g_ms); + + rc = scan_init(g_ms); if (rc) return rc; - l1ctl_tx_reset_req(ms, L1CTL_RES_T_FULL); printf("Mobile initialized, please start phone now!\n"); return 0; } -static int l23_cfg_supported() -{ - return L23_OPT_TAP | L23_OPT_DBG; -} - static int l23_getopt_options(struct option **options) { static struct option opts [] = { @@ -151,7 +161,7 @@ static void parse_band_range(char* s) (*band_range)[i][1] = 0; } -static int l23_cfg_print_help() +static int l23_cfg_print_help(void) { printf("\nApplication specific\n"); printf(" -l --logfile LOGFILE Logfile for the cell log.\n"); @@ -232,16 +242,11 @@ cmd_line_error: exit(1); } -static struct l23_app_info info = { +const struct l23_app_info l23_app_info = { .copyright = "Copyright (C) 2010 Andreas Eversberg\n", .getopt_string = "g:p:l:r:nf:b:A:", - .cfg_supported = l23_cfg_supported, + .opt_supported = L23_OPT_TAP | L23_OPT_DBG, .cfg_getopt_opt = l23_getopt_options, .cfg_handle_opt = l23_cfg_handle, .cfg_print_help = l23_cfg_print_help, }; - -struct l23_app_info *l23_app_info() -{ - return &info; -} |