Dmitry V. Levin
8c20d8926c
Some ioctl constants are defined to different values on those 32-bit architectures where structures containing a 64-bit field are aligned on a 8-byte boundary and have a size multiple of 8 bytes, and on other 32-bit architectures. * configure.ac: Check the size of a structure containing a 64-bit field. * linux/32/ioctls_inc.h: Rename to ... * linux/32/ioctls_inc_align32.h: ... this. * linux/32/ioctls_inc_align64.h: New file. * linux/32/ioctls_inc.h: Include either 32/ioctls_inc_align32.h or ioctls_inc_align64.h depending on SIZEOF_STRUCT_I64_I32. * Makefile.am (EXTRA_DIST): Add linux/32/ioctls_inc_align32.h and * linux/32/ioctls_inc_align64.h. * tests/ioctl.c (main): Test for VIDIOC_ENUMINPUT. * tests/ioctl.expected: Check VIDIOC_ENUMINPUT decoding. Reported-by: Philippe De Muyter <phdm@macqel.be>
56 lines
987 B
C
56 lines
987 B
C
#ifdef HAVE_CONFIG_H
|
|
# include "config.h"
|
|
#endif
|
|
#include <fcntl.h>
|
|
#include <stdint.h>
|
|
#include <unistd.h>
|
|
#include <termios.h>
|
|
#include <sys/ioctl.h>
|
|
|
|
#ifdef HAVE_LINUX_MMTIMER_H
|
|
# include <linux/mmtimer.h>
|
|
#endif
|
|
#ifdef HAVE_LINUX_HIDDEV_H
|
|
# include <linux/hiddev.h>
|
|
#endif
|
|
#ifdef HAVE_LINUX_INPUT_H
|
|
# include <linux/input.h>
|
|
#endif
|
|
|
|
#include <linux/videodev2.h>
|
|
|
|
#if defined MMTIMER_GETRES \
|
|
&& defined VIDIOC_ENUMINPUT \
|
|
&& defined HIDIOCGVERSION \
|
|
&& defined HIDIOCGPHYS \
|
|
&& defined EVIOCGBIT \
|
|
&& defined EV_KEY
|
|
|
|
int
|
|
main(void )
|
|
{
|
|
struct termios tty;
|
|
uint64_t data;
|
|
|
|
if (ioctl(-1, TCGETS, &tty) != -1 ||
|
|
ioctl(-1, MMTIMER_GETRES, &data) != -1 ||
|
|
ioctl(-1, VIDIOC_ENUMINPUT, 0) != -1 ||
|
|
ioctl(-1, HIDIOCGVERSION, &data) != -1 ||
|
|
ioctl(-1, HIDIOCGPHYS(8), &data) != -1 ||
|
|
ioctl(-1, EVIOCGBIT(EV_KEY, 8), &data) != -1 ||
|
|
ioctl(-1, _IOR(0xde, 0xad, data), &data) != -1)
|
|
return 77;
|
|
|
|
return 0;
|
|
}
|
|
|
|
#else
|
|
|
|
int
|
|
main(void )
|
|
{
|
|
return 77;
|
|
}
|
|
|
|
#endif
|