From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DD19C48BE5 for ; Wed, 16 Jun 2021 08:01:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 33E766054E for ; Wed, 16 Jun 2021 08:01:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232171AbhFPIDi (ORCPT ); Wed, 16 Jun 2021 04:03:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232154AbhFPIDN (ORCPT ); Wed, 16 Jun 2021 04:03:13 -0400 Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62D45C061760 for ; Wed, 16 Jun 2021 01:01:06 -0700 (PDT) Received: by mail-ot1-x344.google.com with SMTP id i12-20020a05683033ecb02903346fa0f74dso1640326otu.10 for ; Wed, 16 Jun 2021 01:01:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=zKbBM3dar0z9KtiIw9VPBWLRm0PXYT0oXsVyvqC2rv0=; b=rY+7R0n+snOz2Ygl3mNrIna/LciOo99+D5etRRjzkCRAWs2885DeBJ8DXFgxD7Oe7p afwumYSYUFGE1zkmiAugkhT27n5HlSelP4iyMG3PkX+hz86gEzoW03zhWqvurfpVzu0J P+Xb41wDA+86Ld9hhyH3zU7KF4UCwSYhDQZW/SHadl0J06NmuyCMdDAn769FXVHhnKe2 NeN6qAlkgpVjSEBPIx27ru97au7ST1hr4KhGcfcfCx4rbVO5PVV9Ry8waaza+E3JZAez GVpH8qDCY55NjDpboz37u8XtvB9CwLvIa3cIoQ2/MWifdL5dyft1y3o8KaG+Iptgx8DU dYJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=zKbBM3dar0z9KtiIw9VPBWLRm0PXYT0oXsVyvqC2rv0=; b=fAgaOpkOdmifWA1DR9nV21VOOr4uuGMr5MAqtjwmKt7LiAHkQFgOIuw72aorvPkPmY h5mkRDOcewUfPBtw+d4U1wNUDd+zepbxOjzov7khPCn2BkSkb9iIzgA7kbqyWMEV5uU2 1TDQMi6avkQpg8fxyTFPepe+CcQQmFNYiGgqQ/yfYdz+ucn09gHTXEiZfjbfoBjlhp3O CkvcjVCwpQX5yNSl84rgrRZGokr0t1XCsduDY+V9cLzgkJO+anM4PanIXgu8KfPZgqSb CfAuyU82Sz2AioQps1lCXBrUORrzja5DI6edO5tF1uvcbagvdMvkD+meOhNziahMVFGb kBkQ== X-Gm-Message-State: AOAM53295X4XnO4fLy+dCEy8nIijeiqSR1rshJLGEWtbjrl6IZ1LULBD rcAotBrDlKRWLtgvbt8YlEBN4PpHlUF9elML+10gv94/ X-Google-Smtp-Source: ABdhPJyfnItnKlY3++wesx21jATGtxruPjLGHqpTZC1Ew3PN2AnhH+XKTkUfH+SgvNmVf/7NEyPmGqOTvwKv8Ubw8Kc= X-Received: by 2002:a9d:748e:: with SMTP id t14mr2846291otk.354.1623830465764; Wed, 16 Jun 2021 01:01:05 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ac9:33b2:0:0:0:0:0 with HTTP; Wed, 16 Jun 2021 01:01:05 -0700 (PDT) In-Reply-To: References: <1623812199-31866-1-git-send-email-zhenguo6858@gmail.com> From: =?UTF-8?B?6LW15oyv5Zu9?= Date: Wed, 16 Jun 2021 16:01:05 +0800 Message-ID: Subject: Re: [PATCH] tty: n_gsm: Fix CR bit value when initiator=0 To: Jiri Slaby Cc: Greg KH , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dear gregkh=EF=BC=8CJiri I think that linux ngsm is cp cmux function (config slaver,c.initiator =3D 0),pc side or ubuntu or terminal will send "AT+CMUX" by tty dev, and send SABM.DISC.CLD command=E3=80=82 because project is YOCTO,YOCTO is IOT open project,need config slaver=EF=BC=8Cafter config =E2=80=9Cc.initiator =3D 0=E2=80=9D=EF=BC=8Cngs= m can=E2=80=98t work normally. slaver config ,it doesn't need to send "AT+CMUX" ---------------------------------------------------------- 2.1 switch the serial line to using the n_gsm line discipline by using TIOCSETD ioctl. 2.2 configure the mux using GSMIOC_GETCONF / GSMIOC_SETCONF ioctl. 2.3 obtain base gsmtty number for the used serial port, #include #include #include #include #define DEFAULT_SPEED B115200 #define SERIAL_PORT /dev/ttyS0 int ldisc =3D N_GSM0710; struct gsm_config c; struct termios configuration; uint32_t first; /* open the serial port */ fd =3D open(SERIAL_PORT, O_RDWR | O_NOCTTY | O_NDELAY); /* configure the serial port : speed, flow control ... */ /* use n_gsm line discipline */ ioctl(fd, TIOCSETD, &ldisc); /* get n_gsm configuration */ ioctl(fd, GSMIOC_GETCONF, &c); /* we are responter and need encoding 0 (basic) */ c.initiator =3D 0; c.encapsulation =3D 0; /* our modem defaults to a maximum size of 127 bytes */ c.mru =3D 127; c.mtu =3D 127; /* set the new configuration */ ioctl(fd, GSMIOC_SETCONF, &c); /* get first gsmtty device node */ ioctl(fd, GSMIOC_GETFIRST, &first); printf("first muxed line: /dev/gsmtty%i\n", first); /* and wait for ever to keep the line discipline enabled */ daemon(0,0); pause(); 2021-06-16 15:45 GMT+08:00, Jiri Slaby : > On 16. 06. 21, 9:39, Greg KH wrote: >> >> A: http://en.wikipedia.org/wiki/Top_post >> Q: Were do I find info about this thing called top-posting? >> A: Because it messes up the order in which people normally read text. >> Q: Why is top-posting such a bad thing? >> A: Top-posting. >> Q: What is the most annoying thing in e-mail? >> >> A: No. >> Q: Should I include quotations after my reply? >> >> http://daringfireball.net/2007/07/on_top >> >> On Wed, Jun 16, 2021 at 03:29:11PM +0800, =E8=B5=B5=E6=8C=AF=E5=9B=BD wr= ote: >>> Dear gregkh >>> >>> 1: Documentation/driver-api/serial/n_gsm.rst >>> >>> The text introduces the config of master ( c.initiator =3D 1), but the >>> config of as responder is different. >>> when set gsm->initiator=3D0 by GSMIOC_SETCONF ,ngsm driver should be >>> responder(slaver) >>> >>> config=EF=BC=9A >>> c.initiator =3D 0; // set initiator=3D0=EF=BC=8Cngsm as responder >>> ioctl(fd, GSMIOC_SETCONF, &c); >>> >>> 2: if master side send SABM/DISC frame data by uart dev >>> DLC0 control data frame:f9 03 3f 01 1c f9 >>> kernel log=EF=BC=9A gsmld_receive: 00000000: f9 03 3f 01 1c f9 >>> >>> { >>> cr =3D gsm->address & 1; /* C/R bit */ >>> //CR value=3D1 >>> >>> gsm_print_packet("<--", address, cr, gsm->control, gsm->buf, gsm->len)= ; >>> >>> cr ^=3D 1 - gsm->initiator; /* Flip so 1 always means command */ >>> //when gsm->initiator is 0, CR value=3D0 by "^=3D" calculation >>> dlci =3D gsm->dlci[address]; >>> >>> switch (gsm->control) { >>> case SABM|PF: >>> if (cr =3D=3D 0) >>> goto invalid; //if CR value=3D0,ngsm will goto >>> invalid,but the dlc0 control frame data is right,if we can't modify >>> ,ngsm can't send UA response data >>> } >> >> I am sorry, but I really do not understand what you are saying here. >> Please resubmit your patch with an updated changelog that explains why >> this change is needed and what it does. > > And why it was able to work until now. I.e. isn't the Documentation wrong= ? > > thanks, > -- > js > suse labs >