Can I get a linux system to listen for data on a serial port and then validate it?


We have a very ancient Parking system running on an NT server. We encode our guests keys for their hotel room on magnetic key cards with a series of strings of data like 00000000555500000120000130000201100000120000014000002011. Previously, we would encode their room keys and then go on another machine to encode their parking system key. The machine that encode the parking keys in dead and the software is no longer supported.  BUT, the server that communicates with the gates and tells them that a key is valid is still working. I am not sure I wanna do anything with that.

Is there any program that I can use to listed to the gates like their server those which I can have look at the data being read which is basically 0s and room number 0s arrival date 0s departure and reply back asking them to open?

If not then I will even settle for a program that can tell if anything is written on a specific track and reply to open.

Any ideas would be use full!

Who is Participating?
Can you just read the serial port as a file:

# replace aux0 with the linux name of the serial port that you're connected to
open(CARDREADER, "</dev/aux0") || die "Cannot open card reader: $!";

while (my $line = <CARDREADER>) {
    # do stuff here


Open in new window


You may archive your goal by using some serial port connection libraries, and write your rutine for your particular use, hope the following links could help you or be a starting point

libraries for:




kaosmadnessAuthor Commented:
uhmmm. Thanks. I think it might take me a while since I don't know c or python. Maybe someone can give me a hint on a simple script that would set the com port at a certain setting, open/begin listening and reply a predefined answer to all queries. The first part would have been great if it could make sense of the hotel room key information but at  this time we are kinda in a bind because even if we pay to purchase a new parking system it will take a while to install. My temporary solution has been to clone a valid parking card's mag stripe encode the room information on another track. Thanks for the info though!!
kaosmadnessAuthor Commented:
Thanks for pinging me on the right direction! I finally got it to work!!!
Glad to be of assistance!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.