mirror of
https://xff.cz/git/pinephone-keyboard/
synced 2024-11-09 14:05:43 +01:00
Add some helpful messages
This commit is contained in:
parent
13bf8c43ca
commit
75b7cdaed2
1 changed files with 4 additions and 0 deletions
4
common.c
4
common.c
|
@ -230,6 +230,8 @@ static int pogo_i2c_open(void)
|
||||||
snprintf(path, sizeof path, "/dev/i2c-%d", i);
|
snprintf(path, sizeof path, "/dev/i2c-%d", i);
|
||||||
|
|
||||||
int fd = open(path, O_RDWR);
|
int fd = open(path, O_RDWR);
|
||||||
|
if (fd < 0 && errno == ENOENT)
|
||||||
|
printf("WARNING: The distribution you are using probably uses the kernel driver for pinephone keyboard, and is blocking access to the POGO I2C from userspace. You need to disable the driver to gain access.\n");
|
||||||
syscall_error(fd < 0, "open(%s) failed", path);
|
syscall_error(fd < 0, "open(%s) failed", path);
|
||||||
|
|
||||||
return fd;
|
return fd;
|
||||||
|
@ -361,6 +363,8 @@ static int gpio_setup_pogo_int(unsigned flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ioctl(fd, GPIO_V2_GET_LINE_IOCTL, &req);
|
ret = ioctl(fd, GPIO_V2_GET_LINE_IOCTL, &req);
|
||||||
|
if (ret < 0 && errno == EBUSY)
|
||||||
|
printf("WARNING: The distribution you are using probably uses the kernel driver for pinephone keyboard, and is blocking access to the POGO pins from userspace. Or something else in your userspace already claimed the POGO interrupt pin.\n");
|
||||||
syscall_error(ret < 0, "GPIO_V2_GET_LINE_IOCTL failed");
|
syscall_error(ret < 0, "GPIO_V2_GET_LINE_IOCTL failed");
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
Loading…
Reference in a new issue