[질문] 프레임 버퍼 실행 에러
글쓴이: bosub / 작성시간: 목, 2006/02/02 - 6:46오후
KELP의 임베디드 강좌 이규명씨의 프레임 버퍼 강좌의 소스코드를 실행해 보앗는데 아무 반응이 없네요.
X-windows 띄우지 않고 텍스트 모드에서 드라이버 올린후에
아래 소스 컴파일해서 실행 했는데 화면에 아무런 변화가 없습니다.
시스템은 레드헷 페도라 3 입니다.
아래 파일이 R,G,B가 5,6,5로 되어 있어서 이것을 5,5,5로 변경해서 해 보았는데도 안됩니다.
원인이 무엇이고 어떻게 해야 하나요?
/* 2 * fbpixel.c : Frame buffer draw pixel example 3 * 4 * Copyright(C) 2002 holelee 5 * 6 */ 7 8 #include <stdio.h> 9 #include <stdlib.h> /* for exit */ 10 #include <unistd.h> /* for open/close .. */ 11 #include <fcntl.h> /* for O_RDONLY */ 12 #include <sys/ioctl.h> /* for ioctl */ 13 #include <sys/types.h> 14 #include <linux/fb.h> /* for fb_var_screeninfo, FBIOGET_VSCREENINFO */ 15 16 #define FBDEVFILE "/dev/fb" 17 18 typedef unsigned char ubyte; 19 20 unsigned short makepixel(ubyte r, ubyte g, ubyte b) 21 { 22 return (unsigned short)(((r>>3)<<11)|((g>>2)<<5)|(b>>3)); 23 } 24 25 int main() 26 { 27 int fbfd; 28 int ret; 29 struct fb_var_screeninfo fbvar; 30 unsigned short pixel; 31 int offset; 32 33 fbfd = open(FBDEVFILE, O_RDWR); 34 if(fbfd < 0) 35 { 36 perror("fbdev open"); 37 exit(1); 38 } 39 40 ret = ioctl(fbfd, FBIOGET_VSCREENINFO, &fbvar); 41 if(ret < 0) 42 { 43 perror("fbdev ioctl"); 44 exit(1); 45 } 46 47 if(fbvar.bits_per_pixel != 16) 48 { 49 fprintf(stderr, "bpp is not 16\n"); 50 exit(1); 51 } 52 53 /* red pixel @ (0,0) */ 54 if(lseek(fbfd, 0, SEEK_SET) < 0) 55 { 56 perror("fbdev lseek"); 57 exit(1); 58 } 59 pixel = makepixel(255,0,0); /* red pixel */ 60 write(fbfd, &pixel, 2); /* write 2byte(16bit) */ 61 62 /* green pixel @ (100,50) */ 63 offset = 50*fbvar.xres*(16/8)+100*(16/8); 64 if(lseek(fbfd, offset, SEEK_SET) < 0) 65 { 66 perror("fbdev lseek"); 67 exit(1); 68 } 69 pixel = makepixel(0,255,0); /* green pixel */ 70 write(fbfd, &pixel, 2); /* write 2byte(16bit) */ 71 72 73 /* blue pixel @ (50,100) */ 74 offset = 100*fbvar.xres*(16/8)+50*(16/8); 75 if(lseek(fbfd, offset, SEEK_SET) < 0) 76 { 77 perror("fbdev lseek"); 78 exit(1); 79 } 80 pixel = makepixel(0,0,255); /* blue pixel */ 81 write(fbfd, &pixel, 2); /* write 2byte(16bit) */ 82 83 /* white pixel @ (100,100) */ 84 offset = 100*fbvar.xres*(16/8)+100*(16/8); 85 if(lseek(fbfd, offset, SEEK_SET) < 0) 86 { 87 perror("fbdev lseek"); 88 exit(1); 89 } 90 pixel = makepixel(255,255,255); /* white pixel */ 91 write(fbfd, &pixel, 2); /* write 2byte(16bit) */ 92 93 close(fbfd); 94 exit(0); 95 return 0; 96 }
Forums:
/dev/fb 가 지금 활성화(?)가 되어있는지 확인해주세요.부팅
/dev/fb 가 지금 활성화(?)가 되어있는지 확인해주세요.
부팅할때 펭귄이 나온다면 프레임 버퍼가 돌아가는것으로 판단할수 있구요.
펭귄이 나왔으면 /dev/fb0 부터 /dev/fb3 까지 확인해보세요.
아래 소스에서
fbvar.bits_per_pixel 값을 확인하는 방법도 있네요.
greedy 알고리즘
부팅후에 modprobe로 그래픽 디바이스 드라이버 올렸습니다.커널
부팅후에 modprobe로 그래픽 디바이스 드라이버 올렸습니다.
커널 컴파일로 커널에서 설정을 해야 하나요?
펭귄은 안 뜨던데.. 그런데 디바이스 드라이버 올린후에는
/dev/fb0은 생성 되고요 픽셀값도 읽을 수 있습니다.
5초 앞이라도 내다 볼 수 있다면..
[quote="bosub"]커널 컴파일로 커널에서 설정을 해야 하나요?[
해야 됩니다
아 해결 했습니다. grub.conf 파일을title Fe
아 해결 했습니다.
grub.conf 파일을
title Fedora Core (2.6.14-1.1656_FC4smp)
root (hd0,6)
kernel /boot/vmlinuz-2.6.14-1.1656_FC4smp ro root=LABEL=/ vga=0x31B rhgb quiet
initrd /boot/initrd-2.6.14-1.1656_FC4smp.img
다음과 같이 고치고
그리고 나서 프레임버퍼 그래픽 드라이버 다시 올리닌깐 되네요
감사합니다 *^^*
5초 앞이라도 내다 볼 수 있다면..
댓글 달기