Greetings Monks,

I have some code that I have been running for months with no problems. The code opens a serial port, collects messages at 9600 baud and displays the proprietary format data in a collection of Perl Tk windows. Once again, this has been running great.

I now need to leave the box in my office and set up another in a lab. I have several Ubuntu 7.04 and 7.10 boxes available so I assumed there would be no problem. But, I am not able to open the serial port on either of the two boxes I have tried so far. Here are some of the details:

Key code lines from big file that has AND STILL DOES work ok on one box:
      use Device::SerialPort
      my $serial_port = new Device::SerialPort("/dev/ttyS0") || die "can't open ttyS0\n";

I have done both an "apt-get install libdevice-serialport-perl" and built the SerialPort module using the EXACT SAME downloaded file and instructions that were used on the working box.

Downloaded file: Device-SerialPort-1.002001.tar.gz downloaded on 06-29-2007.

Build instructions from http://www.sendpage.org/device-serialport/README.txt. This was downloaded and archived on 06-29-2007.

The downloaded instructions were:
      untar
      perl Makefile.PL
      make
      make test
      make install

My error message is: "can't getattr: Input/output error at ./(my_file_name.pl) line (line_with_new_Device::SerialPort).

After Googling I have tried:
      chmod a+rwx /dev/ttyS0
      chown me:me /dev/ttyS0
      execution from user "me" and user "root" tried.

After Googling I don't seem to be getting much that looks useful (and I understand) beyond changing permissions. Any suggestions would be appreciated.

Also, if a "fix" won't hold past a power cycle then I would like to add a part 2 "how to I make a fix that will survive a power cycle?".

And one more: I think it is GREAT that Linux has "ls", "lspci" and "lsusb". With these great features I was suprised that there does not seem to be a "lstty". Since my problem might be my Linux configuration and not Perl, what tools are available to me to gain information on my configuration? CuteCom seems happy wiht ttyS0 so I am using that to make the assumption that my hardware is ok.

Thanks,
Bruce


In reply to can't open ttyS0 with Device::SerialPort by Bruce32903

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.