Unsolved How to know ioctl not detected chip address ?
-
i have tested instrument it give correct data on i2c.
But there is problem that when there is same slave address not found on bus it need to show -1 . but it always show fd = 0.
bIsBatteryCheckOn = false;
if((nI2CId= open("/dev/i2c-2", O_RDWR))<0) { qDebug() << "can not open I2C bus"; return bIsBatteryCheckOn; } else { if(nI2CId > 0) { int fd; if(GAUGE_DEVICE_ADDRESS != 0x55) fd = -1; else fd = (ioctl(nI2CId, I2C_SLAVE,0x55)); qDebug() << "-------------------------------fd"<<fd; if (fd < 0) { qDebug() << "Battery fuel gauge not found"; return bIsBatteryCheckOn; } else { bIsBatteryCheckOn= true; } } else { qDebug() << "Battery fuel gauge not found"; return bIsBatteryCheckOn; } } return bIsBatteryCheckOn;
-
@Qt-embedded-developer
I don't see anything Qt in your code..... -
@JonB this is related to embedded if know then let me know