Q: My company has Magtek magnetic stripe readers to read information from employee ID cards. Most PCs in my company has one of these readers installed. Until recently, we are using third party dll to communicate with readers, but unfortunately, this dll is showing signs of age (it was written for Win95). We have recently been getting a lot of phantom errors of this software (badge reader not detected, etc.)
A few weeks ago I took with me to a new communication DLL to write for VC + +, MFC, and standard API calls. The new dll works like a dream on all PCs except one of our test platform. All these PCs are similar – the configuration of the software has no major differences. On the problem PC, the software works in some cases (ie it can detect if the reader is not present), but when the user is prompted to swipe their badge, the badge reader is never only send data to the PC. In other words, in my test program I wrote code to the string retrieved from the badge reader to display a message. This code is never fired, which means that the badge was never any data to return to the pc.
Does anyone have any ideas? Im really stumped on this one.
Re:Originally posted by: guy
Here's a working link to Portmon (http://www.sysinternals.com/ntw2k/freeware/portmon.shtml).
Dave
haha. That was the worst link ever!!! Thanks for correcting me. I fixed the original link.
Re:Here's a working link to Portmon (http://www.sysinternals.com/ntw2k/freeware/portmon.shtml).
Dave
Re:The problem was being caused by using default values for some of the items in the DCB. I was forcing some of the DCB's members to known working values, but some I was allowing to default. When I began forcing all the members to known working values, the code started working as expected.
For a veteran programmer, I should have seen this right off, but I didn't.
Thanks for all the help, guys.
Re:You should have your program set the proper paremeters, not count on defaults.
Also, depending on the H/W being used, the I/O buffer chips may be different on the test bed.
I ran into that using USB communications on a project. Buffering of data was handled differently, I had to adjust the applicaiton to compensate for partial data coming in on a read.
Re:Thanks for the reply. I'm pretty sure the baud rate is not the problem because I have a loop set up that will attempt to connect at various rates, starting with high rates and progressively working downwards. The way the loop works is that I set the baud rate and send the reader this string: "<esc>I". If the connection is successful, the badge reader returns this string: "R". I loop through different baud rates until I exhaust all possibilities, or I get a good connection. This part of my code always works successfully (i.e. I always get a truly successful connection, or I get the error message).
The baud rate idea was a good one, and I am starting to think that one of the other connection parameters might be different on the problem pc, specifically parameters dealing with buffer control. In general, I am allowing the connection parameters to use default values. Maybe I need to force known working values.
If I find a solution to the problem I'll post it.
Re:Has your baud rate been set correctly? Are you using the correct type of serial cable (null modem vs. normal)?
For any type of serial port programming, this tool has been absolutely invaluable. PortMon (http://www.sysinternals.com/ntw2k/freeware/portmon.shtml) Using PortMon you can see whether the bytes are actually coming out over the serial port and just not being reeceived by your application or something else.
Anyway, baud rate or cabling is the normal culprit. If those are correct then post back with what Portmon told you. It does sound like a very strange problem
edit: fixed my horrible link
0 Comments.