From patchwork Fri Jan 1 16:35:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Yanitskiy X-Patchwork-Id: 562033 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.osmocom.org (unknown [IPv6:2a01:4f8:191:444b::2:7]) by ozlabs.org (Postfix) with ESMTP id 51DFE140B9B for ; Sat, 2 Jan 2016 03:36:09 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=mbsm9UMN; dkim-atps=neutral Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id B9F3FBFF1; Fri, 1 Jan 2016 16:36:01 +0000 (UTC) X-Original-To: baseband-devel@lists.osmocom.org Delivered-To: baseband-devel@lists.osmocom.org Received: from mail-ob0-x233.google.com (mail-ob0-x233.google.com [IPv6:2607:f8b0:4003:c01::233]) by lists.osmocom.org (Postfix) with ESMTP id 5081DBFE2 for ; Fri, 1 Jan 2016 16:35:59 +0000 (UTC) Received: by mail-ob0-x233.google.com with SMTP id bx1so185349718obb.0 for ; Fri, 01 Jan 2016 08:35:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=2XDgpnA96/N0c6crSDJzDrzWlvo68y55dLVswi5M5+E=; b=mbsm9UMNp5PmPXG08vFWWjZS8fpe0t1wCS7lTgVl1akETtt6pGTVMwqNdOtxFKJD6E F51Ocofz4xVy0jiTCSfsUHadEN1mRTfoRl4EqyxkCZG+/ix4cnnO/FNh7uIsx58H5+9F pwY2rbBbye4vVkSRXpzIPYUaqy7Dfj3XYzlxyuoSjk8VrBzdRcKUXANgyig93R29x1lu k5dlqM/n/uHkpJ9zNoHwlad2xuy0FF8xKdeb/NQIyrN3ZXBT3QLmfZLDudtPcgmuqKkJ gkrMbmfbjoNCMK1xEI4ByZpVD1I0Bj+QYOPpIcs1PRzCoR6BAaGpNE/gPlgY6/PQNbwA m84w== MIME-Version: 1.0 X-Received: by 10.60.98.33 with SMTP id ef1mr51950092oeb.62.1451666158842; Fri, 01 Jan 2016 08:35:58 -0800 (PST) Received: by 10.202.198.148 with HTTP; Fri, 1 Jan 2016 08:35:58 -0800 (PST) Date: Fri, 1 Jan 2016 22:35:58 +0600 Message-ID: Subject: [PATCH] mobile_app: fix some configuration r/w bugs From: =?UTF-8?B?0JLQsNC00LjQvCDQr9C90LjRhtC60LjQuQ==?= To: baseband-devel@lists.osmocom.org X-BeenThere: baseband-devel@lists.osmocom.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: OsmocomBB - open source GSM baseband firmware List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: baseband-devel-bounces@lists.osmocom.org Sender: "baseband-devel" Happy New Year to all lists members! This patch fixes two bugs in mobile app: 1) If SAP connection fails mobile app does not save the sap-socket param in mobile.cfg. 2) The write command saves two unreadable strings: gpsd host HOST gpsd port PORT instead of: gpsd host HOST:PORT Patch source: { @@ -1499,8 +1499,7 @@ static int config_write(struct vty *vty) struct osmocom_ms *ms; #ifdef _HAVE_GPSD - vty_out(vty, "gpsd host %s%s", g.gpsd_host, VTY_NEWLINE); - vty_out(vty, "gpsd port %s%s", g.gpsd_port, VTY_NEWLINE); + vty_out(vty, "gpsd host %s:%s%s", g.gpsd_host, g.gpsd_port, VTY_NEWLINE); #endif vty_out(vty, "gps device %s%s", g.device, VTY_NEWLINE); if (g.baud) diff --git a/src/host/layer23/include/osmocom/bb/common/sap_interface.h b/src/host/layer23/include/osmocom/bb/common/sap_interface.h index bf19356..e4e64ce 100644 --- a/src/host/layer23/include/osmocom/bb/common/sap_interface.h +++ b/src/host/layer23/include/osmocom/bb/common/sap_interface.h @@ -11,6 +11,7 @@ int osmosap_sapsocket(struct osmocom_ms *ms, const char *path); int osmosap_init(struct osmocom_ms *ms); enum osmosap_state { + SAP_SOCKET_ERROR, SAP_NOT_CONNECTED, SAP_IDLE, SAP_CONNECTION_UNDER_NEGOTIATION, diff --git a/src/host/layer23/src/common/sap_interface.c b/src/host/layer23/src/common/sap_interface.c index a56f4f2..33bfa6c 100644 --- a/src/host/layer23/src/common/sap_interface.c +++ b/src/host/layer23/src/common/sap_interface.c @@ -515,7 +515,8 @@ int sap_open(struct osmocom_ms *ms, const char *socket_path) rc = connect(ms->sap_wq.bfd.fd, (struct sockaddr *) &local, sizeof(local)); if (rc < 0) { fprintf(stderr, "Failed to connect to '%s'\n", local.sun_path); - set->sap_socket_path[0] = 0; + // set->sap_socket_path[0] = 0; + ms->sap_entity.sap_state == SAP_SOCKET_ERROR; close(ms->sap_wq.bfd.fd); return rc; } diff --git a/src/host/layer23/src/common/sim.c b/src/host/layer23/src/common/sim.c index 8e8d7bf..df9fbd2 100644 --- a/src/host/layer23/src/common/sim.c +++ b/src/host/layer23/src/common/sim.c @@ -188,7 +188,7 @@ static int sim_apdu_send(struct osmocom_ms *ms, uint8_t *data, uint16_t length) /* adding SAP client support * it makes more sense to do it here then in L1CTL */ - if(ms->settings.sap_socket_path[0] == 0) { + if(ms->sap_entity.sap_state == SAP_SOCKET_ERROR) { LOGP(DSIM, LOGL_INFO, "Using built-in SIM reader\n"); l1ctl_tx_sim_req(ms, data, length); } else { diff --git a/src/host/layer23/src/mobile/vty_interface.c b/src/host/layer23/src/mobile/vty_interface.c index 5782a17..9ac2221 100644 --- a/src/host/layer23/src/mobile/vty_interface.c +++ b/src/host/layer23/src/mobile/vty_interface.c @@ -1067,7 +1067,7 @@ DEFUN(cfg_no_gps_enable, cfg_no_gps_enable_cmd, "no gps enable", } #ifdef _HAVE_GPSD -DEFUN(cfg_gps_host, cfg_gps_host_cmd, "gps host HOST:PORT", +DEFUN(cfg_gps_host, cfg_gps_host_cmd, "gpsd host HOST:PORT", "GPS receiver\nSelect gpsd host and port\n" "IP and port (optional) of the host running gpsd") { @@ -1499,8 +1499,7 @@ static int config_write(struct vty *vty) struct osmocom_ms *ms; #ifdef _HAVE_GPSD - vty_out(vty, "gpsd host %s%s", g.gpsd_host, VTY_NEWLINE); - vty_out(vty, "gpsd port %s%s", g.gpsd_port, VTY_NEWLINE); + vty_out(vty, "gpsd host %s:%s%s", g.gpsd_host, g.gpsd_port, VTY_NEWLINE); #endif vty_out(vty, "gps device %s%s", g.device, VTY_NEWLINE); if (g.baud)