Date: Tue, 18 Nov 1997 14:12:29 -0800 From: Amancio Hasty <hasty@rah.star-gate.com> To: hackers@freebsd.org Cc: sos@freebsd.dk Subject: syscons and VC? Message-ID: <199711182212.OAA00302@rah.star-gate.com>
next in thread | raw e-mail | index | archive | help
Hi, Background: I am trying to get glquake going on FreeBSD. glquake uses Mesa/Glide for 3d hardware support and svgalib for mouse and keyboard input. No jokes please about svgalib for mouse and keyboard thats the way that glquake and qtest2 (Quake2) are currently implemented for linux. Should anyone be interested on Mesa/Glide support you can download Mesa-2.5b6 from: ftp://iris.ssec.wisc.edu/pub/Mesa/beta/ You can get the glide library from : http://www.3dfx.com And there is lots of info on glide at www.3dfx.com My 3d board is a Diamond Monsted 3D which is a Voodoo chipset based board. My vga adapter is a Matrox millenium so for more info on Voodoo based boards or technology please visit wwww.3dfx.com Does anyone have a good example on how to switch VCs for FreeBSD? I have implemented the hooks on the linux emulation layer so it shouldn't be a problem to tranlate the linux ioctls to FreeBSD equivalent. Worst case scenarion we can modify svgalib-1.2.11 to fit our OS. glquake so far in demo mode seems to work okay so if get over this technical problem we will have glquake for FreeBSD 8) All my work is for 3.0 -current. --- this is what svgalib-1.2.11 does to aquire a VC: void __svgalib_open_devconsole(void) { struct vt_mode vtm; struct vt_stat vts; struct stat sbuf; char fname[30]; if (__svgalib_tty_fd >= 0) return; /* * Now, it would be great if we could use /dev/tty and see what it is connected to. * Alas, we cannot find out reliably what VC /dev/tty is bound to. Thus we parse * stdin through stderr for a reliable VC */ for (__svgalib_tty_fd = 0; __svgalib_tty_fd < 3; __svgalib_tty_fd++) { if (fstat(__svgalib_tty_fd, &sbuf) < 0) continue; if (ioctl(__svgalib_tty_fd, VT_GETMODE, &vtm) < 0) continue; if ((sbuf.st_rdev & 0xff00) != 0x400) continue; if (!(sbuf.st_rdev & 0xff)) continue; svgalib_vc = sbuf.st_rdev & 0xff; return; /* perfect */ } if ((__svgalib_tty_fd = open("/dev/ttyv0", O_RDWR)) < 0) { printf("svgalib: can't open /dev/console \n"); exit(1); } if (ioctl(__svgalib_tty_fd, VT_OPENQRY, &svgalib_vc) < 0) { printf("svgalib VT_OPENQRY 1 \n"); goto error; } if (svgalib_vc <= 0) { printf(" vc number %d \n", svgalib_vc); goto error; } sprintf(fname, "/dev/ttyv%d", svgalib_vc); close(__svgalib_tty_fd); /* change our control terminal: */ setsid(); printf(" about to open %s \n", fname ); /* We must use RDWR to allow for output... */ if (((__svgalib_tty_fd = open(fname, O_RDWR)) >= 0) && (ioctl(__svgalib_tty_fd, VT_GETSTATE, &vts) >= 0)) { if (!check_owner(vts.v_active)) { printf(" i am not the owner \n"); goto error; } /* success, redirect all stdios */ if (DREP) printf("[svgalib: allocated virtual console #%d]\n", svgalib_vc); fflush(stdin); fflush(stdout); fflush(stderr); close(0); close(1); close(2); dup(__svgalib_tty_fd); dup(__svgalib_tty_fd); dup(__svgalib_tty_fd); /* clear screen and switch to it */ fwrite("\e[H\e[J", 6, 1, stderr); fflush(stderr); if (svgalib_vc != vts.v_active) { startup_vc = vts.v_active; ioctl(__svgalib_tty_fd, VT_ACTIVATE, svgalib_vc); __svgalib_waitvtactive(); } } else { error: if (__svgalib_tty_fd > 2) printf("__svgalib_tty_fd %d \n", __svgalib_tty_fd); close(__svgalib_tty_fd); __svgalib_tty_fd = - 1; printf("Not running in a graphics capable console,\n" "and unable to find one.\n"); } } ----- afterwards the keyboard init routine does: ioctl(__svgalib_kbd_fd, KDSKBMODE, K_MEDIUMRAW); And I am not sure whats the FreeBSD equivalent for K_MEDIUMRAW. Tnks, Amancio
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199711182212.OAA00302>