The circuit that you have used(the one from the lirc site) works on their 
driver. Just had a glance at their 
driver(/lirc-0.8.0/drivers/lirc_serial/lirc_serial.c).  The comment says 
explicitly :
 
 *
 * lirc_serial - Device driver that records pulse- and pause-lengths
 *               (space-lengths) between DDCD event on a serial port.
 *
 
 the read syscall, that you are trying to use in your user space pgm, on 
/dev/ttys0 reads only data that are there on the registers related with pin 
2(RXD).   This is my idea, the dcd pin is basically for connecting devices like 
modem's.  To get a clear idea refer serial programming guide for POSIX 
operating systems:
 
 http://www.easysw.com/~mike/serial/serial.html#3_1_3
 
 comming back to lirc_serial.c the driver from lirc.org, it is using the rdtsc 
instruction to do its work(read that from comments). 
 
 from the around half an hour i spend on your problem i think the reception 
mechanism is working not by reading some data, but by measuing pulse lengths on 
the dcd.  and that reading is originally being done by lirc_serial.c kernel 
driver.   
 
 So for your user level program to work you nead to replicate that 
functionality in your code. 
 
 Justin
 
  
 
 
 thoma <arunthomas007 at gmail.com> wrote: Hi,
 The project is to control a media player using a remote control. i can make 
the media player. The problem is the receiver code.
  i made a receiver as shown in the www.lirc.org website. The circuit diagram 
is attached with this mail.  i am using an LG remote control.
  The whole thing is working using LIRC software. But i want to write my own 
program and dont want to write a driver, since it is too hard.
  So the program should be able to read data(signals) from the serial port.
  The code i have written is as follows.
  
        
#include <stdio.h>   /* Standard input/output definitions */
#include <
string.h>  /* String function definitions */
#include <unistd.h>  
/* UNIX standard function definitions */
#include <fcntl.h>   /* File control definitions */

#include <errno.h>   /* Error number definitions */
#include <termios.h> 
/* POSIX terminal control definitions */ 
main()
{
  //struct termios ts;
  char buff[1000]=
"";
  int fd;
  int nbytes=0;

  fd = open(
"/dev/ttyS0", O_RDONLY | O_NOCTTY | O_NDELAY);
  if (fd == -1)
  {
   perror("open_port: Unable to open /dev/ttyS0 - "
);
  }
  else
  {
   write(1,"starting",8); 

  
 fcntl(fd, F_SETFL, 0);
   nbytes=read(fd,buff,sizeof(buff));

   write(1
,"\nThe signal from serial port is 
\n
",33);
   write(1,buff,nbytes);
   write(
1,"\n",
1);

  }
}

 The program works with my serial mouse. But when i connect the receiver 
circuit, it simply waits for the signals.  i just want to get different signals 
from different buttons in the remote.
  Is there any other problem with the code. .
  i tried python also. Still not getting any output. 
  
  hope u will reply soon. 
  
  Thank You,
  Arun Thomas
  Model Engineering College
  Cochin  - Show quoted text -
 

On 3/20/06, Raj Shaz <rajshas at gmail.com> wrote: well im not sure wot do u 
mean by open("/dev/ttyS0", O_RDONLY)
which is these codes?
See, serial programming can be done in trillion ways. Everone will
tell his/her own views` ... take one and chuck others ... but all lead 
more or less in same way.

anyway i prefer python . since it work as if ur working on a file ...
open read/write close. simple... and libraries are good.

google ull get ans.

-raj

On 3/19/06, justin joseph < justin_joseph007 at yahoo.com> wrote:
>
>
> --- thoma <arunthomas007 at gmail.com> wrote:
>
> > Hi, 
> >
> >
> > i used
> > open("/dev/ttyS0", O_RDONLY)
> >  method. but i am not able to receive the signals.
> > But if my serial mouse is connected, i can read from 
> > ttyS0.
> > is there any other method
>
> You can use inb, outb combination to read and write
> from the serial port.  I think that will give you more
> control over the port. The below link might give you 
> some idea.
>
> http://linuxgazette.net/issue99/misc/pramode/recv.txt
>
>
> > proper device driver for
> > the serial port. 
> > Plz help me. Its urgent
> > > _______________________________________________
> > Mailinglist mailing list



 _______________________________________________
Mailinglist mailing list
Mailinglist at ilug-cochin.org
http://ilug-cochin.org/mailman/listinfo/mailinglist_ilug-cochin.org



                
---------------------------------
 Yahoo! Mail
 Use Photomail to share photos without annoying attachments.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://ilug-cochin.org/pipermail/mailinglist_ilug-cochin.org/attachments/20060321/c428e58b/attachment.htm

Reply via email to