Qt 5.11: Touch input inverted in my application - qt

I am deploying a Qt application to a beaglebone black that is running Stretch. I am attempting to use linuxfb with libinput to handle touch events. The touch screen input was inverted, so I set the Coordinate Transformation Matrix with a .conf file. The touch works correctly on the desktop, but is still inverted in my Qt app.
Here are my environment settings for Qt:
QT_LOGGING_RULES=*=true
QT_QPA_EGLFS_HEIGHT=600
QT_QPA_EGLFS_PHYSICAL_HEIGHT=92
QT_QPA_EGLFS_PHYSICAL_WIDTH=155
QT_QPA_EGLFS_WIDTH=1024
QT_QPA_FB_DRM=1
QT_QPA_PLATFORM=linuxfb
With the above settings, the app renders correctly and is responsive, but the touch input is inverted.
Here is the Qt console output when running with these parameters:
11:24:44: Checking available ports...
11:24:44: Found 101 free ports.
11:24:44: Starting /usr/bin/gdbserver...
11:24:44: Debugging starts
Listening on port 10000
Remote debugging from host 192.168.13.104
Process /home/debian/test created; pid = 1473
qt.qpa.eglfs.kms: Using backend-provided DRM device /dev/dri/card0
qt.qpa.fb: DRM device /dev/dri/card0 opened
qt.qpa.eglfs.kms: Found 1 planes
qt.qpa.eglfs.kms: plane 0: id = 18 countFormats = 2 possibleCrtcs = 0x1 supported formats = XR24 AR24
qt.qpa.eglfs.kms: property 0: id = 5 name = 'type'
qt.qpa.eglfs.kms: type is ENUM, value is 1, possible values are:
qt.qpa.eglfs.kms: enum 0: Overlay - 0
qt.qpa.eglfs.kms: enum 1: Primary - 1
qt.qpa.eglfs.kms: enum 2: Cursor - 2
qt.qpa.eglfs.kms: "LVDS1" mode count: 1 crtc index: 0 crtc id: 19
qt.qpa.eglfs.kms: mode 0 1024 x 600 # 45 hz
qt.qpa.eglfs.kms: Selected mode 0 : 1024 x 600 # 45 hz for output "LVDS1"
qt.qpa.eglfs.kms: Physical size is QSizeF(155, 92) mm for output "LVDS1"
qt.qpa.eglfs.kms: Output LVDS1 can use 1 planes: 18
qt.qpa.fb: Got a new output: LVDS1
qt.qpa.eglfs.kms: Sorted screen list: QVector()
qt.qpa.fb: Got a dumb buffer for size 1024x600 and bpp 32: handle 1, pitch 4096, size 2457600
qt.qpa.fb: FB is 25 (DRM format 0x34325258), mapped at 0xb364d000
qt.qpa.fb: Got a dumb buffer for size 1024x600 and bpp 32: handle 2, pitch 4096, size 2457600
qt.qpa.fb: FB is 26 (DRM format 0x34325258), mapped at 0xb33f5000
qt.qpa.fb: QRect(0,0 1024x600) QSizeF(155, 92) 24 4
qt.qpa.input: libinput: input device 'gpio_keys', /dev/input/event2 is tagged by udev as: Keyboard
qt.qpa.input: libinput: input device 'gpio_keys', /dev/input/event2 is a keyboard
qt.qpa.input: libinput: input device 'tps65217_pwr_but', /dev/input/event0 is tagged by udev as: Keyboard
qt.qpa.input: libinput: input device 'tps65217_pwr_but', /dev/input/event0 is a keyboard
qt.qpa.input: libinput: input device 'DELL Dell USB Entry Keyboard', /dev/input/event3 is tagged by udev as: Keyboard
qt.qpa.input: libinput: input device 'DELL Dell USB Entry Keyboard', /dev/input/event3 is a keyboard
qt.qpa.input: libinput: input device 'SIGMACHIP Usb Mouse', /dev/input/event4 is tagged by udev as: Mouse
qt.qpa.input: libinput: input device 'SIGMACHIP Usb Mouse', /dev/input/event4 is a pointer caps
qt.qpa.input: libinput: input device 'EP0790M09', /dev/input/event1 is tagged by udev as: Touchscreen
qt.qpa.input: libinput: input device 'EP0790M09', /dev/input/event1 is a touch device
qt.qpa.input: Using xkbcommon for key mapping
I have also tried it with these environment settings:
DISPLAY=:0
QT_LOGGING_RULES=*=true
QT_QPA_EGLFS_HEIGHT=600
QT_QPA_EGLFS_INTEGRATION=eglfs_x11
QT_QPA_EGLFS_PHYSICAL_HEIGHT=92
QT_QPA_EGLFS_PHYSICAL_WIDTH=155
QT_QPA_EGLFS_WIDTH=1024
XAUTHORITY=/home/debian/.Xauthority
Using this configuration, I can only run the app if the beaglebone has a bare xsession running. The app renders correctly, but is laggy, and the touch is still inverted.
Here is the Qt console output for this configuration:
11:26:52: Checking available ports...
11:26:52: Found 101 free ports.
11:26:52: Starting /usr/bin/gdbserver...
11:26:52: Debugging starts
Listening on port 10001
Remote debugging from host 192.168.13.104
Process /home/debian/test created; pid = 1893
qt.qpa.egldeviceintegration: EGL device integration plugin keys: ("eglfs_emu", "eglfs_kms_egldevice", "eglfs_kms", "eglfs_x11")
qt.qpa.egldeviceintegration: EGL device integration plugin keys (sorted): ("eglfs_x11", "eglfs_emu", "eglfs_kms_egldevice", "eglfs_kms")
qt.qpa.egldeviceintegration: Trying to load device EGL integration "eglfs_x11"
qt.qpa.egldeviceintegration: Using EGL device integration "eglfs_x11"
libEGL warning: DRI2: failed to authenticate
qt.qpa.input: libinput: input device 'gpio_keys', /dev/input/event2 is tagged by udev as: Keyboard
qt.qpa.input: libinput: input device 'gpio_keys', /dev/input/event2 is a keyboard
qt.qpa.input: libinput: input device 'tps65217_pwr_but', /dev/input/event0 is tagged by udev as: Keyboard
qt.qpa.input: libinput: input device 'tps65217_pwr_but', /dev/input/event0 is a keyboard
qt.qpa.input: libinput: input device 'DELL Dell USB Entry Keyboard', /dev/input/event3 is tagged by udev as: Keyboard
qt.qpa.input: libinput: input device 'DELL Dell USB Entry Keyboard', /dev/input/event3 is a keyboard
qt.qpa.input: libinput: input device 'SIGMACHIP Usb Mouse', /dev/input/event4 is tagged by udev as: Mouse
qt.qpa.input: libinput: input device 'SIGMACHIP Usb Mouse', /dev/input/event4 is a pointer caps
qt.qpa.input: libinput: input device 'EP0790M09', /dev/input/event1 is tagged by udev as: Touchscreen
qt.qpa.input: libinput: input device 'EP0790M09', /dev/input/event1 is a touch device
qt.qpa.input: Using xkbcommon for key mapping
Running on a software rasterizer (LLVMpipe), expect limited performance.
qt.opengl.diskcache: GL_ARB_get_program_binary support = 1
qt.opengl.diskcache: Supported binary format count = 0
qt.opengl.diskcache: Shader cache supported = 0
Here is my .conf that is applied to the touchscreen:
Section "InputClass"
Identifier "calibration"
MatchProduct "EP0790M09"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
Option "TransformationMatrix" "-1.0 0.0 1.0 0.0 -1.0 1.0 0.0 0.0 1.0"
EndSection
Here is what xinput lists for the device properties:
Device 'EP0790M09':
Device Enabled (115): 1
Coordinate Transformation Matrix (116): -1.000000, 0.000000, 1.000000, 0.000000, -1.000000, 1.000000, 0.000000, 0.000000, 1.000000
libinput Calibration Matrix (270): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Calibration Matrix Default (271): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Send Events Modes Available (272): 1, 0
libinput Send Events Mode Enabled (273): 0, 0
libinput Send Events Mode Enabled Default (274): 0, 0
Device Node (236): "/dev/input/event1"
Device Product ID (235): 0, 0
Version info:
$lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 9.5 (stretch)
Release: 9.5
Codename: stretch
$ uname -a
Linux beaglebone 4.4.9 #2 SMP Thu Mar 22 13:59:11 CDT 2018 armv7l GNU/Linux
How can I invert the touch input inside my qt app?

