[질문] 프레임 버퍼 실행 에러

bosub의 이미지

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 }

kooya의 이미지

/dev/fb 가 지금 활성화(?)가 되어있는지 확인해주세요.

부팅할때 펭귄이 나온다면 프레임 버퍼가 돌아가는것으로 판단할수 있구요.

펭귄이 나왔으면 /dev/fb0 부터 /dev/fb3 까지 확인해보세요.

아래 소스에서

fbvar.bits_per_pixel 값을 확인하는 방법도 있네요.

Quote:

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 }

greedy 알고리즘

bosub의 이미지

부팅후에 modprobe로 그래픽 디바이스 드라이버 올렸습니다.
커널 컴파일로 커널에서 설정을 해야 하나요?
펭귄은 안 뜨던데.. 그런데 디바이스 드라이버 올린후에는
/dev/fb0은 생성 되고요 픽셀값도 읽을 수 있습니다.

5초 앞이라도 내다 볼 수 있다면..

익명 사용자의 이미지

bosub wrote:
커널 컴파일로 커널에서 설정을 해야 하나요?

해야 됩니다

bosub의 이미지

아 해결 했습니다.

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초 앞이라도 내다 볼 수 있다면..

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.