2009-02-01
BUGFIX: jfbterm (5)
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <linux/fb.h> // include frame buffer header files
#include <sys/ioctl.h>
int main(void)
{
int fbfd = 0 ; // frame buffer file description
/* Get device independent unchangeable information about a frame buffer
* device and a specific video mode by FBIOGET_FSCREENINFO ioctl. */
struct fb_fix_screeninfo finfo;
fbfd = open( "/dev/fb0" , O_RDWR );
if ( !fbfd )
{
printf( "Error: cannot open framebuffer device.\n" );
exit(1);
}
printf("The framebuffer device was opened successfully.\n");
/* Get fixed screen information */
if ( ioctl ( fbfd , FBIOGET_FSCREENINFO , &finfo ) )
{
printf("Error reading fixed screen information.\n");
exit(2);
} else {
printf("Succesfully Read the Fixed Screen Information\n");
}
printf("fb_fix_screeninfo.smem_len = %d\n", finfo.smem_len);
printf("fb_fix_screeninfo.mmio_len = %d\n", finfo.mmio_len);
}
- 在 Ubuntu Intrepid 上執行結果
root@intrepid:~# uname -a
Linux intrepid 2.6.27-7-server #1 SMP Tue Nov 4 20:16:57 UTC 2008 x86_64 GNU/Linux
root@intrepid:~# ./fbinfo
The framebuffer device was opened successfully.
Succesfully Read the Fixed Screen Information
fb_fix_screeninfo.smem_len = 16777216
fb_fix_screeninfo.mmio_len = 0
- 以下是在 Debian Sarge 上執行結果,值得一提的是 jfbterm 在 2.6.8 核心上可以正常執行。(不過還有字型問題需要調整)
root@wsu-admin:~# uname -a
Linux wsu-admin 2.6.8-2-386 #1 Tue Aug 16 12:46:35 UTC 2005 i686 GNU/Linux
root@wsu-admin:~# ./fbinfo
The framebuffer device was opened successfully.
Succesfully Read the Fixed Screen Information
fb_fix_screeninfo.smem_len = 65536
fb_fix_screeninfo.mmio_len = 0
root@wsu-admin:~# jfbterm
jfbterm - Kanji on framebuffer console Version 0.4.7
Copyright (C) 2003 Fumitoshi UKAI
Copyright (C) 1999-2000 Noritoshi Masuichi
This program is based on KON2
Copyright (C) 1992-1996 Takashi MANABE
(**) : Configuration file `/etc/jfbterm.conf'
.... 略 ....
exec : /bin/bash ioctl FBIOGET_CON2FBMAP: Invalid argument
color 0 : 0, 0
color 1 : 2a, 2a
color 2 : 2a, 2a
color 3 : 2a, 2a
color 4 : 2a, 2a
color 5 : 2a, 2a
color 6 : 2a, 2a
color 7 : 2a, 2a
color 8 : 15, 15
color 9 : 3f, 3f
color 10 : 3f, 3f
color 11 : 3f, 3f
color 12 : 3f, 3f
color 13 : 3f, 3f
color 14 : 3f, 3f
color 15 : 3f, 3f
- 以下是在 Debian Etch 上執行結果,有趣的是 jfbterm 0.4.7-7 在 2.6.18 上執行,縱使有 cannot mmap(mmio) : Invalid argument 的錯誤訊息,但仍舊可以正常進入 jfbterm 的環境。
root@etch:~# uname -a
Linux etch 2.6.18-4-686 #1 SMP Wed May 9 23:03:12 UTC 2007 i686 GNU/Linux
root@etch:~# ./fbinfo
The framebuffer device was opened successfully.
Succesfully Read the Fixed Screen Information
fb_fix_screeninfo.smem_len = 1920000
fb_fix_screeninfo.mmio_len = 0
root@etch:~# jfbterm
jfbterm - Kanji on framebuffer console Version 0.4.7
Copyright (C) 2003 Fumitoshi UKAI
Copyright (C) 1999-2000 Noritoshi Masuichi
This program is based on KON2
Copyright (C) 1992-1996 Takashi MANABE
(**) : Configuration file `/etc/jfbterm.conf'
... 略 ...
exec : /bin/bash color 0 : 0, 0
color 1 : 15, 15
color 2 : 540, 540
color 3 : 555, 555
color 4 : a800, a800
color 5 : a815, a815
color 6 : ad40, ad40
color 7 : ad55, ad55
color 8 : 52aa, 52aa
color 9 : 52bf, 52bf
color 10 : 57ea, 57ea
color 11 : 57ff, 57ff
color 12 : faaa, faaa
color 13 : fabf, fabf
color 14 : ffea, ffea
color 15 : ffff, ffff
cannot mmap(mmio) : Invalid argument