This example demonstrates use of a USB (Universal Serial Bus) driver in KasperskyOS using the libevdev library.
Example directory in the SDK
The code of the example and build scripts are available at the following path:
/opt/KasperskyOS-Community-Edition-<platform>-<version>/examples/barcode_scanner
List of programs
BarcodeScanner – application that interacts with a barcode scanner.DCM – system program that lets you dynamically create IPC channels.Input – driver that facilitates interaction with USB input devices (mouse, keyboard).USB – driver for managing all types of USB devices.When you build an example for the target hardware platform, platform-specific drivers are automatically included in the solution:
BSP is a hardware platform support package (Board Support Package). Provides cross-platform configuration of peripherals for the Radxa ROCK 3A.GPIO – GPIO support driver for the Radxa ROCK 3A.PinCtrl – low-level pin multiplexing (pinmux) configuration driver for the Radxa ROCK 3A.PCIE – PCIe bus driver for Raspberry Pi 4 B.Bcm2711MboxArmToVc – driver for working with the VideoCore (VC6) coprocessor via mailbox technology for Raspberry Pi 4 B.Initialization description
The solution initialization description file named init.yaml is generated during the solution build process based on the ./einit/src/init.yaml.in template. Macros in @INIT_*@ format contained in the template are automatically expanded in the resulting init.yaml file. For more details, refer to init.yaml.in template.
Security policy description
The security policy description files for a KasperskyOS-based solution are located in the ./einit/src directory.
The security.psl file contains description of the solution security policy. This file is a top-level file into which a portion of the solution security policy description in the form of the PSL file dynld.psl is included via the use declaration. (The declarations in the PSL files are annotated to explain the purpose of these declarations.) The dynld.psl file contains the part of the security policy description that is used when dynamically linking the solution components.
Operating scenario
In this example, the BarcodeScanner program uses the libevdev library to log keyboard events because most barcode scanners mimic the behavior of keyboard devices. The program waits for signals from the barcode scanner and prints the obtained data to stderr.
Building and running the example
The CMake system, which is included with KasperskyOS Community Edition, is used to build and run the example.
For the example to work correctly, you must connect a barcode scanner running in keyboard emulation mode (such as Zebra Symbol LS2208) to the USB port.
See Building and running examples section.
Page top