Reading i2c in cboot

i have a need to read from i2c in cboot. Right now I have a temp sensor hooked up to the 40pin header and it works fine

root@jetson-xavier-nx-devkit:~# i2cget -y 1 0x48 0x01 w
0x0100

I’d like to do the same in cboot and here is my test code

  struct tegrabl_i2c_dev *hi2c2 = 
    tegrabl_i2c_dev_open(TEGRABL_INSTANCE_I2C2, 0x48, 1, 2);
  if (!hi2c2) 
  { 
    pr_info("CBOOT invalid i2c2 handle\n");
  }
  else
  {
    pr_info("CBOOT valid i2c2 handle\n");
    err = tegrabl_i2c_dev_read(hi2c2, buf, 1, 1);
    if (err != TEGRABL_NO_ERROR)
      pr_info("CBOOT i2c2 error\n");
    else
      pr_info("CBOOT 0x%02x 0x%02x\n", buf[0], buf[1]);
  }
  pr_info("CBOOT done\n");

Unfortunately for some reason it seems to want to do a write, which I don’t understand, and the read also fails

[0004.301] I> CBOOT i2c ...
[0004.301] I> CBOOT valid i2c2 handle
[0004.302] E> I2C: slave not found in slaves.
[0004.302] E> I2C: Could not write 0 bytes to slave: 0x0048 with repeat start tr
ue.
[0004.303] E> I2C_DEV: Failed to send register address 0x00000001.
[0004.304] E> I2C_DEV: Could not read 1 registers of size 2 from slave 0x48 at 0
x00000001 via instance 1.
[0004.309] I> CBOOT i2c2 error
[0004.312] I> CBOOT done

Does anyone see anything obviously wrong with my code?

hello clutch12,

it seems you’ve got an error from tegrabl_i2c_read(), please confirm you’d power-on your temp device before having i2c access.
thanks

thanks