Index:
[thread]
[date]
[subject]
[author]
From: Marcus Sundberg <mackan@stacken.kth.se>
To : ggi-develop@eskimo.com
Date: Sun, 30 Aug 1998 01:19:13 +0000
ioctl()s now work with kgicon
Hi!
I finally got kgicon working again on my system by doing some
PSBRA (Problem Solving By Random Actions - it means you just
do some stuff that doesn't seem related to the problem, and if
you're lucky the problem will go away when you're done ;-)
And with this problem finally solved I've now added support for
passing KGI ioctls through kgicon. I've attached a small
testprogram that I've used to test it. Now I only have to learn
how to set up mmap()s and then I'll take a shot at getting the
accel ioctl()s to work.
Btw, the dali KGI system would win the obfuscated C contest
anytime. Why does one do things like this:
#define VM(x) (vma->vm_ ## x)
???
Sure the author had to do one percent fewer keypresses, but it
makes the code higly unreadable!
//Marcus
--
-------------------------------+------------------------------------
Marcus Sundberg | http://www.stacken.kth.se/~mackan/
Royal Institute of Technology | Phone: +46 707 295404
Stockholm, Sweden | E-Mail: mackan@stacken.kth.se
---- snip ------
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <kgi/kgi.h>
#include <kgi/kgi_commands.h>
void
print_range(char *name, ggi_range *range)
{
printf("%s %d - %d\n", name, range->min, range->max);
}
void
print_coord(char *name, ggi_coord *coord)
{
printf("%s %d x %d\n", name, coord->x, coord->y);
}
int
main(int argc, char *argv[])
{
int fd;
struct kgi_monitor mon;
char *dev = "/dev/fb0";
if (argc > 1)
dev = argv[1];
if ((fd = open(dev, O_RDONLY)) < 0) {
perror("opening framebuffer device");
exit(1);
}
if (ioctl(fd, MONITOR_GETINFO, (void*) &mon) != 0) {
perror("getting KGI monitor info");
exit(2);
}
printf ("\nKGI Monitor Info\n");
printf (" Manufacturer : %s\n", mon.manufact);
printf (" Model : %s\n", mon.model);
printf (" Max resolution: %d x %d\n", mon.maxdots.x,
mon.maxdots.y);
print_coord(" Size (in mm) :", &mon.size);
printf (" Bandwidth : %3d - %3d MHz\n",
mon.dclk.min/1000000,
mon.dclk.max/1000000);
printf (" HFreq : %3d - %3d KHz\n",
mon.hfreq.min/1000,
mon.hfreq.max/1000);
printf (" VFreq : %3d - %3d Hz\n", mon.vfreq.min,
mon.vfreq.max);
printf ("\n");
return 0;
}
---- snip ------
Index:
[thread]
[date]
[subject]
[author]