Some more stuff

This commit is contained in:
Ingo Ruhnke 2009-02-19 16:56:44 +01:00
parent 4029e44e74
commit afc511849d
3 changed files with 129 additions and 0 deletions

22
hal/xboxdrv_policy.fdi Normal file
View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
<device>
<match key="input.product" string="Microsoft X-Box 360 pad">
<remove key="input.x11_driver" />
</match>
<match key="input.product" string="Xbox Gamepad (userspace driver)">
<remove key="input.x11_driver" />
</match>
<match key="input.product" string="Sony PLAYSTATION(R)3 Controller">
<remove key="input.x11_driver" />
</match>
<match key="input.product" string="3Dconnexion SpaceNavigator">
<remove key="input.x11_driver" />
</match>
</device>
</deviceinfo>

9
hal/xboxdrv_preprobe.fdi Normal file
View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- SGML -*- -->
<deviceinfo version="0.2">
<device>
<match key="input.product" string="Xbox Gamepad (userspace driver) - Keyboard Emulation">
<addset key="info.capabilities" type="strlist">input.keys</addset>
</match>
</device>
</deviceinfo>

98
tools/evtestplus.cpp Normal file
View file

@ -0,0 +1,98 @@
#include <linux/input.h>
#include <sys/types.h>
#include <dirent.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
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 */