program with frame buffer
Ubuntu 9.10, I have /dev/fb0.
I try a tutorial c source code, and it works on the embedded board, and works on the PC in my lab as well, but on my own PC (Ubuntu 9.10) I met the following problem fd=open("/dev/fb0",O_RDWR); is OK ioctl(fd,FBIOGET_VSCREENINFO,&vinfo); always fails My task is to draw a point or line, and I know something about frame buffer. |
Quote:
Code:
if (ioctl(fd, FBIOGET_VSCREENINFO, &info) < 0) |
Thanks, and here is the output of perror()
Error reading fixed information. : Bad file descriptor Then I added printf("fbfd=%d\n",fbfd); it returned fbfd=-1; so open() fails , I wondered why open() fails, as I said I have /dev/fb0, so it lacks the right device driver? $lsmod|grep fb vga16fb 12456 0 vgastate 9628 1 vga16fb fbcon 36640 72 tileblit 2460 1 fbcon font 8124 1 fbcon bitblit 5372 1 fbcon vesafb 5696 1 sorry for my English, this is the first time I post on an English bbs |
I change to root, and it works.
$ ls -l /dev/fb0 crw-rw---- 1 root video 29, 0 2009-11-07 21:21 /dev/fb0 |
Quote:
Quote:
On another note, you can still open the file if you add yourself to the group 'video' by placing your name on the 'video' line of /etc/group. For example, to add myself to 'video' on my system, the following line: Code:
video:x:44: Code:
video:x:44:john This is a much, much safer option than running your program as root, lest you do any permanent damage to your system. John G |
Thanks a lot.
Now I can draw a point, a line and a circle both on the arm board in my lab and on my own computer. That afternoon I added myself to video group but still failed, so I turned to use sudo . Today I ran the program without root and succeeded. And by running the command 'groups', I see 'video'. I add a new user ,lwhat, and add him to video group, and run 'groups', I cannot see video. Then I log off and login ,and lwhat is in the group video and of course is able to run the frame buffer program. I guess I should exit and login to allow the changes to happen. |
This is exactly what I want to do. Iwhat, can you provide some more information on how you drew a point, line and circle on the arm and PC?
|
All times are GMT -5. The time now is 09:59 AM. |