linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Canplayer play to can0 - problem
@ 2015-10-19  9:14 s-amarce
  2015-10-19  9:41 ` Marc Kleine-Budde
  0 siblings, 1 reply; 2+ messages in thread
From: s-amarce @ 2015-10-19  9:14 UTC (permalink / raw)
  To: linux-can

To whom it may concern,

I am currently trying to play a recorded log-file to my installed device 
can0. There are no problems when the  data is streamed to the device 
using a cable.
I managed to stream the log file to a virtual device executing the 
command canplayer can0=3Dvcan0 < file.log.
Using this command I can see all the data using candump vcan0 without 
any problems.
However when I try to run: canplayer can0=3Dcan0 < file.log, I receive 
the error: "sendto: No buffer space available."
Is it possible to replay logfiles to real devices like can0 or do I have 
to use virtual devices?

My ifconfig after reboot:
           can0      Link encap:UNSPEC  HWaddr 
00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
           UP RUNNING NOARP  MTU:16  Metric:1
           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:10
           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
           Interrupt:68

// The error
          canplayer can0=3Dcan0 < data.log
          sendto: No buffer space available

// After
          ifconfig can0
           can0      Link encap:UNSPEC  HWaddr 
00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
           UP RUNNING NOARP  MTU:16  Metric:1
           RX packets:2 errors:0 dropped:0 overruns:0 frame:0
           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:10
           RX bytes:16 (16.0 B)  TX bytes:0 (0.0 B)
           Interrupt:68

I hope you can help me with this. I look forward to hearing from you.

Andreas Marcec

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Canplayer play to can0 - problem
  2015-10-19  9:14 Canplayer play to can0 - problem s-amarce
@ 2015-10-19  9:41 ` Marc Kleine-Budde
  0 siblings, 0 replies; 2+ messages in thread
From: Marc Kleine-Budde @ 2015-10-19  9:41 UTC (permalink / raw)
  To: s-amarce, linux-can

[-- Attachment #1: Type: text/plain, Size: 2838 bytes --]

On 10/19/2015 11:14 AM, s-amarce wrote:
> I am currently trying to play a recorded log-file to my installed device 
> can0. There are no problems when the  data is streamed to the device 
> using a cable.
> I managed to stream the log file to a virtual device executing the 
> command canplayer can0=3Dvcan0 < file.log.
> Using this command I can see all the data using candump vcan0 without 
> any problems.
> However when I try to run: canplayer can0=3Dcan0 < file.log, I receive 
> the error: "sendto: No buffer space available."
> Is it possible to replay logfiles to real devices like can0 or do I have 
> to use virtual devices?
> 
> My ifconfig after reboot:
>            can0      Link encap:UNSPEC  HWaddr 
> 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
>            UP RUNNING NOARP  MTU:16  Metric:1
>            RX packets:0 errors:0 dropped:0 overruns:0 frame:0
>            TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
>            collisions:0 txqueuelen:10
>            RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
>            Interrupt:68
> 
> // The error
>           canplayer can0=3Dcan0 < data.log
>           sendto: No buffer space available
> 
> // After
>           ifconfig can0
>            can0      Link encap:UNSPEC  HWaddr 
> 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
>            UP RUNNING NOARP  MTU:16  Metric:1
>            RX packets:2 errors:0 dropped:0 overruns:0 frame:0
>            TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
>            collisions:0 txqueuelen:10
>            RX bytes:16 (16.0 B)  TX bytes:0 (0.0 B)
>            Interrupt:68
> 
> I hope you can help me with this. I look forward to hearing from you.

You have to add a loop like this:

resend:
                nbytes = write(s, &frame, mtu);
                if (nbytes < 0) {
                        if (errno != ENOBUFS) {
                                perror("write");
                                return -1;
                        }
                        /* wait for the write socket (with timeout) */
                        if (poll(&fds, 1, polltimeout) < 0) {
                                 perror("poll");
                                 return -1;
                        } else {
                                goto resend;
                        }
                } else if (nbytes < mtu) {
                        fprintf(stderr, "write: incomplete CAN frame\n");
                        return 1;
                }

Patches welcome,
Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-19  9:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-19  9:14 Canplayer play to can0 - problem s-amarce
2015-10-19  9:41 ` Marc Kleine-Budde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).