Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Some one please help me with this..

Status
Not open for further replies.

CNewbie

Programmer
Dec 20, 2001
18
US
I have been trying for 3 weeks to find info I can use to: initialize, and read from a serial mouse in c, I have tried the source for GPM, libsvga, selection, allegro, and the linux drivers, the problem is that these files are made to support ALL kinds of mice, and I need to write code for just one, mine.(MS Serial)
I have code for in dos using int86() and 33, but since i use linux, thats not going to work, I can't use gpm, because there is not enough room on the micro-kernel floppy i'm using, so low-level serial code is my only choice.
I have tried reading the /dev/mouse character file, but since my kernel isn't compiled with mouse support, that wont work either.
If someone could post a small bit of code just to write to port 3f8 (to turn on, and set the mouse settings) then a read function (to read the mouse data, all i really need in the state of the left button, and wether or not it is moving left or right)
I have looked everywhere, and tried all the irc programming and linux chat rooms, and nothing, well nothing but people saying use gpm.
Can it be that I'm the only person in the world who has ever tried to create a console only program with mouse support for linux?

Please help, any info at all would be great.

Even some code to do this in dos with c and no dos.h int86(), would be great. Like an old dos program written in c with native mouse support, even with no mouse driver loaded as a TSR.

And if no one has any ideas, how about how to put a read(fd, mousebuf, 3); into an array, so that mousebuf, which is supposed to be a 3 byte array, now is split into say an array of 24-bits so I can view the state of each bit without doing a binary AND or OR on them. And is the above line putting 3-bytes into mousebuf[0], or is it puting byte 1 into mousebuf[0] byte 2 into mousebuf[1] and so on..

Please help, I have tried for so long.
 
Well this sort looks like a job for assembler. Maybe you can just put some asm code inside the main c code(that's what gas is for. take a look at With that you probably can sort recreate the int86 function, anyways at least to get some of your mouse needs to work.
I'm with a similar problem while doing a bootstrap disk.
If you'd like maybe I can send you some code.
 
Try looking at the source for Rhide (published under the GNU GPL)it can be found at the DJGPP website which is You may also want to look at sourceforge for a OSDN project written in DOS with mouse support. If you find anything that really helps I'd be intrested to see it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top