Author Topic: hook and stop /dev/input/event  (Read 2461 times)


  • Guest
hook and stop /dev/input/event
« on: June 01, 2018, 10:14:30 am »
hello Thaddy,
hello FPC enthusiasts,

please a low level question:

I have a touchscreen linux embedded,
I don't have the source of the drivers,
I know that the driver maps over /dev/input/event4 -> and the events are forwarded/emulated to  -> /dev/mouse1
I need to be able to stop/inhibit the event4 event bubbling, so stopping the touchscreen, and reenable it without change the config of X, and without exit from the X session.
Do you know if a HOOK api or similar can be used to STOP/RESTART /dev/input/event4 globally, for the whole system/users?
Thank you.


  • Hero Member
  • *****
  • Posts: 10488
Re: hook and stop /dev/input/event
« Reply #1 on: June 01, 2018, 10:36:04 am »
Hi Roberto, only with sudo rights. It also depends on the system. Btw How are you doing? Haven't spoken to you in a long time.
Technically you should be able to start and stop the device w/o affecting the X session(s)
When you ask a question that is actually answered in the documentation, you are either lazy or a moron.


  • Guest
Re: hook and stop /dev/input/event
« Reply #2 on: June 01, 2018, 11:43:41 am »

well, I'm very busy, although this summer I'll try to give to this fpc community a little layer for a intel mem manager (parallel).

Look, using chmod, setting no permission at all to /dev/input/event doesn't stop it (probably if it is already open by another task, does nothing, affecting only the next open's)

Any idea? Maybe using mmap function?


  • Sr. Member
  • ****
  • Posts: 366
Re: hook and stop /dev/input/event
« Reply #3 on: June 08, 2018, 10:16:25 pm »
Hello, I think you can disable device in udev rules
Also I suppose you don't have to. Grab (open exclusively) device file with
Code: C  [Select][+][-]
  1. ioctl(fd, EVIOCGRAB, ...);
so events would be visible to your app only.
« Last Edit: June 08, 2018, 10:17:56 pm by sash »
Lazarus 2.0.10 FPC 3.2.0 x86_64-linux-gtk2 @ Ubuntu 20.04 XFCE


TinyPortal © 2005-2018