LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-14-2006, 05:33 AM   #1
twomol
LQ Newbie
 
Registered: Jun 2006
Posts: 1

Rep: Reputation: 0
Can I redirect console to another framebuffer device when machine is running


I have two video card so two framebuffer device, can I redirect the console on the fly(I mean when the system is running, not through bootloader)??I google that, I find a software named con2fb, but I can't find where to download it , yet I don't know does it work with 2.6 kernel??
Another question, is there tool on linux which can watch any content of ram according physical address or tool which can watch any content of kernel space?
Any suggestion is appreciated!^_^

Last edited by twomol; 06-14-2006 at 05:35 AM.
 
Old 06-14-2006, 11:52 AM   #2
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Here is con2fb.c from my machine (under GPL of course):

Code:
/* this is userspace utility which allows you to redirect console to another fb device 
 * You can specify devices & consoles by both numbers and devices. Framebuffers numbers
 * are zero based (/dev/fb0 ... ), consoles begins with 1 (/dev/tty1 ... )
 */
#include <linux/fb.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

int main(int argc, char* argv[]) {
	struct fb_con2fbmap c2m;
	char* fbPath;
	u_int32_t con, fb;
	char* e;
	char* progname = strrchr(argv[0], '/');
	int f;

	if (progname)
		progname++;
	else
		progname = argv[0];
	if (argc < 3) {
		fprintf(stderr, "usage: %s fbdev console\n", progname);
		return 1;
	}
	fb = strtoul(argv[1], &e, 10);
	if (*e) {
		struct stat sbf;

		if (stat(argv[1], &sbf)) {	
			fprintf(stderr, "%s: are you sure that %s can be used to describe fbdev?\n", progname, argv[1]);
			return 1;
		}
		if (!S_ISCHR(sbf.st_mode)) {
			fprintf(stderr, "%s: %s must be character device\n", progname, argv[1]);
			return 1;
		}
		fb = sbf.st_rdev & 0xFF;
		if (fb >= 32)
			fb >>= 5;
		fbPath = argv[1];
	} else 
		fbPath = "/dev/fb0";
	con = strtoul(argv[2], &e, 10);
	if (*e) {
		struct stat sbf;

		if (stat(argv[2], &sbf)) {
			fprintf(stderr, "%s: are you sure that %s can be used to describe vt?\n", progname, argv[2]);
			return 1;
		}
		if (!S_ISCHR(sbf.st_mode)) {
			fprintf(stderr, "%s: %s must be character device\n", progname, argv[2]);
			return 1;
		}
		con = sbf.st_rdev & 0xFF;
	}
	c2m.console = con;
	c2m.framebuffer = fb;
	f = open(fbPath, O_RDWR);
	if (f < 0) {
		fprintf(stderr, "%s: Cannot open %s\n", progname, fbPath);
		return 1;
	}
	if (ioctl(f, FBIOPUT_CON2FBMAP, &c2m)) {
		fprintf(stderr, "%s: Cannot set console mapping\n", progname);
		close(f);
		return 1;
	}
	close(f);
	return 0;
}
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Serial Console-redirect to another PC adenev Linux - Newbie 2 04-01-2009 07:21 PM
Console Framebuffer darkarcon2015 Slackware 9 07-16-2005 05:24 PM
Framebuffer Console Help Crazed123 Linux - Software 5 07-29-2003 02:10 PM
Framebuffer Console jspenguin Linux - General 3 02-28-2003 08:21 AM
Framebuffer Console Jesus Slackware 6 05-02-2002 12:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration