Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:vyankatesh004:MeeGo:Netbook:1.2
plymouth-lite
plymouth-lite-vtswitch.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File plymouth-lite-vtswitch.patch of Package plymouth-lite
--- a/ply-image.c +++ b/ply-image.c @@ -39,6 +39,7 @@ #include <sys/types.h> #include <unistd.h> #include <math.h> +#include <linux/vt.h> #include <png.h> @@ -390,20 +391,6 @@ #define FRAMES_PER_SECOND 50 #endif -static int console_fd; - -static bool -hide_cursor (void) -{ - static const char invisible_cursor[] = "\033[?25l\033[?1c"; - - if (write (STDOUT_FILENO, invisible_cursor, - sizeof (invisible_cursor) - 1) != sizeof (invisible_cursor) - 1) - return false; - - return true; -} - static void animate_at_time (ply_frame_buffer_t *buffer, ply_image_t *image) @@ -429,6 +416,58 @@ } +static void +switch_to_vt (int vt) +{ + static const char *ttys[] = { + "/dev/tty", + "/dev/tty0", + "/proc/self/fd/0", + "/dev/console", + NULL + }; + int i; + + for (i = 0; ttys[i] != NULL; i++) + { + int fd = open (ttys[i], O_RDWR); + if (fd < 0) + continue; + + if (!isatty (fd)) + goto next_iter; + + if (ioctl (fd, VT_ACTIVATE, vt)) + { + perror("vt activation failed"); + goto next_iter; + } + if (ioctl (fd, VT_WAITACTIVE, vt)) + { + perror ("wait for vt activation failed"); + goto next_iter; + } + close (fd); + break; + next_iter: + close (fd); + } +} + +static void +hide_cursor (void) +{ + int fd = open ("/sys/devices/virtual/graphics/fbcon/cursor_blink", O_WRONLY); + char zero[] = "0"; + if (fd < 0) + perror ("failed to open fbcon"); + else + { + write (fd, zero, sizeof (zero)); + close (fd); + } +} + int main (int argc, char **argv) @@ -439,13 +478,16 @@ exit_code = 0; -// hide_cursor (); - if (argc == 1) image = ply_image_new ("/usr/share/plymouth/splash.png"); else image = ply_image_new (argv[1]); + if (argc > 2) + switch_to_vt (atoi (argv[2])); + + hide_cursor (); + if (!ply_image_load (image)) { exit_code = errno; @@ -453,8 +495,6 @@ return exit_code; } - console_fd = open ("/dev/tty0", O_RDWR); - buffer = ply_frame_buffer_new (NULL); if (!ply_frame_buffer_open (buffer))
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor