diff --git a/drivers/sensors/sensor.c b/drivers/sensors/sensor.c index c1587c7f3f..c6001dbf9c 100644 --- a/drivers/sensors/sensor.c +++ b/drivers/sensors/sensor.c @@ -46,8 +46,7 @@ /* Device naming ************************************************************/ #define ROUNDUP(x, esize) ((x + (esize - 1)) / (esize)) * (esize) -#define DEVNAME_FMT "/dev/sensor/%s%s%d" -#define DEVNAME_MAX 64 +#define DEVNAME_FMT "/dev/sensor/sensor_%s%s%d" #define DEVNAME_UNCAL "_uncal" /**************************************************************************** @@ -880,11 +879,11 @@ static void sensor_notify_event(FAR void *priv) int sensor_register(FAR struct sensor_lowerhalf_s *lower, int devno) { - char path[DEVNAME_MAX]; + char path[PATH_MAX]; DEBUGASSERT(lower != NULL); - snprintf(path, DEVNAME_MAX, DEVNAME_FMT, + snprintf(path, PATH_MAX, DEVNAME_FMT, g_sensor_info[lower->type].name, lower->uncalibrated ? DEVNAME_UNCAL : "", devno); @@ -1007,9 +1006,9 @@ drv_err: void sensor_unregister(FAR struct sensor_lowerhalf_s *lower, int devno) { - char path[DEVNAME_MAX]; + char path[PATH_MAX]; - snprintf(path, DEVNAME_MAX, DEVNAME_FMT, + snprintf(path, PATH_MAX, DEVNAME_FMT, g_sensor_info[lower->type].name, lower->uncalibrated ? DEVNAME_UNCAL : "", devno);