mikerovers / usb-barcode-scanner

A typed library for using USB barcode scanners in Node.js with support for Typescript
https://www.npmjs.com/package/usb-barcode-scanner
MIT License
26 stars 26 forks source link

Watching doesn't work #9

Open maroodb opened 4 years ago

maroodb commented 4 years ago

the devise works fine, but the example don't work,

I copied the same code and I changed productId and vendor.

maroodb commented 4 years ago

I think, this condition is no more applicable: the end of stream is not a '40'

 if (chunk[2] !== 40) {
                        bcodeBuffer.push(this.hidMap[chunk[2]]);
                    } else {
                        barcode = bcodeBuffer.join("");
                        bcodeBuffer = [];

                        this.emitDataScanned(barcode);
                    }

UPDATE : I added an "ENTER" suffix to the barecode scanner, but some characters are not supported by the library, I thinks hideMap doesn't cover all character