Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

use Device::SerialPort; use Data::Dumper qw(Dumper); my $port = Device::SerialPort->new("/dev/ttyUSB3"); $port->baudrate(115200); # Configure this to match your device $port-> +databits(8); $port->parity("none"); $port->stopbits(1); $port->lookclear; for($i=1;$i<=100;$i++){ $port->write("\n^^^^^^^^^^^ rebooted $i times ++++++++^^^^^^^^^^^ \n") +; $port->write("cd /tmp \n"); $port->write("cp /mnt/usb/9798E1C89698/Disc-1/image.img . \n"); }

I am trying to copy image from usb to tmp location but 2 out of 10 times it happens dont know what is causing and how to fix this

Replies are listed 'Best First'.
Re: copy is not happening using
by Corion (Patriarch) on Jun 28, 2018 at 09:17 UTC

    It looks a bit as if you have a shell at the remote end of your USB / serial connection.

    If any of the commands actually takes time to complete, you need to give the other system time to react instead of writing commands to it as fast as you can.

    Maybe also consider looking at the results the remote end sends you, like error output etc.

Re: copy is not happening using
by haukex (Archbishop) on Jun 28, 2018 at 21:43 UTC