From patchwork Tue Oct 8 09:10:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Nyekjaer X-Patchwork-Id: 13826081 Received: from www530.your-server.de (www530.your-server.de [188.40.30.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 196BC166F29 for ; Tue, 8 Oct 2024 09:10:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=188.40.30.78 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728378650; cv=none; b=m/c90HP9B1+w/+UZbJXYgyGMZszHxiqzDCtDxCfJswLCxNKxycaLrTH50JQIntW8Xmpdc5eCnoHo3NO7DwEzJF97LMw3zgIoKOLO9jSyjZAeYMbRZZkPyHPVLYVqr3O4KkMN+ilRBOtoXpTAhCGvLeYvZETtApViPqZn9+D63sU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728378650; c=relaxed/simple; bh=rDv9DuV7nRWtXriGhBXKxvSfzkpsfbSMOGq0h8fmSJI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=eDgJG1IxkUBwqilWdALruI1aRwMpPc/GGuJ+VjCxdWhObuUBr9L/KCL/7niH9mv6wICZZEHn4pAbY6BRLj8Tubr8dwMf4a5fi7Vp7KnTuSgryWee/5hZZJj+Z+qmLRalk5Y8dXFns7Mboee5by50DD4fOIRpfC2bOcGRquSaXKg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=geanix.com; spf=pass smtp.mailfrom=geanix.com; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b=Hq5uiObx; arc=none smtp.client-ip=188.40.30.78 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=geanix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=geanix.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b="Hq5uiObx" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=geanix.com; s=default2211; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date: Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=6mMRVSo129lASwyj8g9/9UIGWT20G94SzPLN5Zj3ZQ8=; b=Hq5uiObxkPUMCqAmPt5caPJ1IX /Z/+WMPd04FDDthQvqYhLR3vGlOyYvYvfGtwTdm/lDAHpZx4MxXZa0sMT8LcTlzvkGi5OKTEI+x1f 8lBhXxrL1ExUgPdFQuzc5miErd+Gk/+u2CXph4gIVjO4GFMB8N/EsogzkmkOFeQfZw3dDRk6+TjOv OnczMIF53IxgexSlqKy0NOhAPz9nOeNkYXt9jK3IewEuSGrZ3M+n2XKKXFDc8QWGxPHO+BadYF28M s+bpm7XfHJgjImWHigL6TYiYv8wZxZGwxaTDT8Lixcw3mEbqDMek8PUAC8A7ECGOnddT34/kI4gOf 3FAJLQqQ==; Received: from sslproxy05.your-server.de ([78.46.172.2]) by www530.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sy6Ev-000MTM-01; Tue, 08 Oct 2024 11:10:45 +0200 Received: from [185.17.218.86] (helo=zen..) by sslproxy05.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sy6Eu-000P2R-26; Tue, 08 Oct 2024 11:10:44 +0200 From: Sean Nyekjaer To: ofono@lists.linux.dev Cc: Sean Nyekjaer , denkenz@gmail.com Subject: [PATCH 1/3] drivers: simcommodem: create rat to radio_access_mode function Date: Tue, 8 Oct 2024 11:10:34 +0200 Message-ID: <20241008091038.1567406-1-sean@geanix.com> X-Mailer: git-send-email 2.46.2 Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Authenticated-Sender: sean@geanix.com X-Virus-Scanned: Clear (ClamAV 0.103.10/27420/Mon Oct 7 10:43:46 2024) This is done in preparation for querying available rat modes --- drivers/simcommodem/radio-settings.c | 44 +++++++++++++++++----------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/drivers/simcommodem/radio-settings.c b/drivers/simcommodem/radio-settings.c index 0feba960..2a9dbaa2 100644 --- a/drivers/simcommodem/radio-settings.c +++ b/drivers/simcommodem/radio-settings.c @@ -33,6 +33,30 @@ struct radio_settings_data { GAtChat *chat; }; +int r_mode_to_radio_access_mode(int r_mode) +{ + int mode; + + switch (r_mode) { + case 2: + mode = OFONO_RADIO_ACCESS_MODE_ANY; + break; + case 13: + mode = OFONO_RADIO_ACCESS_MODE_GSM; + break; + case 14: + mode = OFONO_RADIO_ACCESS_MODE_UMTS; + break; + case 38: + mode = OFONO_RADIO_ACCESS_MODE_LTE; + break; + default: + return -1; + } + + return mode; +} + static void cnmp_query_cb(gboolean ok, GAtResult *result, gpointer user_data) { struct cb_data *cbd = user_data; @@ -61,23 +85,9 @@ static void cnmp_query_cb(gboolean ok, GAtResult *result, gpointer user_data) DBG("r_mode %d", r_mode); - switch (r_mode) { - case 2: - mode = OFONO_RADIO_ACCESS_MODE_ANY; - break; - case 13: - mode = OFONO_RADIO_ACCESS_MODE_GSM; - break; - case 14: - mode = OFONO_RADIO_ACCESS_MODE_UMTS; - break; - case 38: - mode = OFONO_RADIO_ACCESS_MODE_LTE; - break; - default: - CALLBACK_WITH_FAILURE(cb, -1, cbd->data); - return; - } + mode = r_mode_to_radio_access_mode(r_mode); + if (mode < 0) + goto error; cb(&error, mode, cbd->data); From patchwork Tue Oct 8 09:10:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Nyekjaer X-Patchwork-Id: 13826079 Received: from www530.your-server.de (www530.your-server.de [188.40.30.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 19706176AD8 for ; Tue, 8 Oct 2024 09:10:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=188.40.30.78 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728378649; cv=none; b=Srrbet0uOj+pnPWqGO6HODTjIxIEKcnu/p4JLDSKfuOMFzJVvGEHfzokQnmobSQQ+sbfK1IyavCrzwwec9SLSnm4DmOLuOnzo6T22AASMxqvjoOaTKGrzHxNDKUFZzPsXC6Hyjs6FuRzqyqCslrAhfDxswnOCBQBhDawI++jPeA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728378649; c=relaxed/simple; bh=O8rmXM+s4rS6l6NQIQfSglxf2KP9Ne51MGDWJ6lS86A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tc7+w1PgyQSZWeMWrd8r3gLkvldF4JTZ9TjVtcYmYLZMmDnmYi94lRKSxmiwft5hFb+WkjjWhBCd3dzzXI4Tq9S5k2dGe6ztXINQIaFMR7VVfIjX7xM+SpPpCMXf1UDXfhlhfaHr7iysWnAJbRPQNJNVLsFxoIgjaXVvwM3PV1U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=geanix.com; spf=pass smtp.mailfrom=geanix.com; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b=XfSnOGVI; arc=none smtp.client-ip=188.40.30.78 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=geanix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=geanix.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b="XfSnOGVI" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=geanix.com; s=default2211; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=rACWDPq5ykK9ebWT99rHdkfMHS5UkPK9jr7cKXb5Dlo=; b=XfSnOGVI3zvJNUngGUSHvDvNeq rH8yNSF6C52fLbDWO0Fb5g6KJd3GvIM2vrget1+njAbd0StMwr0IRuvCZVAxQbEv0k/9hFoUROVAJ rXX+S4vGz6c7ucDs3SVtTXcBA5f/6HnOuIsJ/noUtq93ajiU2qJKdMiYbROi3OwpRthG0Bym+3JXd Mi8jXO/pqDbjF8zQWGVHqIkAOzJTl8VuBuCMjcd+Am56qlIZOcyyawdrv7btALQOA6UI+a11/0i82 MYXn3JaWcpmQEiji3V4zaB8jmJrW5At0Sdu2t9Kq2HF8Ozy1VVV60GjUvBjR9l9aRamef3+DyKt7C 059qDflg==; Received: from sslproxy05.your-server.de ([78.46.172.2]) by www530.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sy6Ev-000MTN-3D; Tue, 08 Oct 2024 11:10:45 +0200 Received: from [185.17.218.86] (helo=zen..) by sslproxy05.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sy6Eu-000P2R-2e; Tue, 08 Oct 2024 11:10:44 +0200 From: Sean Nyekjaer To: ofono@lists.linux.dev Cc: Sean Nyekjaer , denkenz@gmail.com Subject: [PATCH 2/3] drivers: simcommodem: query modem for available rat modes Date: Tue, 8 Oct 2024 11:10:35 +0200 Message-ID: <20241008091038.1567406-2-sean@geanix.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241008091038.1567406-1-sean@geanix.com> References: <20241008091038.1567406-1-sean@geanix.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Authenticated-Sender: sean@geanix.com X-Virus-Scanned: Clear (ClamAV 0.103.10/27420/Mon Oct 7 10:43:46 2024) --- Should we default to gsm, umts + lte if the call fails? drivers/simcommodem/radio-settings.c | 53 +++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/drivers/simcommodem/radio-settings.c b/drivers/simcommodem/radio-settings.c index 2a9dbaa2..2bb0d148 100644 --- a/drivers/simcommodem/radio-settings.c +++ b/drivers/simcommodem/radio-settings.c @@ -97,6 +97,46 @@ error: CALLBACK_WITH_FAILURE(cb, -1, cbd->data); } +static void cnmp_rat_support_cb(gboolean ok, GAtResult *result, gpointer user_data) +{ + struct cb_data *cbd = user_data; + ofono_radio_settings_rat_mode_query_cb_t cb = cbd->cb; + struct ofono_error error; + int index; + GAtResultIter iter; + unsigned int available_rats = 0; + + DBG("ok %d", ok); + + decode_at_error(&error, g_at_result_final_response(result)); + + if (!ok) { + goto error; + } + + g_at_result_iter_init(&iter, result); + + while (g_at_result_iter_next(&iter, "+CNMP:")) { + if (!g_at_result_iter_open_list(&iter)) + break; + while (1) { + if (!g_at_result_iter_next_number(&iter, &index)) + break; + available_rats |= r_mode_to_radio_access_mode(index); + + } + } + + DBG("available_rats %d", available_rats); + + cb(&error, available_rats, cbd->data); + + return; + +error: + CALLBACK_WITH_FAILURE(cb, -1, cbd->data); +} + static void simcom_query_rat_mode(struct ofono_radio_settings *rs, ofono_radio_settings_rat_mode_query_cb_t cb, void *data) @@ -169,11 +209,16 @@ static void simcom_query_available_rats(struct ofono_radio_settings *rs, ofono_radio_settings_available_rats_query_cb_t cb, void *data) { - unsigned int available_rats = OFONO_RADIO_ACCESS_MODE_GSM - | OFONO_RADIO_ACCESS_MODE_UMTS - | OFONO_RADIO_ACCESS_MODE_LTE; + struct radio_settings_data *rsd = ofono_radio_settings_get_data(rs); + struct cb_data *cbd = cb_data_new(cb, data); + + DBG(""); - CALLBACK_WITH_SUCCESS(cb, available_rats, data); + if (g_at_chat_send(rsd->chat, "AT+CNMP=?", cnmp_prefix, + cnmp_rat_support_cb, cbd, g_free) == 0) { + CALLBACK_WITH_FAILURE(cb, -1, data); + g_free(cbd); + } } static void cnmp_support_cb(gboolean ok, GAtResult *result, gpointer user_data) From patchwork Tue Oct 8 09:10:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Nyekjaer X-Patchwork-Id: 13826080 Received: from www530.your-server.de (www530.your-server.de [188.40.30.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3ECB016BE2A for ; Tue, 8 Oct 2024 09:10:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=188.40.30.78 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728378649; cv=none; b=pqNcywJGS7ExD4qhAZhBorZimFLFB//+l4oeeMRU/XU0SHqSNhSMlRNpau41C6PM1kNZVNAo60x9clqDkp3O4LRiKBzzCf39S6hcs699M49lW2RDX5efbYihiyeG2OCGKJZqbq9eZoEdbe4VIstSDvtvmhZ3V+wrctery513fwc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728378649; c=relaxed/simple; bh=uc/hanB3RKz2ahsBgM+Yg3ovZBYPoXy39RS0UK3+qmw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tBU0HcLN4KLs8UiY5mXsz5I9ZOdehVXuLP9P3RrLndPAZvx/s29Es7y2VjjmGSBodYA6T7HT5Ame2p7XLPdIVLz6EvqIkU1ux6ScD//jySCaAaQqnjOBKbdg3hEozSX9mx43IXufQXE0OZ1iMkorRIcGWIEw4b/+2PMoXewMKfI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=geanix.com; spf=pass smtp.mailfrom=geanix.com; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b=LSP95l28; arc=none smtp.client-ip=188.40.30.78 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=geanix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=geanix.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b="LSP95l28" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=geanix.com; s=default2211; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=5/CXY8Uivqf3YkVgq1TkXQxTG5oGG2yfse1lyAVCrwk=; b=LSP95l28okaaKy74Tgfg2ddAm4 uXUx6hVE21RmldKp3fGN1tskfjUDDfWQTobLZbcossEVGhYYcNWKxFb4xyaZ6dCMMhW6yp1ZpZ2S2 8gAe3WmF4MI6pF6DQ5obxJdB9xtJkxa6W0ccY7XXkc4rn/A+XgicXLQhpsSgg6FPsXDMsCJtbv0XW QAdrx8hn4O0BIN+yHAj/jERYQ32+7AxwuywXwu6zyvN8uT8rzV+vy15p2aKZn5fY34WzbW2G4sOFm hSxfeAWgEl7CwoG5HzI640vJXST9IFWWrR3GzAXvnrdlgjNseb+LeW+D0cuaWRIsnwNtcQI8Gz0o/ YzbLCC3w==; Received: from sslproxy05.your-server.de ([78.46.172.2]) by www530.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sy6Ev-000MTR-8q; Tue, 08 Oct 2024 11:10:45 +0200 Received: from [185.17.218.86] (helo=zen..) by sslproxy05.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sy6Eu-000P2R-3C; Tue, 08 Oct 2024 11:10:45 +0200 From: Sean Nyekjaer To: ofono@lists.linux.dev Cc: Sean Nyekjaer , denkenz@gmail.com Subject: [PATCH 3/3] sim7100: create lte atom in post_sim() Date: Tue, 8 Oct 2024 11:10:36 +0200 Message-ID: <20241008091038.1567406-3-sean@geanix.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241008091038.1567406-1-sean@geanix.com> References: <20241008091038.1567406-1-sean@geanix.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Authenticated-Sender: sean@geanix.com X-Virus-Scanned: Clear (ClamAV 0.103.10/27420/Mon Oct 7 10:43:46 2024) Enable LTE functionality for SIMCom A7672E-FASE --- plugins/sim7100.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/sim7100.c b/plugins/sim7100.c index 9413a8af..eb5a4dbe 100644 --- a/plugins/sim7100.c +++ b/plugins/sim7100.c @@ -24,6 +24,7 @@ #include #define OFONO_API_SUBJECT_TO_CHANGE +#include #include #include #include @@ -104,9 +105,13 @@ static void sim7100_remove(struct ofono_modem *modem) static void cfun_set_on_cb(gboolean ok, GAtResult *result, gpointer user_data) { struct ofono_modem *modem = user_data; + struct sim7100_data *data = ofono_modem_get_data(modem); DBG(""); + if (data->model == SIMCOM_A76XX) + ofono_modem_set_capabilities(modem, OFONO_MODEM_CAPABILITY_LTE); + if (ok) ofono_modem_set_powered(modem, TRUE); } @@ -272,6 +277,7 @@ static void sim7100_post_sim(struct ofono_modem *modem) ofono_radio_settings_create(modem, 0, "simcommodem", data->at); gprs = ofono_gprs_create(modem, OFONO_VENDOR_SIMCOM_A76XX, "atmodem", data->at); + ofono_lte_create(modem, OFONO_VENDOR_SIMCOM_A76XX, "atmodem", data->at); break; default: ofono_netreg_create(modem, 0, "atmodem", data->at);