Re: Dynamically attaching fbcon to a framebuffer

From: Rick L. Vinyard, Jr.
Date: Wed Dec 02 2009 - 12:06:55 EST


Alan Cox wrote:
>> I have the display as a framebuffer device now (based on fbdefio with
>> the
>> hid device as the parent).
>>
>> Do I really need a separate console device or can I just use fbcon?
>
> fbcon should do what you want.
>

I've been playing with fbcon, but can't get a fbcon console started.

I wrote a little app that uses the framebuffer ioctls to change fbcon's
map. Specifically, the G13 shows up as fb1, and the app basically does
this:

int fd = open("/dev/fb1", O_RDWR);
struct fb_con2fbmap con2fb;
int ret;

if ( fd < 0 ) { printf("Error opening %s\n", DEVICE); return -1; }

con2fb.console = 5;

ioctl(fd, FBIOGET_CON2FBMAP, &con2fb);
printf("Console: %d Framebuffer: %d\n", con2fb.console,
con2fb.framebuffer);

con2fb.framebuffer = 1;
ret = ioctl(fd, FBIOPUT_CON2FBMAP, &con2fb);
printf("Succeeded: %d\n", ret);

ioctl(fd, FBIOGET_CON2FBMAP, &con2fb);
printf("Console: %d Framebuffer: %d\n", con2fb.console,
con2fb.framebuffer);

This succeeds and I get:
Console: 5 Framebuffer: 0
Succeeded: 0
Console: 5 Framebuffer: 1

But, when I change to console 5 that's when things die. I never hit any of
my fb_ops callbacks.

The driver can be found here:
http://g13.svn.sourceforge.net/viewvc/g13/driver/trunk/hid-g13.h
http://g13.svn.sourceforge.net/viewvc/g13/driver/trunk/hid-g13.c

This doesn't actually do anything but do a printk (in hex) of the
framebuffer memory.

When I modify the framebuffer through a mmap I don't have any problems,
but when I switch to the console the kernel hangs.

I'm currently recompiling the kernel with FBCONDEBUG defined and I'll test
from there.

Any other suggestions on how to approach this?

Thanks,

---

Rick


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/