most barcode scanners come with builtin code recognition, they work as an input device, some used to split into the keyboard cable, so programs just saw the input as if it had come from the keyboard