Skip to content

Commit

Permalink
Show current values and ranges for EV_ABS type inputs
Browse files Browse the repository at this point in the history
When printing identification information about evdev device node,
current value is shown for supported ABS_XXX event types.

[evdev_trace] Show current values and ranges for EV_ABS type inputs
  • Loading branch information
spiiroin committed Oct 31, 2013
1 parent 7f081c6 commit 72b2c3f
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion evdev.c
Expand Up @@ -319,11 +319,30 @@ int evdev_identify_device(int fd)
const char *tag = evdev_get_event_code_name(etype, ecode);
int set = bit_is_set(bmap_stat, ecode);
int add = strlen(tag) + 1 + set;
char val[32] = "";


if( etype == EV_ABS )
{
struct input_absinfo info;
memset(&info, 0, sizeof info);

if( ioctl(fd, EVIOCGABS(ecode), &info) == -1 )
{
mce_log(LL_ERR, "EVIOCGABS(%s): %m", tag);
}
else
{
snprintf(val, sizeof val, "=%d [%d,%d]", info.value, info.minimum, info.maximum);
add += strlen(val);
}
}

if( len == 0 ) printf("\t");
else if( len+add > cols ) printf("\n\t"), len = 0;

len += add, printf(" %s%s", tag, set ? "*" : "");
len += add, printf(" %s%s%s", tag, set ? "*" : "", val);

}
}
if( len ) printf("\n");
Expand Down

0 comments on commit 72b2c3f

Please sign in to comment.