View Single Post
Old 10-17-2009, 11:19 PM   #155
ericshliao
Guru
ericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enough
 
Posts: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
Antartica,

I am trying to create a simple program so that I can call it to do a full-screen refresh in shell. The following code are borrowed from your xepdmgr. I can compile it with gcc without problem, but I haven't really tried it on my iLiad.
Please comment on the following code if it will provide what I want.
Thank you so much.


Code:
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>

/* ioctl numbers */
#define FBIO_UPLOAD_WAVEFORM 0x40007606
#define FBIO_ERASE_WHITE     0x40087602
#define FBIO_DISPLAY         0x40087601
#define FBIO_DISPLAYPARTIAL  0xfff

/* ioctl structures parameters */
#define WAVEFORM_4BPP_IMAGE       1
#define WAVEFORM_DRAW             4
#define WAVEFORM_FAST_BLACK_WHITE 6
#define WAVEFORM_TYPING           9

/* ioctl structures */
struct display_update_info {
    int waveform;
    int sequence;
};

int main(int argc, char *argv[], char *envp[]){
    struct display_update_info Update;
    int error;
    Update.waveform = WAVEFORM_4BPP_IMAGE;
    Update.sequence = 0;

	int fd;
	if((fd=open("/dev/fb0",O_RDWR))!=-1){
		ioctl(fd, FBIO_ERASE_WHITE, &Update);
	}
    return(0);
}
ericshliao is offline   Reply With Quote