1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Linux Outputting File to Serial ttyS0 port

Discussion in 'Tech Support' started by towelie, 11 Dec 2013.

  1. towelie

    towelie How do I Internet!!

    Joined:
    1 Sep 2011
    Posts:
    399
    Likes Received:
    10
    Hi guys

    Need some Help. So I'm running an asterisk box's on Cent OS 5, but i need to output the CDR file via the serial port, tail the file out would be the best but sending the file would still be acceptable.

    The other end of the serial connection is a 2008 R2 box with hyper terminal running, i can get it to output a serial console but cannot get it to output a file at all. Originally the Issue was the Dell BIOS settings for the COMS port, i have fix that and they are now getting correct IRQ's but no out put at all on the other end not even garbled characters. Setting, emulation and Baud rates are the same etc configured using the Set serial command.

    To output a file to the port i believe you can just use this command test > /dev/ttyS0
    also tried with Test text file etc but no luck any idea's.

    :hip::hip::hip::hip::hip::hip:
     
  2. faugusztin

    faugusztin I *am* the guy with two left hands

    Joined:
    11 Aug 2008
    Posts:
    6,953
    Likes Received:
    270
  3. towelie

    towelie How do I Internet!!

    Joined:
    1 Sep 2011
    Posts:
    399
    Likes Received:
    10
    Thanks faugusztin I'll give that a go today and Update :)
     
  4. Gareth Halfacree

    Gareth Halfacree WIIGII! Lover of bit-tech Administrator Super Moderator Moderator

    Joined:
    4 Dec 2007
    Posts:
    17,132
    Likes Received:
    6,728
    Not sure what you mean by using the command 'test' - that's a tool for checking file types and comparing values. What you want is 'cat'. Let's say you have the file iamafile.txt, and you want to shove it over the ttyS0 serial port. Simple:

    cat iamafile.txt > /dev/ttyS0

    Note that you'll need to be a member of the dialout group to make that happen. If in doubt, drop to a root shell and do it from there.

    If you're trying to send binary files, you'll likely need to use a protocol like Kermit, Xmodem, Ymodem or Zmodem like faugusztin has suggested - but remember you'll need to be running the same protocol at the receiving end. For plain text files, though, cat will work fine: the contents of the file will appear in your receiving terminal.
     
    towelie likes this.
  5. towelie

    towelie How do I Internet!!

    Joined:
    1 Sep 2011
    Posts:
    399
    Likes Received:
    10
    hi Guys Excellent got it working with the cat command, once i ran the serial command again. Massive thanks to you both, now just need to set a cron job to output the file when it gets updated or i will attempted to Tail it out.

    Big thanks lads :)
     

Share This Page