mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
input: add hack to allow abs-only devices
this is mainly for pandora nubs. git-svn-id: file:///home/notaz/opt/svn/PicoDrive@926 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
5199e6b549
commit
40a91e5cc8
2 changed files with 29 additions and 21 deletions
|
@ -49,6 +49,8 @@ typedef struct {
|
||||||
#define KEYBITS_BIT_CLEAR(x) (keybits[(x)/sizeof(keybits[0])/8] &= \
|
#define KEYBITS_BIT_CLEAR(x) (keybits[(x)/sizeof(keybits[0])/8] &= \
|
||||||
~(1 << ((x) & (sizeof(keybits[0])*8-1))))
|
~(1 << ((x) & (sizeof(keybits[0])*8-1))))
|
||||||
|
|
||||||
|
int in_evdev_allow_abs_only;
|
||||||
|
|
||||||
static const char * const in_evdev_prefix = "evdev:";
|
static const char * const in_evdev_prefix = "evdev:";
|
||||||
static const char * const in_evdev_keys[KEY_CNT] = {
|
static const char * const in_evdev_keys[KEY_CNT] = {
|
||||||
[0 ... KEY_MAX] = NULL,
|
[0 ... KEY_MAX] = NULL,
|
||||||
|
@ -151,7 +153,7 @@ static void in_evdev_probe(void)
|
||||||
for (i = 0;; i++)
|
for (i = 0;; i++)
|
||||||
{
|
{
|
||||||
int support = 0, count = 0;
|
int support = 0, count = 0;
|
||||||
int u, ret, fd, kc_first, kc_last;
|
int u, ret, fd, kc_first = KEY_MAX, kc_last = 0;
|
||||||
in_evdev_t *dev;
|
in_evdev_t *dev;
|
||||||
char name[64];
|
char name[64];
|
||||||
|
|
||||||
|
@ -170,30 +172,29 @@ static void in_evdev_probe(void)
|
||||||
goto skip;
|
goto skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(support & (1 << EV_KEY)))
|
if (support & (1 << EV_KEY)) {
|
||||||
goto skip;
|
ret = ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(keybits)), keybits);
|
||||||
|
if (ret == -1) {
|
||||||
|
printf("in_evdev: ioctl failed on %s\n", name);
|
||||||
|
goto skip;
|
||||||
|
}
|
||||||
|
|
||||||
ret = ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(keybits)), keybits);
|
/* check for interesting keys */
|
||||||
if (ret == -1) {
|
for (u = 0; u < KEY_CNT; u++) {
|
||||||
printf("in_evdev: ioctl failed on %s\n", name);
|
if (KEYBITS_BIT(u)) {
|
||||||
goto skip;
|
if (u < kc_first)
|
||||||
}
|
kc_first = u;
|
||||||
|
if (u > kc_last)
|
||||||
/* check for interesting keys */
|
kc_last = u;
|
||||||
kc_first = KEY_MAX;
|
if (u != KEY_POWER && u != KEY_SLEEP && u != BTN_TOUCH)
|
||||||
kc_last = 0;
|
count++;
|
||||||
for (u = 0; u < KEY_CNT; u++) {
|
if (u == BTN_TOUCH) /* we can't deal with ts currently */
|
||||||
if (KEYBITS_BIT(u)) {
|
goto skip;
|
||||||
if (u < kc_first)
|
}
|
||||||
kc_first = u;
|
|
||||||
if (u > kc_last)
|
|
||||||
kc_last = u;
|
|
||||||
if (u != KEY_POWER && u != KEY_SLEEP && u != BTN_TOUCH)
|
|
||||||
count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count == 0)
|
if (count == 0 && !in_evdev_allow_abs_only)
|
||||||
goto skip;
|
goto skip;
|
||||||
|
|
||||||
dev = calloc(1, sizeof(*dev));
|
dev = calloc(1, sizeof(*dev));
|
||||||
|
@ -237,6 +238,11 @@ static void in_evdev_probe(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
no_abs:
|
no_abs:
|
||||||
|
if (count == 0 && dev->abs_lzone == 0) {
|
||||||
|
free(dev);
|
||||||
|
goto skip;
|
||||||
|
}
|
||||||
|
|
||||||
dev->fd = fd;
|
dev->fd = fd;
|
||||||
dev->kc_first = kc_first;
|
dev->kc_first = kc_first;
|
||||||
dev->kc_last = kc_last;
|
dev->kc_last = kc_last;
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
|
|
||||||
|
extern int in_evdev_allow_abs_only;
|
||||||
|
|
||||||
void in_evdev_init(void *vdrv);
|
void in_evdev_init(void *vdrv);
|
||||||
int in_evdev_update(void *drv_data, const int *binds, int *result);
|
int in_evdev_update(void *drv_data, const int *binds, int *result);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue