USB bar code reader 'detached' usage?

From: Milan Obuch <>
Date: Thu, 14 Dec 2023 11:18:27 UTC

I am working on a project using bar code reader. When plugged into USB
port, it is recognised as USB keyboard, as illustrated by following
snipped from console log:

ugen0.8: <OKE Electron Company OKE PS2-USB V1.61> at usbus0
ukbd1 on uhub8
ukbd1: <OKE Electron Company OKE PS2-USB V1.61, class 0/0, rev 1.10/0.01, addr 8> on usbus0 
kbd3 at ukbd1

When I scan some barcode with it, raw keyboard codes are sent into
system keyboard. It just works as usual USB keyboard. This has some

First an annoyance - slovak keyboard layout traditionally shifts
numbers to uppercase. So with this layout, instead of numbers 123 I an
getting +ľš - while it works as intended, the result is not right.

This is not a big problem for my project, it does not use system
keyboard in its intended setup, communication is done via touch screen,
so I can just switch keyboard layout to English, but it is a hack I'd
like to avoid.

I'd like detach bar code reader from system keyboard (kbdmux), and
somehow read the complete bar code when detected, maybe as some kind of
event delivered to my program.

Did anybody encounter similar situation? Anybody working with USB bar
code readers who can share some experiences?