The solution ended up being to use evdev touch in my app and use QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS to fix the input events.
My final run environment ended up being:
QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS=/dev/input/event1:rotate=180
QT_QPA_FB_NO_LIBINPUT=1
QT_QPA_PLATFORM=linuxfb

Related

Why eglswapinterval cannot disable v-sync?

My environment:
qt.scenegraph.general: QSG: basic render loop
qt.scenegraph.general: Using sg animation driver
qt.scenegraph.general: texture atlas dimensions: 2048x2048
qt.scenegraph.general: R/G/B/A Buffers: 8 8 8 0
qt.scenegraph.general: Depth Buffer: 24
qt.scenegraph.general: Stencil Buffer: 8
qt.scenegraph.general: Samples: 0
qt.scenegraph.general: GL_VENDOR: Imagination Technologies
qt.scenegraph.general: GL_RENDERER: PowerVR Rogue GE7800
qt.scenegraph.general: GL_VERSION: OpenGL ES 3.2 build 1.10#5187610
I am running a Hello world QML program and config as above.
QT_QPA_EGLFS_SWAPINTERVAL=0
QT_QPA_UPDATE_IDLE_TIME=0
QSG_RENDER_LOOP=basic
I test the QT_QPA_EGLFS_SWAPINTERVAL via PVRTrace https://www.imgtec.com/developers/powervr-sdk-tools/pvrtrace/
it shows the eglSwapInterval did set properly as above.
But the problem is the program stuck on 60FPS.
Why I cannot disable the V-Sync.
The short answer is that vsync behavior is entirely platform dependent. In reality eglSwapInterval() is actually just hint and it is implementation-defined whether it actually does anything at all. On most platforms it doesn't - e.g. on Android you can neither disable it nor fix FPS at 30. Suggest raising this with the platform provider.

