On Sat, 10 Nov 2018 at 16:59, Diego Sueiro <firstname.lastname@example.org> wrote:
I'm developing a shell module for the sensor drivers and I want to
validate if the device name passed from the user is a sensor device.
I have the CONFIG_USERSAPCE=y.
After calling "dev = device_get_binding(argv)" I call the
"Z_SYSCALL_DRIVER_SENSOR(dev, sample_fetch)" and I get the following
thread 0x2000064c (1) does not have permission on sensor driver
syscall cmd_get_sensor failed check: access denied
1 - How do I grant permission to the running thread to access the
sensor driver object?
I managed to solve this by calling
"k_thread_access_grant(k_current_get(), dev, NULL)" before calling the
2 - Even having the CONFIG_USERSAPCE=y set when calling
"sensor_sample_fetch" it seems that it is calling the
"_impl_sensor_sample_fetch" directly instead of
"Z_SYSCALL_HANDLER(sensor_sample_fetch, dev)" defined in the
drivers/sensor/sensor_handlers.c file. How can I have the current
thread using the userspace syscalls?
This question remains open.