Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Unfortunately, I wasn't able to reproduce anything like the issue you're having on my system, at least using a fake PTY. I ran both a shell script with the commands from the root node and this Perl script under strace -s256 -fe trace=read,write,ioctl, and in both cases the basic outline seemed to be the same, in particular, this bit was the same for both commands:

write(1, "/?!\r\n", 5) = 5 write(1, "\006000\r\n", 6) = 6

... and I was able to send all of the response lines from your root node to the Perl script and it received it just fine. This seems to indicate to me that the device you are talking to is behaving differently for the shell commands and the Perl script, for which I think the most likely explanation is either differing configuration or differences in what gets sent to the device, which is why I was wondering what the difference between the two is, but I don't see it yet.

I did have some issues where my stty complained about not knowing the modes crtscts onlcr echoctl echoke, but I'm not sure that has to do with the issue. Do you need all of those switches, or would the simpler form I showed in my node, cs7 parenb -parodd raw -echo, be enough? What OS are you on exactly? Do you happen to know what kernel driver this device is using? You could try running the same strace I showed above to see if there are significant differences between the shell commands and the Perl script on your system.

A couple of other ideas to check on: I did notice you added raw to the stty modes, I'm not sure if that makes a difference on your system. Also, I am wondering why you are getting the output /?! 000, since that's actually what your code is sending, i.e. maybe something went wrong in disabling echo. Plus, in the root node you're opening the port with cat before you do the stty, have you tried the cat afterwards to see if that makes a difference? Are you sure the code you've posted here is exactly what you are running? (In your root node, I'm not sure what the "Finish!" means.) Are you using strict and warnings? Lastly, are you sure that no other commands are mucking with the port while your Perl script is running, e.g. did you remember to kill all the backgrounded cat & commands?


In reply to Re^3: r/w attached infrared head on /dev/ttyUSB0 by haukex
in thread r/w attached infrared head on /dev/ttyUSB0 by stoerti

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2024-04-20 15:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found