# barcode scanner gets wrong data

## boxfile

I need support barcode scanner for my web app. I always get wrong data for scanner. I have tested with firefox and chromium.  They both get wrong data.

Like, the ISBN is 1234, but in my web app, the input element gets 3214 or others but not 1234.  But in software of scite and terminal, they get right data, 1234.

This is message from dmesg.

```
#dmesg |grep -i scan

[    1.341943] ahci 0000:00:1f.2: SSS flag set, parallel bus scan disabled

[    1.754135] usb 1-1.1: Product: SCANNER

[    1.754139] usb 1-1.1: Manufacturer: SCANNER

[    1.754143] usb 1-1.1: SerialNumber: SCANNER-32

[    1.755397] input: SCANNER SCANNER as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.0/0003:0483:5750.0001/input/input6

[    1.806072] hid-generic 0003:0483:5750.0001: input,hidraw0: USB HID v1.10 Keyboard [SCANNER SCANNER] on usb-0000:00:1a.0-1.1/input0

```

So I have checked /dev/hidraw0, the first datas are in scite, the second datas are in html input. In scite, the data is 6921168597925. In html input, the data is 6921859250616. I don't know how to analysis these data.

```
#od -x </dev/hidraw0

0000000 0000 0023 0000 0000 0000 0000 0000 0000

0000020 0000 0026 0000 0000 0000 0000 0000 0000

0000040 0000 001f 0000 0000 0000 0000 0000 0000

0000060 0000 001e 0000 0000 0000 0000 0000 0000

*

0000120 0000 0023 0000 0000 0000 0000 0000 0000

0000140 0000 0025 0000 0000 0000 0000 0000 0000

0000160 0000 0022 0000 0000 0000 0000 0000 0000

0000200 0000 0026 0000 0000 0000 0000 0000 0000

0000220 0000 0024 0000 0000 0000 0000 0000 0000

0000240 0000 0026 0000 0000 0000 0000 0000 0000

0000260 0000 001f 0000 0000 0000 0000 0000 0000

0000300 0000 0022 0000 0000 0000 0000 0000 0000

0000320 0000 0028 0000 0000 0000 0000 0000 0000

#od -x </dev/hidraw0

0000000 0000 0023 0000 0000 0000 0000 0000 0000

0000020 0000 0026 0000 0000 0000 0000 0000 0000

0000040 0000 001f 0000 0000 0000 0000 0000 0000

0000060 0000 001e 0000 0000 0000 0000 0000 0000

*

0000120 0000 0023 0000 0000 0000 0000 0000 0000

0000140 0000 0025 0000 0000 0000 0000 0000 0000

0000160 0000 0022 0000 0000 0000 0000 0000 0000

0000200 0000 0027 0000 0000 0000 0000 0000 0000

0000220 0000 0026 0000 0000 0000 0000 0000 0000

0000240 0000 001f 0000 0000 0000 0000 0000 0000

0000260 0000 0022 0000 0000 0000 0000 0000 0000

0000300 0000 0023 0000 0000 0000 0000 0000 0000

0000320 0000 0028 0000 0000 0000 0000 0000 0000

```

I don't know what's wrong. Thank you for any advice.

----------

## Roman_Gruber

 *Quote:*   

> 
> 
> I need support barcode scanner for my web app. I always get wrong data for scanner.

 

I used to work with barcode scanners many years ago.

Usually any barcode scanner has to be programmed for the user scenario.

Most importantly when you program barcode scanner for only the desired scenario, all other barcode standards won't be read, less output which is not desired.

Not every barcode scanner delivers the same reliability.

--

In short: Check what your barcode scanner is programmed for! Else reprogram

Check what is read in!

check how the output is coded. The manual usually knows more

----------

## boxfile

Thanks for your reply.

 *Quote:*   

> In short: Check what your barcode scanner is programmed for! Else reprogram
> 
> Check what is read in!
> 
> check how the output is coded. The manual usually knows more

 

I can choice barcode scanner. But I don't know which one can work for linux browser.

My scanner is FG3204. It can read EAN-13 CODE128 CODE93 CODE39. I think it use EAN-13. But I don't know what's code for output.

I don't know this is driver's problem. I test in win7, it will install driver at the first time when connect. I use ie and other browsers, they work well.

I have little knowledge for driver. My system is 4.4.6-gentoo x86_64. I want my app to support linux.

----------

## NeddySeagoon

boxfile,

Barcode scanners typically appear as keyboards to Linux.

Please run lsusb and post the result for your scanner.

Once we know the vendor and device IDs we can start from there.

----------

## szatox

You could also consider a software barcode scanner.

Zbar is doing pretty fine job sending codes to standard output. You can restrict coding to a single sort or let it guess, and it supports QR codes too. The downside is  you need a webcam that would provide you reasonable picture. My old webcam is at the bottom edge, only able to scan bigger codes, though I suppose any modern webcam would be good enough.

----------

## Roman_Gruber

Same as in the past

http://www.farsun.cn/Upload/Honor/download/201110261204031498742959.pdf

You set up your barcode scanner that way.

Print out that manual.

To set up your barcodescanner, you scan all needed parameters from that manual.

--

 *Quote:*   

> Usually any barcode scanner has to be programmed for the user scenario. 

 

!! Reading the manual very often helps you avoding questions. This barcode scanner works the same way as 10 years ago I used one the last time in my job !!

It is a common practise to read the manual when you buy a new product. 

It is a common practise to read generic informations about a new technical aspect, when you purchase a new product.

--

Without programming the device, teh device may act correctly, but most probably scan unneeded barcodes, give wrong output and such. 

First thing after opening the box, read the manual, set up the device according to the manual. Do some tests with known barcodes. It helps to generate a test environment with generated barcodes, so you know that the devices works as it should. Verify later that the programming was successful.

----------

## boxfile

 *NeddySeagoon wrote:*   

> Please run lsusb and post the result for your scanner.

 

Sorry for long time to reply. 

```
 # lsusb

Bus 002 Device 004: ID 04d9:1603 Holtek Semiconductor, Inc. Keyboard

Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 001 Device 004: ID 064e:d250 Suyin Corp. 

Bus 001 Device 003: ID 093a:2510 Pixart Imaging, Inc. Optical Mouse

Bus 001 Device 005: ID 0483:5750 STMicroelectronics 

Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
```

I think the STMicroelectronics is the scanner.Last edited by boxfile on Tue Jan 17, 2017 2:04 am; edited 1 time in total

----------

## boxfile

 *szatox wrote:*   

> webcam

 

Thanks for your advice. I will add it for next publish.

----------

## boxfile

 *Roman_Gruber wrote:*   

> manual

 

Sorry for long time to reply.

Yes, I have asked the producer. They don't support my situation. But when i buy the scanner, they claims that it support linux system and not need install driver.

----------

