HID Mouse Position Linux Kernel Source Code

I want to work with HID Mouse events.

Which Linux kernel module should I work with to handle events? Then pass these events (x, y) to the input subsystem.

Modules can be

  • hid-core.c / usbhid

  • hid-quirks.c or

  • hiddev.c

I have the kernel source code and I can add it to the kernel.

Exit: lsmod | grep hid

myusbhid ------------------ 35712 ---------- 0

hid ------------------ 50560 ----------- 1 myusbhid

usbcore ------------------- 149488 ----------- 4 myusbhid, uhci_hcd, ehci_hcd

The reason that I am trying to change the coordinates of the HID mouse means that I want my cursor location to move at my mention position, and not as the default mouse location.

thanks

+1
source share
1 answer

hid.c was available in versions 2.4.9 and earlier, but now it is split into several files

HID keyboard / mouse / joystick events can be tracked / changed at the kernel level Get the kernel source file of your kernel version.

http://lxr.linux.no/linux+v2.6.27.14/drivers/

for the hid (hid.o) linux kernel module, rename the source files as

my-hiddraw.c * my-hid-core.c * my-hid-input.c * my-hid-input-quirk.c 

Makefile:

obj-m: = myhid.o

myhid-objs: = my-hiddraw.o my-hid-core.o my-hid-input.o my-hid-input-quirk.o

KDIR: = / lib / modules / $ (shell uname -r) / build

PWD: = $ (shell pwd)

default:

$ (MAKE) -C $ (KDIR) M = $ (PWD) modules

Add a module in the kernel as

$ sudo rmmod usbhid; sudo rmmod hid; sudo insmod myhid.ko; sudo insmod / [MODULE PATH] /usbhid.ko

****************************************.... **************************

Hid-input.c is responsible for sending events for input of the subsystem /hiddev.c

See the Linux documentation hiddev.txt and input.txt for help.

In hid-input.c hidinput _ hid _ event () is responsible for sending events

  • void hidinput _ hid _ event (struct hid _ device * hid, struct hid _ field * field, structure hid_usage * use, value __s32)

Use at the end of the function before the input _ event (input, use-> type, use-> code, value);

printk ("\ n hidinput _ hid _ event% i,% i,% i", use-> type, usage-> code, value);

Get / Change these values โ€‹โ€‹and pass them to the input _ events ()

************************************************** **************************

Hi

mmadni [AT] Gmail [dot] com

+1
source

All Articles