This code was written for MagTek USB Swipe Readers part numbers are 21040101, 21040102, 21040103, 21040104, 21040113, 21040114, 21040119, 21040139, and 21040143. You can find this part number on the bottom of the device.
Read a complete description of this example program on my blog