added access i2c by I2C_SLAVE_FORCE in case access by I2C_SLAVE not authorized (copied from busybox drivers)

This commit is contained in:
Vincent-FK 2019-10-26 16:29:35 +08:00
parent 7df1c06849
commit 8a756e9008
2 changed files with 11 additions and 2 deletions

View File

@ -49,7 +49,11 @@ bool axp209_init(void) {
if (ioctl(fd_axp209, I2C_SLAVE, AXP209_I2C_ADDR) < 0) {
printf("In axp209_init - Failed to acquire bus access and/or talk to slave.\n");
// ERROR HANDLING; you can check errno to see what went wrong
return false;
if (ioctl(fd_axp209, I2C_SLAVE_FORCE, AXP209_I2C_ADDR) < 0) {
printf("In axp209_init - Failed to acquire FORCED bus access and/or talk to slave.\n");
// ERROR HANDLING; you can check errno to see what went wrong
return false;
}
}
// Enable only chosen interrupts (PEK short and long presses)

View File

@ -47,8 +47,13 @@ bool pcal6416a_init(void) {
}
if (ioctl(fd_i2c_expander,I2C_SLAVE,PCAL6416A_I2C_ADDR) < 0) {
printf("Failed to acquire bus access and/or talk to slave.\n");
printf("In pcal6416a_init - Failed to acquire bus access and/or talk to slave.\n");
// ERROR HANDLING; you can check errno to see what went wrong
if (ioctl(fd_i2c_expander, I2C_SLAVE_FORCE, PCAL6416A_I2C_ADDR) < 0) {
printf("In pcal6416a_init - Failed to acquire FORCED bus access and/or talk to slave.\n");
// ERROR HANDLING; you can check errno to see what went wrong
return false;
}
return false;
}