diff --git a/components/drivers/Kconfig b/components/drivers/Kconfig index 0a1db41bf9..8b9467008e 100755 --- a/components/drivers/Kconfig +++ b/components/drivers/Kconfig @@ -565,9 +565,9 @@ config RT_USING_SENSOR default n if RT_USING_SENSOR - config RT_USING_SENSOR_V2 - bool "Enable Sensor Framework v2" - default n + # config RT_USING_SENSOR_V2 + # bool "Enable Sensor Framework v2" + # default n config RT_USING_SENSOR_CMD bool "Using Sensor cmd" diff --git a/components/drivers/include/drivers/sensor.h b/components/drivers/include/drivers/sensor.h index e09d8d8c94..6c8b78e8a5 100644 --- a/components/drivers/include/drivers/sensor.h +++ b/components/drivers/include/drivers/sensor.h @@ -238,7 +238,7 @@ struct rt_sensor_data struct rt_sensor_ops { - rt_size_t (*fetch_data)(struct rt_sensor_device *sensor, void *buf, rt_size_t len); + rt_ssize_t (*fetch_data)(struct rt_sensor_device *sensor, void *buf, rt_size_t len); rt_err_t (*control)(struct rt_sensor_device *sensor, int cmd, void *arg); }; diff --git a/components/drivers/sensor/v1/sensor.c b/components/drivers/sensor/v1/sensor.c index 0bf5a62638..6da12f9342 100644 --- a/components/drivers/sensor/v1/sensor.c +++ b/components/drivers/sensor/v1/sensor.c @@ -127,7 +127,7 @@ static rt_err_t rt_sensor_irq_init(rt_sensor_t sensor) // local rt_sensor_ops -static rt_size_t local_fetch_data(struct rt_sensor_device *sensor, void *buf, rt_size_t len) +static rt_ssize_t local_fetch_data(struct rt_sensor_device *sensor, void *buf, rt_size_t len) { LOG_D("Undefined fetch_data"); return 0; @@ -135,7 +135,7 @@ static rt_size_t local_fetch_data(struct rt_sensor_device *sensor, void *buf, rt static rt_err_t local_control(struct rt_sensor_device *sensor, int cmd, void *arg) { LOG_D("Undefined control"); - return RT_ERROR; + return -RT_ERROR; } static struct rt_sensor_ops local_ops = {