Add function to find X.org VT
|Status:||Closed||Start date:||10 Mar 2020|
|Target version:||PiBox - 2.0 - Harkonnen|
|Severity:||01 - Critical|
This can be done with this command:
ps -l | grep "X :0" | grep -v grep | tr -s " "| cut -f7 -d" "
This doesn't appear to fail under ash (Busybox shell) if the first grep doesn't find anything. We can use this to find the correct "vtsrc" for any app.
RM #751: Add piboxGetVTNum() to find current and next VT's for vt-switching when launching and killing omxplayer.
RM #751: Add a string version and an int version of functions for retrieving a VT number. The former works with any named process but must make a shell call to get the VT. The latter works only for the current process and uses an ioctl.
- Status changed from New to In Progress
- % Done changed from 0 to 10
Programmatic option (maybe): https://www.helpnetsecurity.com/2002/04/08/console-ioctls-under-linux/
Example code: https://img2.helpnetsecurity.com/dl/articles/txt/console18.txt
Look for VT_GETSTATE.
Also see console_ioctl in man pages.
The library should get the VT the app was started on. Then it can have set_vt() and restore_vt() modes to move away from and back to the original VT.
- % Done changed from 10 to 20
I Have a branch with functions for supporting getting the VT for the current process (getVTNum) and any named process (getVT) in the RM-751 branch of libpibox.
The merge request for this is here: https://gitlab.com/pibox/libpibox/-/merge_requests/1
These functions need to be tested. There are unit tests already written. There is no app currently using this so I think adding it to videofe would be the best place to start (since it needs it most).
- % Done changed from 50 to 60
Initial test without full media system shows piboxGetVTNum() works as expected in videofe. It finds the vt that X is on. This was true even when I remotely logged in, set DISPLAY=unix:0.0 and ran videofe.
A more complete test is needed to make sure videofe switches vts correctly given the use of the new piboxGetVTNum() api.