I've tried the following:
And sure enough it prints:printf("ph: %u\n", EVIOCGRAB()); open my $dev, "<", "/dev/input/event7" or die $!; grab($dev->fileno, 1); __END__ __C__ #include <linux/input.h> void grab(int fd, int act) { printf("c: %u\n", EVIOCGRAB); int r = ioctl(fd, EVIOCGRAB, act); printf("grab: %d\n", r); }
ph: 1073759632
c: 1074021776
So for whatever reason there is a mismatch.
If I don't use the .ph-files but simply do ioctl $dev, 1074021776, 1;it works.
So it seems the problem lies with h2ph....
The way I generated the phs was I went to /usr/include and from there I issued "h2ph -a -d <some output-dir> linux/input.h"
Was that the wrong way to do it? And is it normal that I have to do that on my own (as I said I installed via perlbrew and there were no .phs generated then?
But at least I know how to do it now...
In reply to Re^3: How to do ioctl?
by morgon
in thread How to do ioctl?
by morgon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |