Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to handle input from a keyboard "wedge"

I'm writing a C# POS (point of sale) system that takes input from a keyboard wedge magcard reader. This means that any data it reads off of a mag stripe is entered as if it were typed on the keyboard very quickly. Currently I'm handling this by attaching to the KeyPress event and looking for a series of very fast key presses that contain the card swipe sentinel characters.

Is there a better way to deal with this sort of input?

Edit: The device does simply present the data as keystrokes and doesn't interface through some other driver. Also We use a wide range of these types of devices so ideally a method should work independent of the specific model of wedge being used. However if there is no other option I'll have to make do.

like image 271
Mykroft Avatar asked Sep 03 '08 19:09

Mykroft


People also ask

How does a keyboard wedge work?

The hardware form of a keyboard wedge inserts the translation device between the reader and the keyboard. Data sent through a wedge appears as if it was typed into the computer, while the keyboard itself remains fully functional.

What is a keyboard wedge software?

A software keyboard wedge reads data from a serial port and passes this data to a PC application in such a manner that the application thinks the data is entered via the keyboard. A hardware wedge reads data from digital gages or RS-232 devices and sends the data to the PC via a keyboard or USB port.


1 Answers

One thing you can do is that you should be able to configure your wedge reader so that it presents one or many escape characters before or after the string. You would use these escape characters to know that you are about to have (or just had) a magcard input.

This same technique is used by barcode reader devices so you application knows to get focus or handle the data input from the device.

The negative to this approach is that you have to properly configure your external devices. This can be a deployment issue.

This assumes that your devices simply present the data as keystrokes and don't interface through some other driver.

like image 156
jttraino Avatar answered Oct 13 '22 13:10

jttraino