I have just built fresh kernel, dtb, u-boot and sgx as per RCN eewiki and I have also built Qt 5.6.2.
Everything is working correctly except for one problem which I do not understand and hope somebody could explain.
After installing sgx drivers and a reboot I have everything as per instructions:
lsmod | grep omaplfb
omaplfb 12356 0
tilcdc 26717 1 omaplfb
pvrsrvkm 157212 1 omaplfb
but my Qt Quick programs only work when run as root (sudo).
Looking at the sgx-startup script, /dev/pvrsvrkm should be set with 666 permissions, but after startup this is what I get:
ls -al /dev/pvrsrvkm
crw------- 1 root root 247, 0 Nov 27 20:54 /dev/pvrsrvkm
When I run:
sudo /etc/init.d/sgx-startup.sh stop
sudo /etc/init.d/sgx-startup.sh start
sgx: Starting PVR
/usr/local/bin/pvrsrvctl: SrvInit failed (already initialized?) (err=129)
ls -al /dev/pvrsrvkm
crw-rw-rw- 1 root root 247, 0 Nov 27 21:48 /dev/pvrsrvkm
Permissions are now correct for running program as normal user.
my programs run correctly with platform eglfs - which is what I want.
- Why does sgx-startup.sh not set the permissions correctly on boot and is there a way to solve this?
Thanks in advance
Oh let's patch that in the sgx-startup.sh script.. Probably after the
Send me a patch and i'll push it out...
Thank you Robert but I am not sure what you mean, would you kindly clarify.
As far as I understand the script, you are setting the permissions to 666 and you also start the service.
What I do not understand is how and why the permissions are not set when the script runs in the first place.
This is confusing me even more now - I added a “stat” on /dev/pvrsrvkm in the sgx-startup.sh, at the end before the “start” finishes and the permissions areset correctly -
debian@arm:~$ systemctl status sgx-startup
● sgx-startup.service - LSB: Start daemon at boot time
Loaded: loaded (/etc/init.d/sgx-startup.sh; generated; vendor preset: enabled
Active: active (exited) since Mon 2016-11-28 07:37:30 UTC; 1min 59s ago
Nov 28 07:37:27 arm systemd: Starting LSB: Start daemon at boot time…
Nov 28 07:37:27 arm sgx-startup.sh: sgx: Starting PVR
Nov 28 07:37:30 arm systemd: Started LSB: Start daemon at boot time.
Nov 28 07:37:30 arm sgx-startup.sh: 666 <<<<< just before the script completes
debian@arm:~$ ls -al /dev/pvrsrvkm
crw------- 1 root root 247, 0 Nov 28 07:37 /dev/pvrsrvkm
but still the permissions are 600 as can be seen above.
Any advice will be greatly appreciated.
After hours of reading all sorts and my brain blowing up, I think I might have found the reason for the problem. However, as a Linux noob, I am now stuck and hope one of our gurus will shed light on this.
This is where I am now:
- Copied the “start” section of sgx-startup.sh to a new file and started fiddling.
- Found that there appears to be some delay between modprobe pvrsrvkm , deleting the /dev/pvrsrvkm file and what I assume is the kernel module setting permissions on the file.
- When I moved the delete and mknod to after the /usr/local/bin/pvrsrvctl --start --no-module and added a sleep 1, the file permissions were set correctly.
Unfortunately this only work when I run the script manually, it doe not work with reboot (maybe sleep cannot be used)
So, I am still trying to find a solution, but I am running out of things to try
After spending some time with systemd and udec documentation and playing with udevadm I managed to find a solution.
No need to modify the sgx-startup.sh script, I just added a permission a sgx-permissions.rule to /etc/udev/rules.d with the folowing line - SUBSYSTEM==“pvr”, GROUP=“video”, MODE=“0660”.
I am not sure, maybe somebody can clarify - I think the chmod 666 /dev/pvrsrvkm has no effect since when modprobe is called, kernel and udev events will trigger and the default permissions for udev on devices is 600.