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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://ilug-cochin.org/pipermail/mailinglist_ilug-cochin.org/attachments/20060321/19aadf9d/attachment.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: circuit.gif
Type: image/gif
Size: 11362 bytes
Desc: not available
Url :
http://ilug-cochin.org/pipermail/mailinglist_ilug-cochin.org/attachments/20060321/19aadf9d/circuit.gif