| PLEX86 | ||
|
reading mouse coordinates 1503On Fri, 12 May 2006 13:36:45 -0400, Gerald Pollack staggered into the Black Sun and said: comparing suse 10 to fedora core 45 1504 On Fri, 12 May 2006 08:47:17 -0700, ajagwe Underneath the covers all Linuxes are pretty much the same. They use the same kernel, the same applications, they offer the same... So the only hbuttle is to make the program read in non-blocking mode. There's gotta be a way to do this; read on for one approach. Actually, it does. It makes it clear that the goal is pretty low-level, and you're not building something that really interfaces with other programs. So you have much more leeway than you would if you were building an X module or something. This is the heart of the problem. OK... device files aren't like regular files. (Everything is a file, but some files are more equal than others.) When you fopen() a device file, the C library eventually calls the syscall open(), and it *doesn't* generally open() with the ONONBLOCK flag set. I wrote a short C program that illustrated how to open()dev-cdrom without blocking, and perform an ioctl on the device to figure out whether there was a CD-R* in the drive. If you just fopen()dev-cdrom, the CD-R* ejects its tray if there's no medium in the drive, which is often undesirable. Message-ID is can probably be modified for your purposes. Note you'll have to read() instead of fread()ing this; file descriptors != FILE*s. read() will return EAGAIN if you've open()ed the mouse with ONONBLOCK, so make sure to handle that case and the other error codes read() can return. If you're sure this is the case, fine. I've just seen too many instances where temporary, specific solutions get made permanent and general. Anyway, HTH, -- Matt GThere is no Darkness in Eternity-But only Light too dim for us to see Brainbench MVP for Linux Admin mail: TRAP + SPAN don't belong ----------------------------- penguins, is Tux." --MegaHAL
|
||||
comparing suse 10 to fedora core 45 1504 Linux groups from Newsgroups The #1 Usenet Provider on the Internet
|
||||