From afc511849dbd98a6f71ae8b9ca2d412b006a4596 Mon Sep 17 00:00:00 2001 From: Ingo Ruhnke Date: Thu, 19 Feb 2009 16:56:44 +0100 Subject: [PATCH] Some more stuff --- hal/xboxdrv_policy.fdi | 22 +++++++++ hal/xboxdrv_preprobe.fdi | 9 ++++ tools/evtestplus.cpp | 98 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 129 insertions(+) create mode 100644 hal/xboxdrv_policy.fdi create mode 100644 hal/xboxdrv_preprobe.fdi create mode 100644 tools/evtestplus.cpp diff --git a/hal/xboxdrv_policy.fdi b/hal/xboxdrv_policy.fdi new file mode 100644 index 0000000..f29b6f0 --- /dev/null +++ b/hal/xboxdrv_policy.fdi @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/hal/xboxdrv_preprobe.fdi b/hal/xboxdrv_preprobe.fdi new file mode 100644 index 0000000..c85e204 --- /dev/null +++ b/hal/xboxdrv_preprobe.fdi @@ -0,0 +1,9 @@ + + + + + + input.keys + + + diff --git a/tools/evtestplus.cpp b/tools/evtestplus.cpp new file mode 100644 index 0000000..fb7e8ab --- /dev/null +++ b/tools/evtestplus.cpp @@ -0,0 +1,98 @@ +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +void process_device(int fd) +{ + int version; + if (ioctl(fd, EVIOCGVERSION, &version) < 0) + { + perror("evtest: can't get version"); + exit(1); + } + + if (1) + { + char phys[1024]; + if (ioctl(fd, EVIOCGNAME(sizeof(phys)), &phys) < 0) + { + perror("evtest: can't get name"); + exit(1); + } + std::cout << "Name: " << phys << std::endl; + } + + if (1) + { + char phys[1024]; + if (ioctl(fd, EVIOCGPHYS(sizeof(phys)), &phys) < 0) + { + perror("evtest: can't get phys"); + exit(1); + } + std::cout << "Phys: " << phys << std::endl; + } + + if (0) + { + char phys[1024]; + if (ioctl(fd, EVIOCGUNIQ(sizeof(phys)), &phys) < 0) + { + perror("evtest: can't get uniq"); + exit(1); + } + std::cout << "Uniq: " << phys << std::endl; + } + + + + std::cout << "Version: " << (version >> 16) << "." << ((version >> 8) & 0xff) << "." << (version & 0xff) << std::endl; + + /* unsigned long bit[EV_MAX][NBITS(KEY_MAX)]; + ioctl(fd, EVIOCGID, id); + ioctl(fd, EVIOCGNAME(sizeof(name)), name); + memset(bit, 0, sizeof(bit)); + ioctl(fd, EVIOCGBIT(0, EV_MAX), bit[0]);*/ +} + +/** + evtestplus + --list List available devices + --test DEVICE Test device + --info DEVICE List properties of device + */ +int main(int argc, char** argv) +{ + if (argc != 2) + { + std::cout << "Usage: " << argv[0] << " DEVICE" << std::endl; + exit(EXIT_FAILURE); + } + else + { + const char* filename = argv[1]; + + int fd; + if ((fd = open(filename, O_RDONLY)) < 0) + { + perror(filename); + } + else + { + process_device(fd); + + close(fd); + } + } + + return 0; +} + +/* EOF */