An HTML attachment was scrubbed...
URL:
/pipermail/mailinglist_ilug-cochin.org/attachments/20040701/917d885f/attachment.htm
-------------- next part --------------
hi hashir,
Check the return value of ioctl,use perror() coz errno is set.
u cud read the
howto:->http://www.lafn.org/~dave/linux/Serial-Programming-HOWTO.txt
bimal.
On Sun, 27 Jun 2004 hashir n.a wrote :
>
>Dear ILUG,
>
>OS : FEDORA CORE I
>KERNEL : 2.4.22-1.2115.nptl
>
>I want to use the IOCTL call to control my serial port.
>
>I DID THIS:
>
>---------------------------------------------------
>
>#include<stdio.h>
>#include<sys/ioctl.h>
>#include<sys/types.h>
>#include<fcntl.h>
>
>static int fd=0;
>main()
>{
>int lstate = 0;
>int bitpattern;
>int *ledstate;
>
>fd= open("/dev/ttyS1",O_RDWR | O_NDELAY);
>if (fd < 0) {
>fprintf(stderr, "ERROR: can not open");
> exit(0);
>}
>//all off
>ioctl(fd, TIOCMSET, &lstate);
>
>//off LED
>bitpattern=TIOCM_RTS;
>lstate &= ~bitpattern;
>
>ioctl(fd, TIOCMSET, &lstate);
>while(1)
>{
>ioctl(fd, TIOCMGET, &lstate); //get state of switch
>if (lstate & TIOCM_CAR) {
> printf("PRESSED");
>
>}}
>
>
>
>}
>
>------------------------------------------------
>i hav a LED connctd to RTS pin of serial port..and a switch connected to the
>CAR pin..But nothin seems to work. The LED by default is ON. I tried OFFing
>it( prog above)..but no SUCCESS. I cant read the status of the switch either.
>
>Is this the right way to do it?Is thr somthin I am missing?? Is thr any othr
>way to do this??
>Please Help.
>
>with lots of doubts
>hashir
>-------------------------------------------------------------------------
>Do What U Must not Must U what. *******
>-------------------------------------------------------------------------
>
>_________________________________________________________________
>Looking for something? Cant find it anywhere?
>http://go.msnserver.com/IN/50756.asp Log onto baazee.com
>
>
>_______________________________________________
>Mailinglist mailing list
>[email protected]
>http://mail.ilug-cochin.org/mailman/listinfo/mailinglist_ilug-cochin.org
From [EMAIL PROTECTED] Fri Jul 2 02:01:38 2004
From: [EMAIL PROTECTED] (Sameer Thahir)
Date: Fri Jul 2 02:01:43 2004
Subject: [Mailinglist] Minutes of the meeting of June 2004
Message-ID: <[EMAIL PROTECTED]>
dear ILUG members
thanx jj for putting up the minutes ...
of course if the members can please notice the number of attendees..
anyway,
i think the individuals are forgetting the role of community , the
community which has given them something , they ought to give it back
as jj had highlighted the community aspect of gnu/linux the only way we can
survive is with the community , if we ignore it then we will be doomed ,
... so i think all of us should be working as in the beginning .. towards
the development of the community... the individual sucesses sum to that of
the community's sucess. ..
thanx jj once again for reminding us regarding the community...
i think we can serve our community by ... not only offering services but
also funds....
the funds come from individual developers... we are seeing something like a
cooperative sector environment...
for this we have to take up large projects .... and share our benefits with
the community....
this is the idea that has been remaining from the beginning but not
emphasized...
please think bout it..
i just shared my part of the idea..
please correct me if im wrong..
//////////////////////////
besides we had visited a couple of private and government schools for
spreading general awareness regarding gnu/linux
and got a warm response from them...
i think this would be a boon to the community
hope someone is interested in joining us ...
bye
sameer
_________________________________________________________________
Transfer home loans now! http://go.msnserver.com/IN/51405.asp Home loans
with 7.5% only.