Good point.

I've tried the following:

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); }
And sure enough it prints:

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.