Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Reverse Engineering

by ok (Scribe)
on May 09, 2002 at 22:13 UTC ( #165540=perlquestion: print w/replies, xml ) Need Help??
ok has asked for the wisdom of the Perl Monks concerning the following question:

I have a piece of hardware, specifically a weather station, which connects to my computer via serial cable. The people the designed the software that manages the weather station's databases (which reside on the computer) did a piss poor job and, furthermore, have been hiatus for over a year now. As of now, I am sick of waiting for updates. I was wondering if anyone knows of a perl script or anything like that which I could use to monitor the signals that are sent from the program to the weatherstation and vis versa so that I could write my own version of the software which would a) work in linux, b) be in perl c) work on a consistant basis. If you know of anything, please let me know.

Replies are listed 'Best First'.
Re: Reverse Engineering
by grep (Monsignor) on May 09, 2002 at 22:21 UTC
    You might want to look at Device::SerialPort or the Linux HOWTO Serial-Programming-HOWTO. Then BEG and PLEAD for any doc's from the author on how his protocol works :).

    If your begging does not work, google for the protocol, or start Reverse Engineering it by looking at the data returned. REing a serial protocol IMO is best done by converting everthing into HEX so you don't miss non-printable chars (like STX).

    Good Luck

    Unix - where you can throw the manual on the keyboard and get a command
      Heh, yea been looking at those recently. I think I'm about to dive into unfamilar waters with this one. =) doc's from the author. . .HAHAHAHHA, those guys are twits. The program was originally done by TriGeo, however, they sold it to someone who hasn't done anything. ( TriGeo says they have no rights to give out any information nor will they give me the names/contact info for the new owners. It's a mess. Thanks for ytour advice though, I may end up writing my own scanner, yipes!
Re: Reverse Engineering
by ok (Scribe) on May 09, 2002 at 22:46 UTC
    I ran into something not more than a couple minutes ago that may be a big help not only to me but also anyone else out there. there's a freeware win32 program at that will let you monitor what's going on on a single port. =) mmmmm time for me to port this software methinks. Again, thanks for the suggestions grep, I will be using them.
      You generally only need such programs on 'doze due the ( you guessed it) fact that you are not granted knowledge of how windows works. Your post implies you are operating on something other than Windows. If this is the case, then you can just get in the middle between the program and the port.

      Under any Unix or BSD (and this should include OSX), just rename your serial port file and create a named pipe in it's place. Then create a small perl script to sit in between the two files, reading from one and writing to the other, and vice versa.

      Also, programs like ttysnoop are capable of getting in the middle like this.

      I didn't believe in evil until I dated it.

      Hey thanks for that pointer -- nice resource to know about, if it really does what you hope it does. Short of that, the first approach I could think of involves having a 2nd computer with two serial ports (or a total of three ports on one box), and have a script that "intermediates" between the weather station and the sucky user app -- the script just needs to make sure that everything gets passed through in both directions, and also gets saved to a log file with suitable annotations.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://165540]
Approved by grep
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2017-02-27 19:32 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (392 votes). Check out past polls.