I sorry I don't have the means to help directly, but I'm curious about a couple things in your "pollForData" sub, and I can suggest a few questions to consider (which you've probably covered already, but hey, no harm asking).

Why do you not check the value of $length? (If you do check that, what do you get?) Why do you check "$buffer eq ''" before you check "!defined $buffer"?

If $length is greater than zero (which means $buffer must be defined), what would you see if you did this before returning:

printf( "%2.2x ", $_ ) for ( split //, $buffer ); print "\n";
(You might want to avoid setting $buffer to the initial value of RED,"NO DATA",RESET -- just set it to undef or "" to start with.)

Since you are doing a non-blocking read on the port, my first guess is that the device is not responding with data, so the original content of $buffer is not being replaced.

Are you using the same host computer (i.e. dual-boot windows/linux), or different boxes? If the latter, are you using the same serial cable on both OS's? (I would always have a null-modem adapter on hand for this kind of thing, and if a device/cable doesn't work without the adapter, I put on the adapter and try again.)


In reply to Re: cant read serial data with Device::SerialPort by graff
in thread cant read serial data with Device::SerialPort by Anonymous Monk

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.