Mail Archives: cygwin/2005/10/22/00:50:33
trearick_news AT cox DOT net wrote:
> I'm assuming I'm doing something wrong here...and I'm just lucky to have it work right on my laptop...can anyone help?
Your test case does not compile, because you've omitted the #includes
and #defines. I think you will find that posting code that someone can
actually compile and run will get you better help than posting
fragments. Next time just attach the whole file.
Is there anything that differs between your two machines in regard to
what's connected to the com port, or the com port settings? Have to
tried compiling with -Wall to see if there are any warnings that might
indicate you forgot a prototype or used an incorrect parameter?
(Standard troubleshooting stuff..)
> char *outdev = OUTPUT_DEVICE;
What is OUTPUT_DEVICE? You need to use the unix device name
("/dev/ttyS0") and not a DOS/Windows device name ("COM1:").
> outfd = open(outdev,O_RDWR | O_BINARY,S_IREAD | S_IWRITE);
If you're doing serial IO then you probably need calls to tcgetattr()
and tcsetattr() to do things like disable canonical mode, set the baud
rate, data bits, stop bits, flow control, etc. Since the only thing
your program is doing is outputting bytes then most of that probably
doesn't matter, but for a nontrivial program it might.
> len = recv(infd,buf,1,0);
You might as well use read() here if you aren't using the flags.
> write(outfd,buf,len);
It would be good to check the return value of this.
Brian
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -