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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LPT and Mouse IO Question.

Status
Not open for further replies.

CNewbie

Programmer
Dec 20, 2001
18
0
0
US
is there some code for linux that is about the sme as this.
i know this wont work in linux, but i really need access to the rate and direction of the mouse.
i know some kind of open("/dev/mouse") may work, but i dont know how to code it.
i cant use ncurses, or alllegro,

#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;
}


The last question i have is how to properly output binary numbers out the paralell port using linux equivalent to this


#define LPT 0x0378
#define LCD_DATA_ADDRESS LPT+0
#define LCD_CONTROL_ADDRESS LPT+2
static void LCD_WriteControl (unsigned char data)
{
outp(LCD_CONTROL_ADDRESS,0x03); //E2=0, RS=0, R/W=0, E=0
waits();
outp(LCD_DATA_ADDRESS,data);
waits();
outp(LCD_CONTROL_ADDRESS,0x02); //E2=0, RS=0, R/W=0, E=1
waits();
outp(LCD_CONTROL_ADDRESS,0x03); //E2=0, RS=0, R/W=0, E=0
waits();
outp(LCD_CONTROL_ADDRESS,0x01); //E2=0, RS=0, R/W=1, E=0
}



i have tried outportb, outs, outb.

but they just crash.

if someone could post a little sample of code showing /dev/mouse or an asm code snipit example on how to access the paralell port.

please i have looked everywhere, and the all use ncurses or say to use lcdproc as a server, but i cant use any of those do to space requirements.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top