annotate Renderer/Engine/ps3fb/cp_vt.cc @ 981:fdb36a9c5030 draft

add double buffering frame device
author root@henri.cr.ie.u-ryukyu.ac.jp
date Thu, 30 Sep 2010 23:54:08 +0900
parents
children 9f5e6bfb1c09
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
981
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
1 // cp_vt.c
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
2 //
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
3 // Copyright (c) 2006, Mike Acton <macton@cellperformance.com>
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
4 //
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
5 // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
6 // documentation files (the "Software"), to deal in the Software without restriction, including without
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
7 // limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
8 // the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
9 // conditions:
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
10 //
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
11 // The above copyright notice and this permission notice shall be included in all copies or substantial
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
12 // portions of the Software.
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
13 //
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
15 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
16 // EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
17 // AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
18 // OR OTHER DEALINGS IN THE SOFTWARE.
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
19
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
20 // NOTES:
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
21 // From http://www.linuxjournal.com/article/2597
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
22 //
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
23 // "Console ttys are used when the keyboard and monitor are directly connected to the system without running
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
24 // the X Window System. Since you can have several virtual consoles, the devices are tty0 through tty63. In
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
25 // theory you can have 64 virtual consoles, but most people use only a few. The device /dev/console is
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
26 // identical to tty0 and is needed for historical reasons. If your system lets you log in on consoles 1
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
27 // through 6, then when you run X Windows System, X uses console 7, so you'll need /dev/tty1 through /dev/
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
28 // tty7 on your system. I recommend having files up through /dev/tty12. For more information on using
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
29 // virtual consoles, see the article Keyboards, Consoles and VT Cruising by John Fisk in the November 1996
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
30 // issue of Linux Journal"
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
31
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
32 #include <stdio.h>
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
33 #include <stdint.h>
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
34 #include <fcntl.h>
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
35 #include <unistd.h>
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
36 #include <sys/ioctl.h>
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
37 #include <linux/vt.h>
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
38 #include <linux/kd.h>
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
39 #include "cp_vt.h"
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
40
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
41
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
42 static inline const char*
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
43 select_error_str( int existing_error, const char* const existing_error_str, int new_error, const char* const new_error_str )
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
44 {
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
45 // Only report the first error found - any error that follows is probably just a cascading effect.
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
46 const char* error_str = (char*)( (~(intptr_t)existing_error & (intptr_t)new_error & (intptr_t)new_error_str)
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
47 | ((intptr_t)existing_error & (intptr_t)existing_error_str) );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
48
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
49 return (error_str);
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
50 }
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
51
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
52
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
53 int
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
54 cp_vt_open_graphics(cp_vt* restrict vt)
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
55 {
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
56 const char* error_str = NULL;
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
57 int error = 0;
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
58
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
59 // Open the current tty
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
60
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
61 // From http://tldp.org/HOWTO/Text-Terminal-HOWTO-6.html#ss6.3
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
62 // (An excellent overview by David S. Lawyer)
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
63 //
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
64 // "In Linux the PC monitor is usually called the console and has several device special files associated
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
65 // with it: vc/0 (tty0), vc/1 (tty1), vc/2 (tty2), etc. When you log in you are on vc/1. To go to vc/2
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
66 // (on the same screen) press down the 2 keys Alt(left)-F3. For vc/3 use Left Alt-F3, etc. These (vc/1,
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
67 // vc/2, vc/3, etc.) are called "virtual terminals". vc/0 (tty0) is just an alias for the current virtual
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
68 // terminal and it's where messages from the system are sent. Thus messages from the system will be seen
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
69 // on the console (monitor) regardless of which virtual terminal it is displaying."
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
70
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
71 const int cur_tty = open( "/dev/tty0", O_RDWR );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
72 const int open_cur_tty_error = (cur_tty >> ((sizeof(int)*8)-1));
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
73 const char* open_cur_tty_error_str = "Could not open /dev/tty0. Check permissions.";
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
74
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
75 error_str = select_error_str( error, error_str, open_cur_tty_error, open_cur_tty_error_str );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
76 error = error | open_cur_tty_error;
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
77
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
78 // From: http://www.linuxjournal.com/article/2783
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
79 // (A little out of date, but a nice primer.)
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
80 //
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
81 // "VT_GETSTATE returns the state of all VT's in the kernel in the structure:
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
82 //
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
83 // struct vt_stat {
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
84 // ushort v_active;
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
85 // ushort v_signal;
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
86 // ushort v_state;
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
87 // };
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
88 //
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
89 // v_active the currently active VT
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
90 // v_state mask of all the opened VT's
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
91 //
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
92 // v_active holds the number of the active VT (starting from 1), while v_state
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
93 // holds a mask where there is a 1 for each VT that has been opened by some process.
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
94 // Note that VT 0 is always opened in this scenario, since it refers to the current VT.
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
95 //
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
96 // Bugs:
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
97 // The v_signal member is unsupported."
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
98
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
99 struct vt_stat vts;
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
100
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
101 const int get_state_error = ioctl( cur_tty, VT_GETSTATE, &vts );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
102 const char* get_state_error_str = "VT_GETSTATE failed on /dev/tty0";
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
103
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
104 error_str = select_error_str( error, error_str, get_state_error, get_state_error_str );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
105 error = error | get_state_error;
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
106
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
107 vt->prev_tty_ndx = vts.v_active;
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
108
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
109 // From: http://opensolaris.org/os/project/vconsole/vt.7i.txt
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
110 // (Close enough to Linux and a pretty good source of documentation.)
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
111 //
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
112 // "VT_OPENQRY
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
113 // This call is used to find an available VT. The argu-
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
114 // ment to the ioctl is a pointer to an integer. The integer
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
115 // will be filled in with the number of the first avail-
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
116 // able VT that no other process has open (and hence, is
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
117 // available to be opened). If there are no available
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
118 // VTs, then -1 will be filled in."
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
119
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
120 const int open_query_error = ioctl( cur_tty, VT_OPENQRY, &vt->tty_ndx);
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
121 const char* open_query_error_str = "No open ttys available";
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
122
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
123 error_str = select_error_str( error, error_str, open_query_error, open_query_error_str );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
124 error = error | open_query_error;
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
125
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
126 const int close_cur_tty_error = close( cur_tty );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
127 const char* close_cur_tty_error_str = "Could not close parent tty";
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
128
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
129 error_str = select_error_str( error, error_str, close_cur_tty_error, close_cur_tty_error_str );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
130 error = error | close_cur_tty_error;
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
131
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
132 char tty_file_name[11];
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
133
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
134 (void)snprintf( tty_file_name, 11, "/dev/tty%d", vt->tty_ndx );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
135
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
136 const int tty = open( tty_file_name, O_RDWR );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
137 const int open_tty_error = (cur_tty >> ((sizeof(int)*8)-1));
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
138 const char* open_tty_error_str = "Could not open tty";
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
139
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
140 error_str = select_error_str( error, error_str, open_tty_error, open_tty_error_str );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
141 error = error | open_tty_error;
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
142
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
143 vt->tty = tty;
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
144
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
145 // From: http://opensolaris.org/os/project/vconsole/vt.7i.txt
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
146 // (Close enough to Linux and a pretty good source of documentation.)
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
147 //
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
148 // "VT_ACTIVATE
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
149 // This call has the effect of making the VT specified in
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
150 // the argument the active VT. The VT manager will cause
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
151 // a switch to occur in the same manner as if a hotkey had
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
152 // initiated the switch. If the specified VT is not open
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
153 // or does not exist the call will fail and errno will be
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
154 // set to ENXIO."
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
155 //
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
156 // "VT_WAITACTIVE
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
157 // If the specified VT is already active, this call
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
158 // returns immediately. Otherwise, it will sleep until
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
159 // the specified VT becomes active, at which point it will
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
160 // return."
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
161
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
162
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
163 const int activate_tty_error = ioctl( vt->tty, VT_ACTIVATE, vt->tty_ndx );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
164 const char* activate_tty_error_str = "Could not activate tty";
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
165
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
166 error_str = select_error_str( error, error_str, activate_tty_error, activate_tty_error_str );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
167 error = error | activate_tty_error;
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
168
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
169 const int waitactive_tty_error = ioctl( vt->tty, VT_WAITACTIVE, vt->tty_ndx );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
170 const char* waitactive_tty_error_str = "Could not switch to tty";
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
171
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
172 error_str = select_error_str( error, error_str, waitactive_tty_error, waitactive_tty_error_str );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
173 error = error | waitactive_tty_error;
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
174
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
175 // From: http://opensolaris.org/os/project/vconsole/vt.7i.txt
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
176 // (Close enough to Linux and a pretty good source of documentation.)
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
177 //
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
178 // "KDSETMODE
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
179 // This call is used to set the text/graphics mode to the VT.
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
180 //
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
181 // KD_TEXT indicates that console text will be displayed on the screen
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
182 // with this VT. Normally KD_TEXT is combined with VT_AUTO mode for
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
183 // text console terminals, so that the console text display will
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
184 // automatically be saved and restored on the hot key screen switches.
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
185 //
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
186 // KD_GRAPHICS indicates that the user/application, usually Xserver,
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
187 // will have direct control of the display for this VT in graphics
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
188 // mode. Normally KD_GRAPHICS is combined with VT_PROCESS mode for
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
189 // this VT indicating direct control of the display in graphics mode.
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
190 // In this mode, all writes to this VT using the write system call are
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
191 // ignored, and the user is responsible for saving and restoring the
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
192 // display on the hot key screen switches."
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
193
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
194 // Save the current VT mode. This is most likely KD_TEXT.
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
195
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
196 const int kdgetmode_error = ioctl( vt->tty, KDGETMODE, &vt->prev_kdmode );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
197 const char* kdgetmode_error_str = "Could not get mode for tty";
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
198
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
199 error_str = select_error_str( error, error_str, kdgetmode_error, kdgetmode_error_str );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
200 error = error | kdgetmode_error;
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
201
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
202 // Set VT to GRAPHICS (user draw) mode
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
203
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
204 const int kdsetmode_graphics_error = ioctl( vt->tty, KDSETMODE, KD_GRAPHICS );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
205 const char* kdsetmode_graphics_error_str = "Could not set graphics mode for tty";
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
206
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
207 error_str = select_error_str( error, error_str, kdsetmode_graphics_error, kdsetmode_graphics_error_str );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
208 error = error | kdsetmode_graphics_error;
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
209
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
210 //
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
211 // Not bothering with VT_PROCESS, VT_AUTO is fine for our purposes.
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
212 //
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
213
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
214 // If vt blanking is active, for example when running this program from a remote terminal,
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
215 // setting KD_GRAPHICS will not disable the blanking. Reset to KD_TEXT from KD_GRAPHICS will
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
216 // force disable blanking. Then return to KD_GRAPHICS for drawing.
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
217 //
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
218 // Note: KD_TEXT (default) to KD_TEXT will do nothing, so blanking will not be disable unless
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
219 // the mode is changing. i.e. the initial set to KD_GRAPHICS above is useful.
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
220
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
221 const int kdsetmode_text_error = ioctl( vt->tty, KDSETMODE, KD_TEXT );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
222 const char* kdsetmode_text_error_str = "Could not set text mode for tty";
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
223
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
224 error_str = select_error_str( error, error_str, kdsetmode_text_error, kdsetmode_text_error_str );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
225 error = error | kdsetmode_text_error;
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
226
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
227 const int kdsetmode_graphics_reset_error = ioctl( vt->tty, KDSETMODE, KD_GRAPHICS );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
228 const char* kdsetmode_graphics_reset_error_str = "Could not reset graphics mode for tty";
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
229
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
230 error_str = select_error_str( error, error_str, kdsetmode_graphics_reset_error, kdsetmode_graphics_reset_error_str );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
231 error = error | kdsetmode_graphics_reset_error;
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
232
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
233 if ( error == -1 )
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
234 {
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
235 printf("ERROR: vt_graphics_open: %s\n",error_str);
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
236 return (-1);
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
237 }
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
238
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
239 return (0);
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
240 }
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
241
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
242 int
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
243 cp_vt_close(cp_vt* restrict vt)
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
244 {
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
245 const char* error_str = NULL;
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
246 int error = 0;
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
247
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
248 // Reset previous mode on tty (likely KD_TEXT)
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
249
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
250 const int kdsetmode_error = ioctl( vt->tty, KDSETMODE, vt->prev_kdmode );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
251 const char* kdsetmode_error_str = "Could not reset previous mode for tty";
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
252
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
253 error_str = select_error_str( error, error_str, kdsetmode_error, kdsetmode_error_str );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
254 error = error | kdsetmode_error;
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
255
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
256 // Restore previous tty
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
257
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
258 const int activate_tty_error = ioctl( vt->tty, VT_ACTIVATE, vt->prev_tty_ndx );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
259 const char* activate_tty_error_str = "Could not activate previous tty";
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
260
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
261 error_str = select_error_str( error, error_str, activate_tty_error, activate_tty_error_str );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
262 error = error | activate_tty_error;
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
263
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
264 const int waitactive_tty_error = ioctl( vt->tty, VT_WAITACTIVE, vt->prev_tty_ndx );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
265 const char* waitactive_tty_error_str = "Could not switch to previous tty";
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
266
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
267 error_str = select_error_str( error, error_str, waitactive_tty_error, waitactive_tty_error_str );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
268 error = error | waitactive_tty_error;
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
269
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
270 // Close tty
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
271
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
272 const int close_tty_error = close( vt->tty );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
273 const char* close_tty_error_str = "Could not close tty";
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
274
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
275 error_str = select_error_str( error, error_str, close_tty_error, close_tty_error_str );
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
276 error = error | close_tty_error;
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
277
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
278 if ( error == -1 )
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
279 {
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
280 printf("ERROR: vt_close: %s\n",error_str);
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
281 return (-1);
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
282 }
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
283
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
284 return (0);
fdb36a9c5030 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
285 }