Search code examples
clinuxraspberry-pii2c

i2c read requires return key


When I try to read data out my i2c-bus, i need to press RETURN to execute the read. I dont want it to do that automatically.

Also it does not read data but that might a problem of the i2c slave at the other end.

I dont know why it wants to have this keypress..

char recievedbyte[1];
printf("rB 0\n");
int er = read(I2C_BUS, recievedbyte, 1);
printf("rB 1\n");

I would expect that it does read the bus automatically at the read()-call. Actually, I need to press RETURN between printf("rB 0\n"); and printf("rB 1\n");. when i do a read() with for example a textfile everything works fine...


Solution

  • I forgot to open() the I2C_BUS. Due to that I2C_BUS was 0 (zero) and it read lines from stdin (thats why the ENTER key was needed.)