Documentation ¶
Index ¶
Constants ¶
View Source
const ( EVENT_BUFFER = 64 EVENT_CAPTURES = 16 SCANNER_DEVICE = "/dev/input/event0" // default location on the Pi )
Variables ¶
View Source
var EVENT_SIZE = int(unsafe.Sizeof(InputEvent{}))
View Source
var KEYCODES = map[byte]string{
0x02: "1",
0x03: "2",
0x04: "3",
0x05: "4",
0x06: "5",
0x07: "6",
0x08: "7",
0x09: "8",
0x0a: "9",
0x0b: "0",
0x0c: "-",
0x10: "q",
0x11: "w",
0x12: "e",
0x13: "r",
0x14: "t",
0x15: "y",
0x16: "u",
0x17: "i",
0x18: "o",
0x19: "p",
0x1e: "a",
0x1f: "s",
0x20: "d",
0x21: "f",
0x22: "g",
0x23: "h",
0x24: "j",
0x25: "k",
0x26: "l",
0x2c: "z",
0x2d: "x",
0x2e: "c",
0x2f: "v",
0x30: "b",
0x31: "n",
0x32: "m",
}
KEYCODES is the map of hex found in the InputEvent.Code field, and its corresponding char (string) representation [source: Vojtech Pavlik (author of the Linux Input Drivers project), via linuxquestions.org user bricedebrignaisplage]
Functions ¶
func ScanForever ¶
ScanForever takes a linux input device string pointing to the scanner to read from, invokes the given function on the resulting barcode string when complete, or the errfn on error, then goes back to read/scan again
Types ¶
type InputEvent ¶
InputEvent is a Go implementation of the native linux device input_event struct, as described in the kernel documentation (https://www.kernel.org/doc/Documentation/input/input.txt), with a big assist from https://github.com/gvalkov/golang-evdev
Click to show internal directories.
Click to hide internal directories.