Skip to contentSkip to conversation

/dev/vcs or /dev/tty local colormap retrieving

DISCUSSION Cedric Roux 2 participants 2 messages Feb 27, 2009

lore
Share & tools
lore
#0 lore raw

Hi linux kernel hackers,

I have a problem.
I want to retrieve the current colormap of a given tty.

/dev/vcsX (or /dev/vcsaX) don't dump the colormap of the given tty through their read() interface.

The GIO_CMAP ioctl call only returns the current *default* colormap, which is not what I want, since someone may send terminal commands to modify the colormap of a specific tty.

(I am working with EGA/VGA text virtual terminals, source code in drivers/char/vt.c)

I will do my own private hack to dump the colormap, but maybe it might be useful for other people as well, so I send you an email to know if you are interested.

If yes, what is the prefered way (according to your internal design policy) to do that?

I think about several methods:
1 - dump the 48 bytes of the colormap at the
end of read(/dev/vcsaX), so after the screen content. Obviously, userland programs that don't take into account the dimensions of the console may behave strangely after this modification, but it's the simplest IMHO,
2 - create a new /dev/vcspX device. Some minor
number after 191 are still available for major 7 c mode. It would pollute /dev, but why not,
3 - have a new ioctl, preferably on /dev/vcsaX
or /dev/vcsX, but might also be available for /dev/ttyX (/dev/vcsaX seems more natural, because this device already exports attributes of characters).

We might also want a write access, why not? And maybe also get the cursor shape (I didn't check for that because I don't need it, so it might already be done somewhere).

If you think this feature is useful, I will send a patch in a few days.

So, well, that's it.
If it appears that I didn't read the sources carefully enough and if the feature I want
is already there, I apologize. In which case, please direct me to the correct source file.

Take care and happy hacking,
Cédric.

#1 lore raw
Quoted 6 lines

3 - have a new ioctl, preferably on /dev/vcsaX
or /dev/vcsX, but might also be available
for /dev/ttyX (/dev/vcsaX seems more
natural, because this device already exports
attributes of characters).

This is probably the right approach.