diff -urN gbm-0.30-1/gbm.c gbm-0.30-1.aoe/gbm.c --- gbm-0.30-1/gbm.c Thu Apr 26 17:23:00 2001 +++ gbm-0.30-1.aoe/gbm.c Fri May 25 16:19:30 2001 @@ -24,6 +24,10 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// fbinv code pasted from Ross Vandegrifts code (ross@willow.seitz.cominserted) +// found at http://poplar.seitz.com/~ross/agenda/ by Alexander Oelzant +// (aoe@mars.tuwien.ac.at) + #include #include #include @@ -40,6 +44,8 @@ extern int detach(int nochdir, int noclose); +void fbinv(int fd, unsigned char c); + #define DEBUG_GBM #define ON_SYNC "/etc/gbm/on_sync" @@ -50,6 +56,14 @@ // should the unit go to sleep when the pen is inserted? int hibernate_on_pen = 1; +void +swap (short *foo, short *bar) +{ + short temp = *foo; + *foo = *bar; + *bar = temp; +} + int echo(const char* s, const char* filename) { int fd; @@ -85,6 +99,28 @@ printf("gbm: set_backlight: %.2x\n", c); #endif ioctl(fd, FBIOPUT_BACKLIGHT, c); + fbinv(fd,c); +} + +void fbinv(int fd, unsigned char c) +{ + int invert; + int index; + unsigned short red [16], green [16], blue [16]; + struct fb_cmap cmap = { 0, 16, red, green, blue, NULL }; + +#ifdef DEBUG_GBM + printf("gbm: inverting: %.2x\n", c); +#endif + ioctl (fd, FBIOGETCMAP, &cmap); + + for (index = 0; index < 8; index ++) + { + swap (red + index, red + 15 - index); + swap (green + index, green + 15 - index); + swap (blue + index, blue + 15 - index); + } + ioctl (fd, FBIOPUTCMAP, &cmap); } int get_backlight(int fd)