On 18/01/07, Adrian Roskrow <adrian / hang10systems.co.uk> wrote:
> Hi
>
> I must be really stupid but I don't understand this at all, How does the
> usb scanner  connect, to a text editor. I don't know how to do that. I

Hi Adrian,

[what follows has nothing to do with Ruby; it concerns device setup]

What you are talking about is in industry terms a "keyboard stuffer"
device (also sometimes referred to as a "keyboard wedge" device).
This is basically a device which injects characters into the input
buffer stream.  In the case of a USB device, it does this through
software drivers.  Either these drivers are installed automatically
(e.g. on a plug-and-play O/S) or you must choose to install device
drivers manually for your O/S.

This is not the only way such a device may provide you with input
data; for example, some wedge devices require that you access the
incoming data by means of special driver interfaces and many permit
two-way communication with the device.  These kind of devices often do
not come configured as keyboard stuffers by default.

The easiest way to see if you have a keyboard stuffer is simply to
plug it in, run up your favourite text editor and scan a barcode.
Once it beeps to indicate successful read, you should see characters
appear on your editor window.  If nothing appears then your device is
probably NOT configured as a keyboard stuffer.

So, first things first, before you even start to run up Ruby, are you
seeing digits on-screen when you do a valid scan?

If so, does each barcode you scan appear as a sequence of digits on a
separate line or do all the digits join together on the same line?  If
the latter then you will have to consult your device's manual to see
how the terminating character can be set.  Usually this is a simple
matter of scanning the relevant setup barcodes from the manual pages.

If you do not see anything at this stage then you won't see anything
with $stdin either.  Then it's time to seek out the device manual to
see how to put it in keyboard stuffing mode.

Hope that helps...

-- 
Marcel