From: Jan Kiszka <jan.kiszka@domain.hid>
To: Everett Wang <everteq@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] error on rt_dev_read, code Success, what does it mean?
Date: Mon, 14 Jun 2010 22:03:16 +0200 [thread overview]
Message-ID: <4C168B04.1040506@domain.hid> (raw)
In-Reply-To: <AANLkTim0yd_MTu3ItT9aecUmH0yt1nj3TWbFVMcfcFMB@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2486 bytes --]
Everett Wang wrote:
> On Sat, Jun 12, 2010 at 6:45 PM, Jan Kiszka <jan.kiszka@domain.hid> wrote:
>> Everett Wang wrote:
>>> Thanks. I looked my code again, which is modified from example
>>> cross-link.c. The section looks like:
>>>
>>> ...
>>> irq_time = rx_event.rxpend_timestamp;
>>> read = rt_dev_read(read_fd, &write_time, sz);
>>> if (read == sz) {
>>> read_time = rt_timer_read();
>>> printf("%3d |%16llu |%16llu |%16llu\n", nr,
>>> irq_time - write_time,
>>> read_time - irq_time,
>>> read_time - write_time);
>>> nr++;
>>> } else if (read < 0 ) {
>>> printf(RTASK_PREFIX "error on rt_dev_read, code %s\n",
>>> strerror(-err)); <<<<<<<===========
>>> break;
>>> } else {
>>> printf(RTASK_PREFIX "only %d / %d byte received \n",
>>> read, sz);
>>> break;
>>> }
>>> ...
>>> I guess I should change the strerror(-err) to strerror(-read).
>> Indeed, the example suffers from some copy&paste mistakes. Same for the
>> write path. And closing in a loop is no longer required. A cleanup is
>> needed.
>>
>>> If I do
>>> that, I some
>>> times get a " code input/output error". That is better. What can cause
>>> input/output error?
>> Try RTSER_RTIOC_GET_STATUS to learn more.
>
> Thanks for answer my questions, I added
>
> err = rt_dev_ioctl(gps_fd,
> RTSER_RTIOC_GET_STATUS, &serstatus);
> printf(STASK_PREFIX "Error code line_status=%d
> modem_status=%d\n",serstatus.line_status, serstatus.modem_status);
>
> This prints a message:
>
> gps_task: Error code line_status=98 modem_status=187
>
> Line_status bits are RTSER_LSR_TRANSM_EMPTY , RTSER_LSR_THR_EMTPY,
> RTSER_LSR_OVERRUN_ER
>
> and modem status bits:
> RTSER_MSR_DCD, RTSER_MSR_DSR ,RTSER_MSR_CTS, RTSER_MSR_DDCD,
> RTSER_MSR_DDS, RTSER_MSR_DCTS
>
> Does it caused by "RTSER_LSR_OVERRUN_ER"?
> The GPS device outputs upto 450 characters every 0.1 second.
Looking at your code, you probably want to clear the quickly overflowing
RX queue and pending overflow errors before entering the read loop.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]
next prev parent reply other threads:[~2010-06-14 20:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-12 4:09 [Xenomai-help] error on rt_dev_read, code Success, what does it mean? Everett Wang
2010-06-12 9:31 ` Gilles Chanteperdrix
2010-06-12 10:13 ` Everett Wang
2010-06-12 10:45 ` Jan Kiszka
2010-06-12 17:14 ` Everett Wang
2010-06-14 20:03 ` Jan Kiszka [this message]
2010-06-14 14:53 ` Luc ANTOLINOS
2010-06-15 0:45 ` Everett Wang
2010-06-15 9:27 ` Luc ANTOLINOS
2010-06-17 7:49 ` Everett Wang
2010-06-17 8:48 ` Jan Kiszka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C168B04.1040506@domain.hid \
--to=jan.kiszka@domain.hid \
--cc=everteq@domain.hid \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.