Reading sensor data

While trying to read the data from the sensor register we are getting an error could you please help us

root@raspberrypi4:/var/rootdirs/home/root# luna-send -n 1 -f luna://com.webos.se
rvice.peripheralmanager/i2c/readRegByte '{"name":"I2C1","address":68, "reg":41}'
{
"errorCode": -995,
"returnValue": false,
"errorText": "kEPERM"
}

We have called this api from the sample native service

Hi @lm08
The following flow must be followed to read data from the i2c sensor.

  • Call i2c/list() api
  • Call i2c/open() api with specific name and address.

Example
luna-send -n 1 -f luna://com.webos.service.peripheralmanager/i2c/list '{}'
luna-send -n 1 -f luna://com.webos.service.peripheralmanager/i2c/open '{"name":"I2C1", "address":104}'
luna-send -n 1 -f luna://com.webos.service.peripheralmanager/i2c/readRegByte '{"name":"I2C1", "address":104, "reg":0}'