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!

Got LPT port to work, but mouse still is confusing, please help.

Status
Not open for further replies.

CNewbie

Programmer
Dec 20, 2001
18
US
I got the lpt port to work, if anybody cares, heres some code.


#define LPT 0x0378
#define LCD_DATA_ADDRESS LPT+0
#define LCD_CONTROL_ADDRESS LPT+2

if ((ioperm (LPT, 3, 1)) == -1) {
printf ("init: failed\n");
} //set port to "ok i can write to it"
outportb(LCD_CONTROL_ADDRESS,0x17); //E2=1, RS=1, R/W=0, E=0
outportb(LCD_CONTROL_ADDRESS,0x0F); //E2=0, RS=1, R/W=0, E=0
outportb(LCD_CONTROL_ADDRESS,0x0D); //E2=0, RS=1, R/W=1, E=0

but the mouse still is confusing, i know i can fseek the /dev/mouse file but, I cant tell what and where the data is , you cant open it with a text viewer to see the data or its structure, so where do i start?
all i care about is DIRECTION and VELOCITY and LEFT_CLICK.
can someone post some code they may have written, or point me to a low-lwvwl mouse only faq,

I just need the Linux equavilant to:
#include <dos.h>

void get_mouse_mickeys()
{
//get mickey x and y
i.x.ax=11;
int86(0x33,&i,&o);
mickeyx=o.x.cx;
mickeyy=o.x.dx;
if (mickeyx>32000)mickeyx=(0-(65536-mickeyx));
if (mickeyy>32000)mickeyy=(0-(65536-mickeyy));

//get x and y cords and button state
i.x.ax=3;
int86(0x33,&i,&o);
mouse_x=o.x.cx;
mouse_y=o.x.dx;
mouse_b= o.x.bx;
}

Thank you for any help in advance.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top