[Libdlo] dlfb 0.2rc2 (udlfb)
Roberto De Ioris
roberto at unbit.it
Thu May 28 00:38:41 PDT 2009
On Thu, 2009-05-28 at 00:11 -0700, Greg KH wrote:
>
> Ah, it's when the monitor goes into "sleep" mode, and then I plug it in,
> we can't seem to wake it up.
I can easy implement the change-resolution on the fly (using fbset) in
which i can call the edid parser. Do you think its a good solution ?
>
> Also, where can I get the source for con2fbmap? I see it's part of the
> fbset debian package, but that's not the distro I use these days.
This is the code:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <linux/fb.h>
#define DEFAULT_FRAMEBUFFER "/dev/fb0"
#define DEFAULT_FRAMEBUFFER_DEVFS "/dev/fb/0"
const char *programname;
void Usage(void)
{
fprintf(stderr, "\nUsage: %s console [framebuffer]\n\n",
programname);
exit(1);
}
int main(int argc, char *argv[])
{
int do_write = 0;
char *fbpath; /* any frame buffer will do */
int fd;
struct fb_con2fbmap map;
programname = argv[0];
switch (argc) {
case 3:
do_write = 1;
map.framebuffer = atoi(argv[2]);
case 2:
map.console = atoi(argv[1]);
break;
default:
Usage();
}
if (access("/dev/.devfsd", F_OK) == 0) /* devfs detected */
fbpath = DEFAULT_FRAMEBUFFER_DEVFS;
else
fbpath = DEFAULT_FRAMEBUFFER;
if ((fd = open(fbpath, O_RDONLY)) == -1) {
fprintf(stderr, "open %s: %s\n", fbpath, strerror(errno));
exit(1);
}
if (do_write) {
if (ioctl(fd, FBIOPUT_CON2FBMAP, &map)) {
fprintf(stderr, "ioctl FBIOPUT_CON2FBMAP: %s\n",
strerror(errno));
exit(1);
}
} else {
if (ioctl(fd, FBIOGET_CON2FBMAP, &map)) {
fprintf(stderr, "ioctl FBIOGET_CON2FBMAP: %s\n",
strerror(errno));
exit(1);
}
printf("console %d is mapped to framebuffer %d\n", map.console,
map.framebuffer);
}
close(fd);
exit(0);
}
>
> thanks,
>
> greg k-h
--
Roberto De Ioris
http://unbit.it
JID: roberto at jabber.unbit.it
More information about the Libdlo
mailing list