Skip to main content

QR / Barcode Scanner

Stockaj Kiosk supports USB HID QR code and barcode readers — scanners that emulate a keyboard and send characters followed by an Enter key.

Compatible Scanners

Any USB scanner that works as a keyboard emulator (HID) is compatible. This is the default mode for the vast majority of scanners on the market.

tip

Test your scanner by opening a text editor: if the scanned code appears as typed text followed by a newline, it is compatible.

How It Works

  1. The scanner sends the code characters one by one, like keyboard strokes
  2. The kiosk detects rapid keystrokes (less than 100 ms between each character) and accumulates them
  3. When the Enter key is received (or after a timeout), the complete code is processed

This mechanism distinguishes a scan from manual keyboard input.

Scanner on the Cockpit

The scanner is always active on the cockpit. Its behavior is smart: it automatically determines the action to perform based on the scanned item's state.

SituationBehavior
The scanned item is part of an active rentalSelects the volunteer, switches to Return tab, loads rentals
The scanned item is availableSwitches to Checkout tab, adds the item to the cart
The item is not foundDisplays an error message
Network errorDisplays an error message

Scanning an item

Screens Where the Scanner Is Active

ScreenScanner ActiveBehavior
CockpitSmart detection: checkout or return based on item state
SetupScanner is not active

Timeout Configuration

The delay between keystrokes to consider input as a scan is configurable. The default value is 100 ms, which suits most scanners.

If your scanner sends characters more slowly, you can increase this value via the environment variable:

VITE_SCANNER_TIMEOUT_MS=150

Troubleshooting

ProblemSolution
Scan is not detectedVerify the scanner is in HID (keyboard) mode. Test in a text editor.
Scan is incompleteIncrease the timeout (VITE_SCANNER_TIMEOUT_MS)
Keyboard input triggers scansDecrease the timeout if you previously increased it
"Unknown code" after a scanThe item does not exist in Stockaj — verify it is registered
Scanner does not work on the setup pageThe scanner is disabled on this screen