Hello,

To have usbnsh working I used, as a workaround, the implementation
done in this pull request:
https://github.com/apache/incubator-nuttx-apps/pull/521

In my application I don't use nsh. And USB-CDC works fine accessing
directly the device.

Hope it helps,

Best regards,

Flavio

Em ter., 20 de abr. de 2021 às 19:26, Alan Carvalho de Assis
<acas...@gmail.com> escreveu:
>
> Are you getting this error:
>
> "nsh> nsh: nsh_session: readline failed: 9"
>
> Could you please share your .config file?
>
> BR,
>
> Alan
>
> On 4/20/21, Max Kriegleder <max.kriegle...@gmail.com> wrote:
> > Strange.. I have sent two mails prior to this one and apparently they
> > did not make it to the list. Trying again:
> >
> > Were you able to fix this problem? I am running nuttx-10.0.1 on a
> > stm32f4discovery board and I have the same issue.
> >
> > Thanks!
> >
> >
> > On 2021/04/17 22:56:48, Alan Carvalho de Assis <a...@gmail.com> wrote:
> >  > I just received it!>
> >  >
> >  > Try to submit a new email>
> >  >
> >  > On 4/17/21, Max Kriegleder <ma...@gmail.com> wrote:>
> >  > > Is anybody reading this? I am not sure why my messages get lost.. how>
> >  > > can I post to the message list?>
> >  > >>
> >  > > On 2020/12/13 22:19:01, Brennan Ashton <b....@brennanashton.com>
> > wrote:>
> >  > > > Yeah 100% agree which is why I need to look when I have a little
> > more>>
> >  > > > time to understand what is going on.>>
> >  > > >>
> >  > > > On Sun, Dec 13, 2020 at 2:12 PM Gregory Nutt <sp...@gmail.com>
> > wrote:>>
> >  > > > >>>
> >  > > > > See>>
> >  > > > >>
> >  > >
> > https://mail-archives.apache.org/mod_mbox/nuttx-dev/202012.mbox/%3CCAKFLXYwes3pcDA2zXsL2FcwgCS4PecdmiP9srkGEtTaOoLEhMg%40mail.gmail.com%3E>>
> >
> >
> >  > >>
> >  > >>
> >  > > > >>>
> >  > > > > I don't think this is the correct solution since with Xiao
> > Xiang's>>
> >  > > > > recent changes, stdin should never be closed. But it does give
> > some>>
> >  > > > > clues about the nature of the problem: stdin is no valid;
> > stdout is>
> >  > > okay>>
> >  > > > >>>
> >  > > > > On 12/13/2020 4:07 PM, Brennan Ashton wrote:>>
> >  > > > > > This is impacting all the usbnsh configurations. I can take
> > another>>
> >  > > > > > look later this evening>>
> >  > > > > > https://github.com/apache/incubator-nuttx/pull/2526>>
> >  > > > > >>>
> >  > > > > > --Brennan>>
> >  > > > > >>>
> >  > > > > > On Fri, Dec 11, 2020 at 5:05 AM Gregory Nutt <sp...@gmail.com>>
> >  > > wrote:>>
> >  > > > > >> Several other PRs specifically removed support for fclose>
> >  > > (stdin). Are>>
> >  > > > > >> you certain you want to restore it? I think this needs more>
> >  > > analysis>>
> >  > > > > >> and resolution with the previous changes that removed the>
> >  > > fclose() of>>
> >  > > > > >> stdin, stdout, and stderr.>>
> >  > > > > >>>>
> >  > > > > >> On 12/10/2020 5:37 PM, Masayuki Ishikawa wrote:>>
> >  > > > > >>> Suzuki-san,>>
> >  > > > > >>>>>
> >  > > > > >>> Please send a PR (Pull Request) to>>
> >  > > > > >>> https://github.com/apache/incubator-nuttx-apps/>>
> >  > > > > >>>>>
> >  > > > > >>> On Thu, Dec 10, 2020 at 5:24 PM SUZUKI Keiji
> > <zu...@gmail.com>>
> >  > > wrote:>>
> >  > > > > >>>>>
> >  > > > > >>>> Hi,>>
> >  > > > > >>>>>>
> >  > > > > >>>> I use STM32F407G-DISC1 (MB997D) and build nuttx on macOS>
> >  > > Mojave (10.14.6).>>
> >  > > > > >>>>>>
> >  > > > > >>>> The following error occurs with the default configuration
> > of>>
> >  > > > > >>>> stm32f4discovery:usbnsh.>>
> >  > > > > >>>>>>
> >  > > > > >>>> NuttShell (NSH) NuttX-10.0.0>>
> >  > > > > >>>> nsh> nsh: nsh_session: readline failed: 9>>
> >  > > > > >>>>>>
> >  > > > > >>>> The reason seems that instream->fs_fd is -1 instead of 0 in>
> >  > > the readline()>>
> >  > > > > >>>> function called by>>
> >  > > > > >>>> nsh_session().>>
> >  > > > > >>>>>>
> >  > > > > >>>> This error occurs in version 10.0-RC0 and after (I checked>
> >  > > 10.0-RC0, 10.0>>
> >  > > > > >>>> and current master)>>
> >  > > > > >>>> but does not occur in 9.1 and before (I checked 9.1, 8.2 and>
> >  > > 7.31).>>
> >  > > > > >>>>>>
> >  > > > > >>>> The following patch fixed it in my environment but I don't>
> >  > > know this is a>>
> >  > > > > >>>> correct fix.>>
> >  > > > > >>>>>>
> >  > > > > >>>> === from here ===>>
> >  > > > > >>>>>>
> >  > > > > >>>> diff --git a/nshlib/nsh_usbconsole.c
> > b/nshlib/nsh_usbconsole.c>>
> >  > > > > >>>> index 28f63bcc..768a621b 100644>>
> >  > > > > >>>> --- a/nshlib/nsh_usbconsole.c>>
> >  > > > > >>>> +++ b/nshlib/nsh_usbconsole.c>>
> >  > > > > >>>> @@ -77,8 +77,8 @@>>
> >  > > > > >>>>>>
> >  > > > > >>>> static void nsh_configstdio(int fd, FAR struct
> > console_stdio_s>
> >  > > *pstate)>>
> >  > > > > >>>> {>>
> >  > > > > >>>> - /* Make sure the stdout, and stderr are flushed */>>
> >  > > > > >>>> ->>
> >  > > > > >>>> + /* Make sure the stdin is closed and the stdout, and
> > stderr>
> >  > > are flushed>>
> >  > > > > >>>> */>>
> >  > > > > >>>> + fclose(stdin);>>
> >  > > > > >>>> fflush(stdout);>>
> >  > > > > >>>> fflush(stderr);>>
> >  > > > > >>>>>>
> >  > > > > >>>> @@ -88,6 +88,9 @@ static void nsh_configstdio(int fd, FAR
> > struct>>
> >  > > > > >>>> console_stdio_s *pstate)>>
> >  > > > > >>>> dup2(fd, 1);>>
> >  > > > > >>>> dup2(fd, 2);>>
> >  > > > > >>>>>>
> >  > > > > >>>> + /* fdopen stdin */>>
> >  > > > > >>>> + fdopen(0, "r");>>
> >  > > > > >>>> +>>
> >  > > > > >>>> /* Setup the stdout */>>
> >  > > > > >>>>>>
> >  > > > > >>>> pstate->cn_outfd = 1;>>
> >  > > > > >>>>>>
> >  > > > > >>>> =====>>
> >  > > > > >>>>>>
> >  > > > > >>>> Thanks,>>
> >  > > > > >>>> SUZUKI Keiji>>
> >  > > > > >>>>>>
> >  > > >>
> >  > >>
> >  >
> >



-- 
Flavio de Castro Alves Filho

flavio.al...@gmail.com
Twitter: http://twitter.com/#!/fraviofii
LinkedIn profile: www.linkedin.com/in/flaviocastroalves

Reply via email to