v01d commented on a change in pull request #2369: URL: https://github.com/apache/incubator-nuttx/pull/2369#discussion_r528934845
########## File path: include/nuttx/sensors/sensor.h ########## @@ -532,7 +541,7 @@ struct sensor_ops_s /************************************************************************** * Name: control * - * In this method, we allow user to set some special config for the sensor, + * In this method, user can set some special config for the sensor, Review comment: ```suggestion * With this method, the user can set some special config for the sensor, ``` ########## File path: include/nuttx/sensors/sensor.h ########## @@ -648,13 +657,14 @@ extern "C" * "upper half" Sensor device and registers that device so that can be used * by application code. * - * We will register the chararter device by node name format based on the + * You can register the chararter device by node name format based on the Review comment: ```suggestion * You can register the character device by node name format based on the ``` ########## File path: include/nuttx/sensors/sensor.h ########## @@ -667,22 +677,65 @@ extern "C" int sensor_register(FAR struct sensor_lowerhalf_s *dev, int devno); +/**************************************************************************** + * Name: sensor_custom_register + * + * Description: + * This function binds an instance of a "lower half" Sensor driver with the + * "upper half" Sensor device and registers that device so that can be used + * by application code. + * + * You can register the character device type by specific path and esize. + * This API corresponds to the sensor_custom_unregister. + * + * Input Parameters: + * dev - A pointer to an instance of lower half sensor driver. This + * instance is bound to the sensor driver and must persists as long + * as the driver persists. + * path - The user specifies path of device. ex: /dev/sensor/xxx. + * esize - The element size of intermediate circular buffer. + * + * Returned Value: + * OK if the driver was successfully register; A negated errno value is + * returned on any failure. + * + ****************************************************************************/ + +int sensor_custom_register(FAR struct sensor_lowerhalf_s *dev, + FAR const char *path, uint8_t esize); + /**************************************************************************** * Name: sensor_unregister * * Description: * This function unregister character node and release all resource about - * upper half driver. + * upper half driver. This API corresponds to the sensor_register. * * Input Parameters: * dev - A pointer to an instance of lower half sensor driver. This - * instance is bound to the sensor driver and must persist as long + * instance is bound to the sensor driver and must persists as long * as the driver persists. * devno - The user specifies which device of this type, from 0. ****************************************************************************/ void sensor_unregister(FAR struct sensor_lowerhalf_s *dev, int devno); +/**************************************************************************** + * Name: sensor_custom_unregister + * + * Description: + * This function unregister character node and release all resource about Review comment: ```suggestion * This function unregisters the device node and releases all resource from ``` ########## File path: include/nuttx/sensors/sensor.h ########## @@ -667,22 +677,65 @@ extern "C" int sensor_register(FAR struct sensor_lowerhalf_s *dev, int devno); +/**************************************************************************** + * Name: sensor_custom_register + * + * Description: + * This function binds an instance of a "lower half" Sensor driver with the + * "upper half" Sensor device and registers that device so that can be used + * by application code. + * + * You can register the character device type by specific path and esize. + * This API corresponds to the sensor_custom_unregister. + * + * Input Parameters: + * dev - A pointer to an instance of lower half sensor driver. This + * instance is bound to the sensor driver and must persists as long + * as the driver persists. + * path - The user specifies path of device. ex: /dev/sensor/xxx. + * esize - The element size of intermediate circular buffer. + * + * Returned Value: + * OK if the driver was successfully register; A negated errno value is + * returned on any failure. + * + ****************************************************************************/ + +int sensor_custom_register(FAR struct sensor_lowerhalf_s *dev, + FAR const char *path, uint8_t esize); + /**************************************************************************** * Name: sensor_unregister * * Description: * This function unregister character node and release all resource about - * upper half driver. + * upper half driver. This API corresponds to the sensor_register. * * Input Parameters: * dev - A pointer to an instance of lower half sensor driver. This - * instance is bound to the sensor driver and must persist as long + * instance is bound to the sensor driver and must persists as long Review comment: ```suggestion * instance is bound to the sensor driver and must persist as long ``` ########## File path: include/nuttx/sensors/sensor.h ########## @@ -648,13 +657,14 @@ extern "C" * "upper half" Sensor device and registers that device so that can be used * by application code. * - * We will register the chararter device by node name format based on the + * You can register the chararter device by node name format based on the * type of sensor. Multiple types of the same type are distinguished by - * numbers. eg: accel0, accel1 + * numbers. eg: accel0, accel1. This type of sensor must be less than + * SENSOR_TYPE_COUNT. This API corresponds to the sensor_unregister. * * Input Parameters: * dev - A pointer to an instance of lower half sensor driver. This - * instance is bound to the sensor driver and must persist as long + * instance is bound to the sensor driver and must persists as long Review comment: ```suggestion * instance is bound to the sensor driver and must persist as long ``` it was fine as it was ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org