Ville Syrjälä wrote:
> > Thanks for the patch. What about "vt" or "vt-num"?
>
> "vt" is already taken. IMO "vt-num" sounds quite good.
Attached is updated patch that uses "vt-num" (and dfb_config->vt_num
for consistency).
Regards,
Vaclav
--
PGP key: 0x465264C9, available from http://pgp.mit.edu/
Index: src/misc/conf.c
===================================================================
RCS file: /cvs/directfb/DirectFB/src/misc/conf.c,v
retrieving revision 1.122
diff -u -u -r1.122 conf.c
--- src/misc/conf.c 18 Nov 2006 10:45:14 -0000 1.122
+++ src/misc/conf.c 20 Dec 2006 10:15:39 -0000
@@ -99,6 +99,7 @@
" [no-]deinit-check Enable deinit check at exit\n"
" block-all-signals Block all signals\n"
" [no-]vt-switch Allocate/switch to a new VT\n"
+ " vt-num=<num> Use given VT instead of current/new one\n"
" [no-]vt-switching Allow Ctrl+Alt+<F?> (EXPERIMENTAL)\n"
" [no-]graphics-vt Put terminal into graphics mode\n"
" [no-]vt Use VT handling code at all?\n"
@@ -340,6 +341,7 @@
dfb_config->mmx = true;
dfb_config->vt = true;
dfb_config->vt_switch = true;
+ dfb_config->vt_num = -1;
dfb_config->vt_switching = true;
dfb_config->kd_graphics = true;
dfb_config->translucent_windows = true;
@@ -866,6 +868,22 @@
if (strcmp (name, "no-vt-switch" ) == 0) {
dfb_config->vt_switch = false;
} else
+ if (strcmp (name, "vt-num" ) == 0) {
+ if (value) {
+ int vt_num;
+
+ if (sscanf( value, "%d", &vt_num ) < 1) {
+ D_ERROR("DirectFB/Config 'vt-num': Could not parse value!\n");
+ return DFB_INVARG;
+ }
+
+ dfb_config->vt_num = vt_num;
+ }
+ else {
+ D_ERROR("DirectFB/Config 'vt-num': No value specified!\n");
+ return DFB_INVARG;
+ }
+ } else
if (strcmp (name, "vt-switching" ) == 0) {
dfb_config->vt_switching = true;
} else
Index: src/misc/conf.h
===================================================================
RCS file: /cvs/directfb/DirectFB/src/misc/conf.h,v
retrieving revision 1.66
diff -u -u -r1.66 conf.h
--- src/misc/conf.h 18 Nov 2006 10:45:14 -0000 1.66
+++ src/misc/conf.h 20 Dec 2006 10:15:39 -0000
@@ -67,6 +67,8 @@
bool deinit_check;
bool vt_switch; /* allocate a new VT */
+ int vt_num; /* number of TTY to use or -1
+ if the default */
bool kd_graphics; /* put terminal into graphics
mode */
Index: systems/fbdev/vt.c
===================================================================
RCS file: /cvs/directfb/DirectFB/systems/fbdev/vt.c,v
retrieving revision 1.6
diff -u -u -r1.6 vt.c
--- systems/fbdev/vt.c 28 Oct 2006 13:35:54 -0000 1.6
+++ systems/fbdev/vt.c 20 Dec 2006 10:15:39 -0000
@@ -146,22 +146,30 @@
if (!dfb_config->vt_switch) {
- dfb_vt->num = dfb_vt->prev;
+ if (dfb_config->vt_num != -1)
+ dfb_vt->num = dfb_config->vt_num;
+ else
+ dfb_vt->num = dfb_vt->prev;
/* move vt to framebuffer */
dfb_vt->old_fb = vt_get_fb( dfb_vt->num );
vt_set_fb( dfb_vt->num, -1 );
}
else {
- int n;
+ if (dfb_config->vt_num == -1) {
+ int n;
- n = ioctl( dfb_vt->fd0, VT_OPENQRY, &dfb_vt->num );
- if (n < 0 || dfb_vt->num == -1) {
- D_PERROR( "DirectFB/core/vt: Cannot allocate VT!\n" );
- close( dfb_vt->fd0 );
- D_FREE( dfb_vt );
- dfb_vt = NULL;
- return DFB_INIT;
+ n = ioctl( dfb_vt->fd0, VT_OPENQRY, &dfb_vt->num );
+ if (n < 0 || dfb_vt->num == -1) {
+ D_PERROR( "DirectFB/core/vt: Cannot allocate VT!\n" );
+ close( dfb_vt->fd0 );
+ D_FREE( dfb_vt );
+ dfb_vt = NULL;
+ return DFB_INIT;
+ }
+ }
+ else {
+ dfb_vt->num = dfb_config->vt_num;
}
/* move vt to framebuffer */
_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev