morgon has asked for the wisdom of the Perl Monks concerning the following question:
I would like to grab a Linux input-device via the EVIOCGRAB-ioctl call.
This is what's in my /usr/include/linux/input.h:
So I tried the naive approach first:#define EVIOCGRAB _IOW('E', 0x90, int) + /* Grab/Release device */
But that prints "Invalid argument".open my $dev, "<", "/dev/input/event14" or die $!; my $r = ioctl $dev, 0x90, 1; print "$!\n" unless defined $r;
So then I generated the ph-files (they were not generated when I installed perl via perlbrew) with h2ph and ran it like this:
But this again results in "Invalid argument".require "linux/input.ph"; open my $dev, "<", "/dev/input/event14" or die $!; my $r = ioctl $dev, EVIOCGRAB(), 1; print "$!\n" unless defined $r;
So how do I do this?
I am running 5.18.1 on Debian testing.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to do ioctl?
by zentara (Cardinal) on May 15, 2014 at 20:04 UTC | |
by morgon (Priest) on May 15, 2014 at 20:09 UTC | |
|
Re: How to do ioctl?
by morgon (Priest) on May 16, 2014 at 00:49 UTC | |
by Anonymous Monk on May 16, 2014 at 02:08 UTC | |
by morgon (Priest) on May 16, 2014 at 07:55 UTC | |
by Anonymous Monk on May 16, 2014 at 09:10 UTC |