Get free space left on target from arm-none-eabi-size

I want to calculate space left on my embedded target.
The Arduino IDE shows this in the output window:
Sketch uses 9544 bytes (3%) of program storage space. Maximum is 262144 bytes.
avr-size has -C option that shows "xx% left":
$ avr-size -C --mcu=atmega32u4 build/myproject.hex
AVR Memory Usage
----------------
Device: atmega32u4
Program: 8392 bytes (25.6% Full)
(.text + .data + .bootloader)
Data: 2196 bytes (85.8% Full)
(.data + .bss + .noinit)
However, I'm actually writing a CMake file to develop code for an Arduino board with an Arm Cortex M0 CPU, so I use arm-none-eabi-size, which shows the code size like this:
[100%] Built target hex
text data bss dec hex filename
8184 208 1988 10380 288c build/myproject
[100%] Built target size
*** Finished ***
Is there a way to calculate the program and data space left on the device? Or do I need to regex the output and calculate percent of a hard-coded value?
If you are using arm-none-eabi toolchain, you can add linker option -Wl,--print-memory-usage which prints RAM and Flash usage in percentage. Output looks like this:
Memory region Used Size Region Size %age Used
RAM: 8968 B 20 KB 43.79%
FLASH: 34604 B 128 KB 26.40%
I am using make file generated by CubeMX, to enable this print I added the option at the end of LDFLAGS line. For CMake this thread might be useful.

OpenCL beignet 1.3.1-2 fails with the error: drm_intel_gem_bo_context_exec() failed: No space left on device

