Suppose I have two textboxes:
Take a look at jQuery's keypress event
Bind this to your input box and it'll alert you when a user is using their keyboard for barcode input
Also, have you seen this question?