Re: [SLUG] USB Keyboard

From: Ian C. Blenke (icblenke@nks.net)
Date: Mon Sep 25 2006 - 14:08:15 EDT


Bill Glidden wrote:

> I’m working on a POS application, and I am trying to use a credit card
> reader that emulates a USB keyboard.
>
> I know that the particular device works, because I can hook it up to a
> windows machine and it’s fine.
>
> USB keyboard support is enabled in the system BIOS.
>
> When I boot Debian, I see that the device is recognized as a USB
> keyboard from the following message:
>
> “input: USB HID v1.0 Keyboard [POSIFLEX INC. …..] on usb2:6.0”.
>
> I login to Debian, and issue the command “cat >/dev/null”. However,
> when I swipe a credit card I get nothing.
>
> I expected to see the credit card data echoed on the terminal as if it
> were typed.
>
> Do I need to do something with the kernel to enable the use of a USB
> keyboard?
>

There are two modes of operation of a USB keyboard: "boot protocol" and
"HID".

If your system's BIOS is told to be aware of USB keyboards, it will
initialize the keyboard in "boot protocol" mode and insert a realmode
driver to talk to it. The kernel does have a "usbkbd" driver to interact
with a boot protocol initialized USB input device, but you really don't
want to use that if you don't have to.

You really want HID mode (you may need to disable it in your BIOS).

You then just need to make sure the USB HID driver is loaded (modprobe
usbhid).

The "input" driver should then see your HID keyboard (which is what I
believe your email states), and you should then be able to see it and
get events from it.

First, check to see that it is visible:

cat /proc/bus/input/devices

That, and dmesg.

If you see that input sees your keyboard, try using evtest on the event
source:

evtest /dev/input/event#

Where # is the number of your keyboard's event source. You should see it
in /proc/bus/input/devices on the Handlers= line.

See if this helps you at all:

http://kerneltrap.org/node/2199

Once the "input" subsystem sees your keyboard, the keyboard should "act
normal" and provide core keyboard events to your Xserver and whatnot.

This is all with a 2.6 kernel, mind you. With 2.4, the "input" subsystem
isn't there, and things are a bit different.

- Ian C. Blenke <ian@blenke.com> http://ian.blenke.com/

-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 17:28:23 EDT