Skip to content

Commit

Permalink
Downgrade failed device acquisition to warning
Browse files Browse the repository at this point in the history
  • Loading branch information
rvaiya committed Feb 11, 2022
1 parent 88c8475 commit 1f0ff75
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SOCKET="/var/run/keyd.socket"
LOG_FILE="/var/log/keyd.log"
CONFIG_DIR="/etc/keyd"

VERSION=2.2.5-beta
VERSION=2.2.6-beta
GIT_HASH=$(shell git describe --no-match --always --abbrev=40 --dirty)

CFLAGS+=-DVERSION=\"$(VERSION)\" \
Expand Down
4 changes: 2 additions & 2 deletions src/evdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ uint32_t evdev_device_id(const char *devnode)
int fd = open(devnode, O_RDONLY);
if (fd < 0) {
perror("open");
exit(-1);
return 0;
}

if (ioctl(fd, EVIOCGID, &info) == -1) {
perror("ioctl");
exit(-1);
return 0;
}

close(fd);
Expand Down
10 changes: 8 additions & 2 deletions src/keyd.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ static int manage_keyboard(const char *devnode)
uint16_t vendor_id, product_id;

if (!(name = evdev_device_name(devnode))) {
fprintf(stderr, "Failed to obtain device info for %s, skipping..\n", devnode);
fprintf(stderr, "WARNING: Failed to obtain device info for %s, skipping..\n", devnode);
return -1;
}

Expand All @@ -242,6 +242,11 @@ static int manage_keyboard(const char *devnode)
}

id = evdev_device_id(devnode);
if (!id) {
fprintf(stderr, "WARNING: Failed to obtain device id for %s (%s)\n", devnode, name);
return -1;
}

vendor_id = id >> 16;
product_id = id & 0xFFFF;

Expand All @@ -253,8 +258,9 @@ static int manage_keyboard(const char *devnode)
}

if ((fd = open(devnode, O_RDONLY | O_NONBLOCK)) < 0) {
fprintf(stderr, "WARNING: Failed to open %s (%s)\n", devnode, name);
perror("open");
exit(1);
return -1;
}

/* Grab the keyboard. */
Expand Down

0 comments on commit 1f0ff75

Please sign in to comment.