From patchwork Sat Jul 8 09:37:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Danzberger X-Patchwork-Id: 1805169 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QyldN48qgz20Nq for ; Sat, 8 Jul 2023 19:41:10 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:Message-Id:Date:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=lUl5E7i/qWHw1qes8bMNpmYI9hQWiq6UQwqbvcFcJF0=; b=EkfrsqoN+lpRjP 3roAG6uFamYaOBbXANe87HZz/cInSBkZjizj0LbzEUWvDe8dYfI19WhZLOvypfa9oG7xkTp2RPxmZ wr82Ftn7SthN9TZcgWXEswHTBo5YeDSTUcWQHA2cho/ay2yc9Vt4RbXbrJPp/whwh3ANQlE0UBYPs Q+L8Ap/+K2Vi+p2xRgRkl2yFR7IQV4vU97JjAxHbRsV/Q/UfnxwAKziP8RpYaYN3TWGHg7L+T+SaJ q6JAz+Wu2xkC3xtkK7qFYK7foeUkz2GNAtIWsJHcEjPlJIWHi6MjqWzDFVPZEOiCJSunBninlWx4C dVlDIoucWYf4/dC5AMdw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qI4OC-006uMq-2c; Sat, 08 Jul 2023 09:38:04 +0000 Received: from mail.as201155.net ([185.84.6.188]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qI4O9-006uM4-07 for openwrt-devel@lists.openwrt.org; Sat, 08 Jul 2023 09:38:02 +0000 Received: from smtps.newmedia-net.de ([2a05:a1c0:0:de::167]:52538 helo=webmail.newmedia-net.de) by mail.as201155.net with esmtps (TLS1) tls TLS_DHE_RSA_WITH_AES_256_CBC_SHA (Exim 4.96) (envelope-from ) id 1qI4O0-0006gk-2Q; Sat, 08 Jul 2023 11:37:52 +0200 X-SASI-Hits: BODYTEXTP_SIZE_3000_LESS 0.000000, BODY_SIZE_2000_2999 0.000000, BODY_SIZE_5000_LESS 0.000000, BODY_SIZE_7000_LESS 0.000000, CTE_8BIT 0.000000, DKIM_ALIGNS 0.000000, DKIM_SIGNATURE 0.000000, HTML_00_01 0.050000, HTML_00_10 0.050000, LEGITIMATE_SIGNS 0.000000, MULTIPLE_RCPTS 0.100000, MULTIPLE_REAL_RCPTS 0.000000, NO_CTA_URI_FOUND 0.000000, NO_FUR_HEADER 0.000000, NO_URI_HTTPS 0.000000, OUTBOUND 0.000000, OUTBOUND_SOPHOS 0.000000, SENDER_NO_AUTH 0.000000, SUSP_DH_NEG 0.000000, TRANSACTIONAL 0.000000, __ANY_URI 0.000000, __BODY_NO_MAILTO 0.000000, __BODY_VOICEMAIL 0.000000, __BULK_NEGATE 0.000000, __CC_NAME 0.000000, __CC_NAME_DIFF_FROM_ACC 0.000000, __CC_REAL_NAMES 0.000000, __CTE 0.000000, __DKIM_ALIGNS_1 0.000000, __DKIM_ALIGNS_2 0.000000, __DQ_NEG_DOMAIN 0.000000, __DQ_NEG_HEUR 0.000000, __DQ_NEG_IP 0.000000, __FROM_ADDY_SHORT_LC 0.000000, __FROM_DOMAIN_IN_ANY_CC1 0.000000, __FROM_DOMAIN_IN_RCPT 0.000000, __FUR_RDNS_SOPHOS 0.000000, __HAS_CC_HDR 0.000000, __HAS_FROM 0.000000, __HAS_MSGID 0.000000, __HAS_X_MAILER 0.000000, __MIME_TEXT_ONLY 0.000000, __MIME_TEXT_P 0.000000, __MIME_TEXT_P1 0.000000, __MIME_VERSION 0.000000, __MULTIPLE_RCPTS_CC_X2 0.000000, __OUTBOUND_SOPHOS_FUR 0.000000, __OUTBOUND_SOPHOS_FUR_IP 0.000000, __OUTBOUND_SOPHOS_FUR_RDNS 0.000000, __PHISH_SPEAR_SUBJ_SUBJECT 0.000000, __SANE_MSGID 0.000000, __SUBJ_STARTS_S_BRACKETS 0.000000, __SUBJ_TRANSACTIONAL 0.000000, __SUBJ_TR_GEN 0.000000, __TO_MALFORMED_2 0.000000, __TO_NO_NAME 0.000000, __URI_MAILTO 0.000000, __URI_NO_WWW 0.000000, __URI_NS 0.000000, __X_MAILSCANNER 0.000000 X-SASI-Probability: 8% X-SASI-RCODE: 200 X-SASI-Version: Antispam-Engine: 5.1.1, AntispamData: 2023.7.8.90617 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dd-wrt.com; s=mikd; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To:From; bh=9zOsPYyklG3sGDUld96nbu3NQAxOjWHEULuUgLGva68=; b=Ubw6sBZMAUQ68ze3mcePsaumTZFtevtAGzfAUVbuOHIQQPu88LAoAFK9/uDXEJn3hfuWizZSLCG6klNt7UFVpxcbcsUijKAOtDBwJsgBxhSoC4vbySqLph/1PKn6dA+1F1LKtJgjlVmthf/OV8uCAMs3DbdQuFAYN0hRkx+oZrc=; From: Daniel Danzberger To: openwrt-devel@lists.openwrt.org Date: Sat, 8 Jul 2023 11:37:46 +0200 Message-Id: <20230708093746.463343-1-daniel@dd-wrt.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a02:908:2615:2c30:4296:a4f:9400:caa X-SA-Exim-Mail-From: daniel@dd-wrt.com Subject: [PATCH] umbim: Add mbim message timeout option, -T X-SA-Exim-Version: 4.2.1 (built Thu, 26 May 2011 15:22:33 +0200) X-SA-Exim-Scanned: No (on webmail.newmedia-net.de); Unknown failure X-NMN-MailScanner-Information: Please contact the ISP for more information X-NMN-MailScanner-ID: 1qI4Nw-0008LX-TQ X-NMN-MailScanner: Found to be clean X-NMN-MailScanner-From: daniel@dd-wrt.com X-Spam-Status: No X-Received: from [2a02:908:2615:2c30:4296:a4f:9400:caa] (helo=localhost.localdomain) by webmail.newmedia-net.de with esmtpa (Exim 4.72) (envelope-from ) id 1qI4Nw-0008LX-TQ; Sat, 08 Jul 2023 11:37:51 +0200 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230708_023801_256946_C5D306C5 X-CRM114-Status: GOOD ( 10.33 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Some modems, depending on their state and connection quality can take longer than 15 seconds to answer mbim message requests. This commit adds the -T option, allowing the user to specifiy a custom message timeout in seconds. Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Danzberger Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Some modems, depending on their state and connection quality can take longer than 15 seconds to answer mbim message requests. This commit adds the -T option, allowing the user to specifiy a custom message timeout in seconds. Default is still 15. Signed-off-by: Daniel Danzberger --- cli.c | 9 +++++++-- mbim-dev.c | 2 +- mbim.h | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cli.c b/cli.c index 3a845d4..6026a67 100644 --- a/cli.c +++ b/cli.c @@ -35,6 +35,7 @@ int return_code = -1; int verbose; +int msg_timeout_ms = 15 * 1000; struct mbim_handler *current_handler; static uint8_t uuid_context_type_internet[16] = { 0x7E, 0x5E, 0x2A, 0x7E, 0x4E, 0x6F, 0x72, 0x72, 0x73, 0x6B, 0x65, 0x6E, 0x7E, 0x5E, 0x2A, 0x7E }; @@ -533,7 +534,8 @@ usage(void) #endif " -d the device (/dev/cdc-wdmX)\n" " -t the transaction id\n" - " -n no close\n\n" + " -n no close\n" + " -T MBIM message timeout in seconds [15]\n\n" " -v verbose\n\n"); return 1; } @@ -548,7 +550,7 @@ main(int argc, char **argv) int proxy = 0; #endif - while ((ch = getopt(argc, argv, "pnvd:t:")) != -1) { + while ((ch = getopt(argc, argv, "pnvd:t:T:")) != -1) { switch (ch) { case 'v': verbose = 1; @@ -563,6 +565,9 @@ main(int argc, char **argv) no_open = 1; transaction_id = atoi(optarg); break; + case 'T': + msg_timeout_ms = atoi(optarg) * 1000; + break; #ifdef LIBQMI_MBIM_PROXY case 'p': proxy = 1; diff --git a/mbim-dev.c b/mbim-dev.c index 2a94d49..12d1189 100644 --- a/mbim-dev.c +++ b/mbim-dev.c @@ -78,7 +78,7 @@ mbim_send(void) perror("writing data failed: "); } else { expected = le32toh(hdr->type) | 0x80000000; - uloop_timeout_set(&tout, 15000); + uloop_timeout_set(&tout, msg_timeout_ms); } return ret; } diff --git a/mbim.h b/mbim.h index 746257e..28999b5 100644 --- a/mbim.h +++ b/mbim.h @@ -20,6 +20,7 @@ extern int return_code; extern int verbose; +extern int msg_timeout_ms; #include "mbim-type.h" #include "mbim-enum.h"