Console driver not working?

James Fitzsimons <[email protected]> Sun, 27 Apr 2025 18:18:15 +1200
Newsgroups gmane.os.rtems.user
Message-ID <CAPi7d=AnzP5KqoYG31tGRDWcERD-Hq4SSU8+XHP3_EpawFPqzA@mail.gmail.com>
--===============5636150137856218332==
Content-Type: multipart/alternative; boundary="00000000000016fd4e0633bc8946"

--00000000000016fd4e0633bc8946
Content-Type: text/plain; charset="UTF-8"

Hi all,

I'm trying to get back into some embedded development using RTEMS after a
number of years away and have resurrected an old project using the
Beaglebone black as a starting point.

I have built the latest RTEMS and have some test applications running on
the board ok, but today I was trying to build a basic UI task and try as I
might I can't read input from the console.

I'm using the following code in the Init task:

char buf[80] = "";
char *cmd, *sval, *rval;
printf("cmd: ");

rval = fgets(buf, 80, stdin);
if (rval == NULL) {
printf("fgets returned NULL\n");
} else {
printf("fgets returned %s\n", rval);
}

printf("buf = %s\n", buf);
cmd = strtok(buf, " \t\n");
printf("cmd = %s\n", cmd);

which outputs:

Starting kernel ...


RTEMS Beagleboard: am335x-based
        ARM Debug: 0x4b141000
Starting Motor Testing
cmd: fgets returned NULL
buf =
cmd = (null)

I know the hardware connections are fine as I can use the Linux console ok.

Am I doing something stupid, or is the console driver for this BSP not
working as expected?

Many thanks for any advice you can provide!
Cheers,
James

--00000000000016fd4e0633bc8946
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hi all,</div><div><br></div><div>I&#39;m trying to ge=
t back into some embedded development using RTEMS after a number of years a=
way and have resurrected an old project using the Beaglebone black as a sta=
rting point.</div><div><br></div><div>I have built the latest RTEMS and hav=
e some test applications running on the board ok, but today I was trying to=
 build a basic UI task and try as I might I can&#39;t read input from the c=
onsole.</div><div><br></div><div>I&#39;m using the following code in the In=
it task:</div><div><br></div><div>	char buf[80] =3D &quot;&quot;;<br>	char =
*cmd, *sval, *rval;<br>	printf(&quot;cmd: &quot;);<br><br>	rval =3D fgets(b=
uf, 80, stdin);<br>	if (rval =3D=3D NULL) {<br>		printf(&quot;fgets returne=
d NULL\n&quot;);<br>	} else {<br>		printf(&quot;fgets returned %s\n&quot;, =
rval);<br>	}<br><br>	printf(&quot;buf =3D %s\n&quot;, buf);</div><div>	cmd =
=3D strtok(buf, &quot; \t\n&quot;);<br>	printf(&quot;cmd =3D %s\n&quot;, cm=
d);</div><div><br></div><div>which outputs:</div><div><br></div><div>Starti=
ng kernel ...<br><br><br>RTEMS Beagleboard: am335x-based<br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 ARM Debug: 0x4b141000<br>Starting Motor Testing<br>cmd: fgets=
 returned NULL<br>buf =3D <br>cmd =3D (null)<br></div><div><br></div><div>I=
 know the hardware connections are fine as I can use the Linux console ok. =
<br></div><div><br></div><div>Am I doing something stupid, or is the consol=
e driver for this BSP not working as expected?</div><div><br></div><div>Man=
y thanks for any advice you can provide!</div><div>Cheers,</div><div>James<=
/div><div><br></div><div><br></div></div>

--00000000000016fd4e0633bc8946--

--===============5636150137856218332==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
users mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/users
--===============5636150137856218332==--