I recently have restarted to program in OpenCL and faced a beignet related error when I run the program like below:
/*
Hello World for OpenCL
How to compile:
: c++ hello.cpp -lOpenCL
*/
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
#include <CL/cl.h>
#include <string.h>
int main() {
cl_int ret;
cl_platform_id plat_id = NULL;
cl_uint ret_num_platforms;
cl_device_id dev_id = NULL;
cl_uint ret_num_devices;
cl_context context = NULL;
cl_command_queue queue = NULL;
cl_program program = NULL;
char const * kernel_cl=R"(
kernel void hello() {
printf("Hello! OpenCL!");
}
)";
size_t kernel_cl_len = strlen(kernel_cl);
ret = clGetPlatformIDs(1, &plat_id, &ret_num_platforms);
ret = clGetDeviceIDs(plat_id, CL_DEVICE_TYPE_ALL,
1, &dev_id, &ret_num_devices);
context = clCreateContext(NULL, 1, &dev_id, NULL, NULL, &ret);
queue = clCreateCommandQueue(context, dev_id, 0, &ret);
program = clCreateProgramWithSource(context, 1,
(const char**)&kernel_cl,
(const size_t*)&kernel_cl_len,
&ret);
ret = clBuildProgram(program, 1, &dev_id, NULL, NULL, NULL);
cl_kernel ker_hello;
ker_hello = clCreateKernel(program, "hello", &ret);
cl_event event;
ret = clEnqueueTask(queue, ker_hello, 0, NULL, &event);
ret = clWaitForEvents(1, &event);
ret = clReleaseKernel(ker_hello);
ret = clReleaseProgram(program);
ret = clReleaseCommandQueue(queue);
ret = clReleaseContext(context);
}
It fails with the error, drm_intel_gem_bo_context_exec() failed: No space left on device.
My compile environment is gcc 7.1.1. and OpenCl Platform is beignet 1.3.1-2 which is installed from Arch GNU+Linux packages. The using OpenCL device is Intel HD Graphics IvyBridge M GT2. And Here's my clinfo result:
Number of platforms 1
Platform Name Intel Gen OCL Driver
Platform Vendor Intel
Platform Version OpenCL 2.0 beignet 1.3
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_3d_image_writes cl_khr_image2d_from_buffer cl_khr_depth_images cl_khr_icd cl_intel_accelerator cl_intel_subgroups cl_intel_subgroups_short cl_khr_gl_sharing
Platform Extensions function suffix Intel
drm_intel_gem_bo_context_exec() failed: No space left on device
Platform Name Intel Gen OCL Driver
Number of devices 1
Device Name Intel(R) HD Graphics IvyBridge M GT2
Device Vendor Intel
Device Vendor ID 0x8086
Device Version OpenCL 1.2 beignet 1.3
Driver Version 1.3
Device OpenCL C Version OpenCL C 1.2 beignet 1.3
Device Type GPU
Device Available Yes
Device Profile FULL_PROFILE
Max compute units 16
Max clock frequency 1000MHz
Device Partition (core)
Max number of sub-devices 1
Supported partition types None, None, None
Max work item dimensions 3
Max work item sizes 512x512x512
Max work group size 512
Compiler Available Yes
Linker Available Yes
Preferred work group size multiple 16
Preferred / native vector sizes
char 16 / 8
short 8 / 8
int 4 / 4
long 2 / 2
half 0 / 8 (n/a)
float 4 / 4
double 0 / 2 (n/a)
Half-precision Floating-point support (n/a)
Single-precision Floating-point support (core)
Denormals No
Infinity and NANs Yes
Round to nearest Yes
Round to zero No
Round to infinity No
IEEE754-2008 fused multiply-add No
Support is emulated in software No
Correctly-rounded divide and sqrt operations No
Double-precision Floating-point support (n/a)
Address bits 32, Little-Endian
Global memory size 2147483648 (2GiB)
Error Correction support No
Max memory allocation 1610612736 (1.5GiB)
Unified memory for Host and Device Yes
Minimum alignment for any data type 128 bytes
Alignment of base address 1024 bits (128 bytes)
Global Memory cache type Read/Write
Global Memory cache size 8192 (8KiB)
Global Memory cache line 64 bytes
Image support Yes
Max number of samplers per kernel 16
Max size for 1D images from buffer 65536 pixels
Max 1D or 2D image array size 2048 images
Base address alignment for 2D image buffers 4096 bytes
Pitch alignment for 2D image buffers 1 bytes
Max 2D image size 8192x8192 pixels
Max 3D image size 8192x8192x2048 pixels
Max number of read image args 128
Max number of write image args 8
Local memory type Local
Local memory size 65536 (64KiB)
Max constant buffer size 134217728 (128MiB)
Max number of constant args 8
Max size of kernel argument 1024
Queue properties
Out-of-order execution No
Profiling Yes
Prefer user sync for interop Yes
Profiling timer resolution 80ns
Execution capabilities
Run OpenCL kernels Yes
Run native kernels Yes
printf() buffer size 1048576 (1024KiB)
Built-in kernels __cl_copy_region_align4;__cl_copy_region_align16;__cl_cpy_region_unalign_same_offset;__cl_copy_region_unalign_dst_offset;__cl_copy_region_unalign_src_offset;__cl_copy_buffer_rect;__cl_copy_image_1d_to_1d;__cl_copy_image_2d_to_2d;__cl_copy_image_3d_to_2d;__cl_copy_image_2d_to_3d;__cl_copy_image_3d_to_3d;__cl_copy_image_2d_to_buffer;__cl_copy_image_3d_to_buffer;__cl_copy_buffer_to_image_2d;__cl_copy_buffer_to_image_3d;__cl_fill_region_unalign;__cl_fill_region_align2;__cl_fill_region_align4;__cl_fill_region_align8_2;__cl_fill_region_align8_4;__cl_fill_region_align8_8;__cl_fill_region_align8_16;__cl_fill_region_align128;__cl_fill_image_1d;__cl_fill_image_1d_array;__cl_fill_image_2d;__cl_fill_image_2d_array;__cl_fill_image_3d;block_motion_estimate_intel;
Device Extensions cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_3d_image_writes cl_khr_image2d_from_buffer cl_khr_depth_images cl_khr_icd cl_intel_accelerator cl_intel_subgroups cl_intel_subgroups_short cl_khr_gl_sharing cl_intel_motion_estimation
NULL platform behavior
clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) Intel Gen OCL Driver
clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...) Success [Intel]
clCreateContext(NULL, ...) [default] Success [Intel]
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) Success (1)
Platform Name Intel Gen OCL Driver
Device Name Intel(R) HD Graphics IvyBridge M GT2
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL) Success (1)
Platform Name Intel Gen OCL Driver
Device Name Intel(R) HD Graphics IvyBridge M GT2
ICD loader properties
ICD loader Name OpenCL ICD Loader
ICD loader Vendor OCL Icd free software
ICD loader Version 2.2.11
ICD loader Profile OpenCL 2.1

