LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-20-2007, 02:58 PM   #1
myrmidon
Member
 
Registered: May 2005
Distribution: redhat 9 , fedora 5,6,7,DSL,Debian 3, mandrake 9.2 , knoppix 3.8, red hat 7.3
Posts: 38

Rep: Reputation: 15
IR frame like serial mouse driver


Hi to all,

i have a big problem,

I have a IR frame with which i communicate via serial port with AT commands.Its work's very well in my application.

Now i want to use it like mouse under X.

I realized that under console gpm is responsible as mouse server.

Now in which format or protocol should i send data-s to gpm ?
I do understand that my code should be a module driver. That's not a big trouble,
but how can i send and in which format should format the data from my driver to gpm ???

And is that protocol ok for my X in XFree46 conf file ?


I communicate to my frame like (serial port 9600 8n1):

me> AT
frame< OK

me> AT,POS
frame< 234,345


Thank you for youre help...

OS:Redhat 9
 
Old 10-29-2007, 04:57 PM   #2
myrmidon
Member
 
Registered: May 2005
Distribution: redhat 9 , fedora 5,6,7,DSL,Debian 3, mandrake 9.2 , knoppix 3.8, red hat 7.3
Posts: 38

Original Poster
Rep: Reputation: 15
Progress

Ok i managed to read the data from the hardware, to setup irq driven reads :

setting the serial parameters:
Quote:
int ret;

ret = request_irq(4, handler, SA_INTERRUPT, "serialport", handler);
if (ret){ printk ("##### error requesting irq 4: returned %d\n", ret); } enable_irq(4);

outb_p(0, SERPORT + 3);
outb_p(0x00, SERPORT + 2);
outb_p(0x0B, SERPORT + 4);


outb_p(0x00, SERPORT + 1); // Disable IER
outb_p(0x83, SERPORT + 3); // Switch to DLAB =1

outb_p(0x00, SERPORT + 1); // Set DLM divisor = 0 (9600)
outb_p(0x0C, SERPORT ); // Set DLL divisor = 6 (9600)

outb_p(0x03, SERPORT + 3);
// Switch to DLAB = 0, 8 data bits, one stop bit, no parity, no break

// Bit 0 Enable Received DATA Interrupt
outb_p(0x01, SERPORT + 1);

handle the irq :


Quote:
static int handler(void)
{
// do stuff
int tmp=0,c,x=0,y=0;


do
{
c=inb_p(SERPORT+5);
if(c&1)
{
tmp=inb_p(SERPORT);
k[i]=tmp;
i++;

}

}while(c&1);


if(tmp==';')
{

for(j=0;j<i;j++)
printk("%c",k[j]);

if(k[1]=='G')
{
x=k[2]-48;
if(k[3]!=',')
{
x*=10;
x+=k[3]-48;
y=k[5]-48;
if(k[6]!=';')
{
y*=10;
y+=k[6]-48;
}
}
else
{
y=k[4]-48;
if(k[5]!=';')
{
y*=10;
y+=k[5]-48;
}
}

}// 'G'


i=0;
printk("\n");
printk("X:%d Y:%d\n",x,y);
}



// read Line Status Register & Modem Status Register to ACK IRQ
//tmp = inb_p( SERPORT + 5);
//tmp = inb_p( SERPORT + 6);
return IRQ_HANDLED;
}


Now i have the koordinates in X and Y (integer values)in the KERNEL SPACE


The BIG QUESTION is :

HOW TO SEND THESE KOORDINATES TO X server or GPM ?????



Many Thanks ...

Last edited by myrmidon; 10-29-2007 at 04:59 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bus Mouse or Serial Mouse rsankar Linux - Hardware 2 10-30-2007 04:57 AM
Problems with riva driver (Frame Buffer)? binarybob0001 Linux - General 10 11-25-2005 03:53 AM
serial mouse driver for 2.6 kernel ??? pingu_penguin Linux - Software 5 03-07-2005 08:04 AM
XF86Config: how to avoid black frame : Suse 8.2 + new nvidia driver muellla Linux - Laptop and Netbook 3 08-09-2003 10:21 AM
Frame buffer driver for intel 810 chipset.. suriyamohan Linux - Hardware 1 04-17-2003 02:55 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration