int rc = 0;
unsigned int type;
- for (type = 0; type < EV_MAX; type++) {
+ for (type = 0; type < EV_CNT; type++) {
unsigned int code;
int max;
int uinput_bit;
goto out;
}
- for (code = 0; code < (unsigned int)max; code++) {
+ for (code = 0; code <= (unsigned int)max; code++) {
if (!libevdev_has_event_code(dev, type, code))
continue;
unsigned int prop;
int rc = 0;
- for (prop = 0; prop < INPUT_PROP_MAX; prop++) {
+ for (prop = 0; prop <= INPUT_PROP_MAX; prop++) {
if (!libevdev_has_property(dev, prop))
continue;
if (rc < 0)
goto out;
- for (i = 0; i < KEY_MAX; i++) {
+ for (i = 0; i < KEY_CNT; i++) {
int old, new;
old = bit_is_set(dev->key_values, i);
new = bit_is_set(keystate, i);
if (rc < 0)
goto out;
- for (i = 0; i < LED_MAX; i++) {
+ for (i = 0; i < LED_CNT; i++) {
int old, new;
old = bit_is_set(dev->led_values, i);
new = bit_is_set(ledstate, i);
int rc;
int i;
- for (i = ABS_X; i <= ABS_MAX; i++) {
+ for (i = ABS_X; i < ABS_CNT; i++) {
struct input_absinfo abs_info;
if (i >= ABS_MT_MIN && i <= ABS_MT_MAX)
int val[MAX_SLOTS];
} mt_state[ABS_MT_CNT];
- for (i = ABS_MT_MIN; i < ABS_MT_MAX; i++) {
+ for (i = ABS_MT_MIN; i <= ABS_MT_MAX; i++) {
int idx;
if (i == ABS_MT_SLOT)
continue;
init_event(dev, ev, EV_ABS, ABS_MT_SLOT, i);
}
- for (j = ABS_MT_MIN; j < ABS_MT_MAX; j++) {
+ for (j = ABS_MT_MIN; j <= ABS_MT_MAX; j++) {
int jdx = j - ABS_MT_MIN;
if (j == ABS_MT_SLOT)
/* write abs resolution now */
if (libevdev_has_event_type(d->d, EV_ABS)) {
int code;
- for (code = 0; code < ABS_MAX; code++) {
+ for (code = 0; code < ABS_CNT; code++) {
const struct input_absinfo *abs;
/* can't change slots */
ev.type = EV_REL;
ck_assert_int_eq(libevdev_is_event_type(&ev, EV_REL), 1);
- for (i = 0; i < EV_MAX; i++) {
+ for (i = 0; i < EV_CNT; i++) {
if (i == ev.type)
continue;
ck_assert_int_eq(libevdev_is_event_type(&ev, i), 0);
ev.code = REL_Y;
ck_assert_int_eq(libevdev_is_event_code(&ev, EV_REL, REL_Y), 1);
- for (i = 0; i < EV_MAX; i++) {
+ for (i = 0; i < EV_CNT; i++) {
int j;
if (i == ev.type || i == EV_SYN)
continue;
ck_assert_msg(rc == 0, "Failed to create device: %s", strerror(-rc));
- for (i = 0; i < INPUT_PROP_MAX; i++) {
+ for (i = 0; i < INPUT_PROP_CNT; i++) {
if (i == INPUT_PROP_DIRECT || i == INPUT_PROP_BUTTONPAD)
ck_assert_int_eq(libevdev_has_property(dev, i), 1);
else
rc = libevdev_new_from_fd(fd, &dev2);
ck_assert_int_eq(rc, 0);
- for (type = 0; type < EV_MAX; type++) {
+ for (type = 0; type < EV_CNT; type++) {
int max = libevdev_get_event_type_max(type);
if (max == -1)
continue;
rc = libevdev_new_from_fd(fd2, &dev2);
ck_assert_int_eq(rc, 0);
- for (type = 0; type < EV_MAX; type++) {
+ for (type = 0; type < EV_CNT; type++) {
int max = libevdev_get_event_type_max(type);
if (max == -1)
continue;