opencl does not detect CPU

Finally I installed new nvidia-drivers and the AMD SDK APP v3.0 but its only detecting my GPU.
I installed the AMD SDK app in my home-directory.
Do you know what possibly gone wrong?
CPU: model name : Intel(R) Core(TM) i7-2640M CPU # 2.80GHz
clinfo:
Number of platforms: 1
Platform Profile: FULL_PROFILE
Platform Version: OpenCL 1.2 CUDA 8.0.13
Platform Name: NVIDIA CUDA
Platform Vendor: NVIDIA Corporation
Platform Extensions: cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_fp64 cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_nv_copy_opts
Platform Name: NVIDIA CUDA
Number of devices: 1
Device Type: CL_DEVICE_TYPE_GPU
Vendor ID: 10deh
Max compute units: 1
Max work items dimensions: 3
Max work items[0]: 1024
Max work items[1]: 1024
Max work items[2]: 64
Max work group size: 1024
Preferred vector width char: 1
Preferred vector width short: 1
Preferred vector width int: 1
Preferred vector width long: 1
Preferred vector width float: 1
Preferred vector width double: 1
Native vector width char: 1
Native vector width short: 1
Native vector width int: 1
Native vector width long: 1
Native vector width float: 1
Native vector width double: 1
Max clock frequency: 1480Mhz
Address bits: 32
Max memory allocation: 268353536
Image support: Yes
Max number of images read arguments: 128
Max number of images write arguments: 8
Max image 2D width: 16384
Max image 2D height: 16384
Max image 3D width: 2048
Max image 3D height: 2048
Max image 3D depth: 2048
Max samplers within kernel: 16
Max size of kernel argument: 4352
Alignment (bits) of base address: 4096
Minimum alignment (bytes) for any datatype: 128
Single precision floating point capability
Denorms: Yes
Quiet NaNs: Yes
Round to nearest even: Yes
Round to zero: Yes
Round to +ve and infinity: Yes
IEEE754-2008 fused multiply-add: Yes
Cache type: Read/Write
Cache line size: 128
Cache size: 16384
Global memory size: 1073414144
Constant buffer size: 65536
Max number of constant args: 9
Local memory type: Scratchpad
Local memory size: 49152
Kernel Preferred work group size multiple: 32
Error correction support: 0
Unified memory for Host and Device: 0
Profiling timer resolution: 1000
Device endianess: Little
Available: Yes
Compiler available: Yes
Execution capabilities:
Execute OpenCL kernels: Yes
Execute native function: No
Queue on Host properties:
Out-of-Order: Yes
Profiling : Yes
Platform ID: 0x8d3ee00
Name: GeForce GT 520M
Vendor: NVIDIA Corporation
Device OpenCL C version: OpenCL C 1.1
Driver version: 361.28
Profile: FULL_PROFILE
Version: OpenCL 1.1 CUDA
Extensions: cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_fp64 cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_nv_copy_opts

Triggering udev rule for particular keyboard

I need to write a udev rule for a particular keyboard which does not seem to have any unique attribute against which to match.
The lines below are the output of udevadm monitor upon insertion of the device. Is there something here I could use to uniquely identify this keyboard?
KERNEL[58443.215701] add /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2 (usb)
KERNEL[58443.218536] add /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0 (usb)
KERNEL[58443.218662] add /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/0003:04B3:3025.0005 (hid)
KERNEL[58443.221610] add /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/input/input15 (input)
KERNEL[58443.221669] add /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/input/input15/event4 (input)
KERNEL[58443.221868] add /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/0003:04B3:3025.0005/hidraw/hidraw0
UDEV [58443.236718] add /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2 (usb)
UDEV [58443.238026] add /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0 (usb)
UDEV [58443.239532] add /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/0003:04B3:3025.0005 (hid)
UDEV [58443.240670] add /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/0003:04B3:3025.0005/hidraw/hidraw0
UDEV [58443.288767] add /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/input/input15 (input)
UDEV [58443.319799] add /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/input/input15/event4 (input)
Edit:
Below are the lines from plugging the keyboard into a different usb port. As far as I can tell, it seems that there is no information that remains constant.
KERNEL[59428.187673] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1 (usb)
KERNEL[59428.190323] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0 (usb)
KERNEL[59428.190494] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/0003:04B3:3025.0006 (hid)
KERNEL[59428.193088] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/input/input16 (input)
KERNEL[59428.193266] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/input/input16/event4 (input)
KERNEL[59428.193426] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/0003:04B3:3025.0006/hidraw/hidraw0
UDEV [59428.300690] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1 (usb)
UDEV [59428.301790] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0 (usb)
UDEV [59428.302553] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/0003:04B3:3025.0006 (hid)
UDEV [59428.303130] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/0003:04B3:3025.0006/hidraw/hidraw0
UDEV [59428.319082] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/input/input16 (input)
UDEV [59428.321444] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/input/input16/event4 (input)
Edit: Using lsusb -v, I was able to find the idVendor and idProduct.
Bus 002 Device 009: ID 04b3:3025 IBM Corp.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x04b3 IBM Corp.
idProduct 0x3025
bcdDevice 1.09
iManufacturer 1 LITE-ON Technology
iProduct 2 USB NetVista Full Width Keyboard.
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 34
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 4 HID Keyboard
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 70mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 1 Keyboard
iInterface 5 EP1 Interrupt
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 65
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 24
Device Status: 0x0000
(Bus Powered)
So I have created the following udev rule:
SUBSYSTEM=="usb", ATTR{idVendor}=="0x04b3", ATTRS{idProduct}=="0x3025", RUN+="/home/myuser/bin/udev_jap.sh"
However, nothing is triggered so far. And strangely, the idVendor and idProduct information doesn't show up on udevadm monitor. Does this mean udev can't match against these attributes?
This is an old question, anyway:
You have to remove 0x hexadecimal prefix.
Note that ATTR and ATTRS are different, but for your case both should work.
Your script udev_jap.sh should start with shebang #!/bin/sh or run shell itself:
RUN+="/bin/sh /home/myuser/bin/udev_jap.sh"
Try this:
SUBSYSTEM=="usb", ATTR{idVendor}=="04b3", ATTR{idProduct}=="3025", RUN+="/home/myuser/bin/udev_jap.sh"

Resources