From owner-freebsd-questions@FreeBSD.ORG Wed Dec 3 20:15:42 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7FEC116A4CF for ; Wed, 3 Dec 2003 20:15:42 -0800 (PST) Received: from ms-smtp-02-eri0.southeast.rr.com (ms-smtp-02-lbl.southeast.rr.com [24.25.9.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id D87DA43FE9 for ; Wed, 3 Dec 2003 20:15:37 -0800 (PST) (envelope-from wegster@mindcore.net) Received: from mindcore.net (rdu163-100-105.nc.rr.com [24.163.100.105]) hB44FYav023332; Wed, 3 Dec 2003 23:15:35 -0500 (EST) Message-ID: <3FCEDE1B.5030207@mindcore.net> Date: Thu, 04 Dec 2003 02:11:23 -0500 From: Scott W User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007 X-Accept-Language: en-us, en MIME-Version: 1.0 To: francois@montefiore.ulg.ac.be References: <3FC23FE2.5010101@run.montefiore.ulg.ac.be> In-Reply-To: <3FC23FE2.5010101@run.montefiore.ulg.ac.be> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: Symantec AntiVirus Scan Engine cc: questions@FreeBSD.org Subject: Re: serial port programming X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2003 04:15:42 -0000 This may not help much, but I've done some serial port development in the past, across a fair number of *nix platforms. Regardless of 'what should happen,' aside from Linux and Solaris, other variants were just that- this unfortunately is from memory (from a WHILE back on this project), but each OS(Solaris 2.5.1/6/7/8, Linux(RH6.3-7.X), HPUX (10.20/11.X), Irix(agh!) etc all had specific settings, both in opening the file descriptor for the port, as well as in the flags being set in the termios structure. There's a generic Serial Programming FAQ, but dated, at http://www.stokely.com/unix.serial.port.resources/tutorials.html Also see: http://www.easysw.com/~mike/serial/ (a bit more up to date), but the problems I ran into were generally similar to what you seem to be describing- the port seeming to be in an incorrect or unknown state, regardless of the 'standard' way of doing things. Ultimately, I wound up comparing the initial open(), initialization strings via write(), and the termios struct settings to known WORKING code on the problem platforms, #def'fed the hell out of the code, and got most of it working. In this case you should be OK grabbing the source to minicom and doing the same.... I may be missing something obvious in my memory here, but after that one I had no further desire to do serial port/modem coding for quite a while ;-) (And God help me, HP developer support was almost as bad as M$!) Scott Jean-Marc Francois wrote: > Sir, > > > I've posted this question on a newsgroup, but got no response. > Is there a cuaa-guru out there ? :-) > > Thanks ! > Jean-Marc Francois > Université de Liège > > --------------- > I got a strange problem. > > I want to send a binary string to a small device I made via /dev/cuaa0. > The port settings should be 19200, 8N1 (no RTS/CTS, no XON/XOFF). > Looks simple. > > I've written a small program using the standard POSIX API : tcgetattr > and the like. > > When I launch my program, it doesn't work (well, it works with Linux > but not with FreeBSD). > If I first launch minicom (and ask it to setup the serial port), let > it in the > background and launch my program, it works. > > The problem is that the dump of the 'stuct termios' my program is > using with or without > minicom is the same, so that's not the problem (stty -f /dev/cuaa0 > gives the same output > also). > > I thought all the serial settings were in this structure; where am I > wrong ? > > > Thank if you can help (if you can't, thanks for reading anyway :-) ), > JM > > --- > #> stty -f /dev/cuaa0 > speed 19200 baud; > lflags: -icanon -isig -iexten -echo > iflags: -icrnl -ixon -ixany -imaxbel ignbrk -brkint > oflags: -opost -onlcr -oxtabs > cflags: cs8 -parenb clocal > time > 5 > > --- > Dump of struct termios : > > c_iflag : 0x1 > c_oflag : 0x0 > c_cflag : 0xcb00 > c_lflag : 0x0 > c_cc[0] : 0x4 > c_cc[1] : 0xff > c_cc[2] : 0xff > c_cc[3] : 0x7f > c_cc[4] : 0x17 > c_cc[5] : 0x15 > c_cc[6] : 0x12 > c_cc[7] : 0x8 > c_cc[8] : 0x3 > c_cc[9] : 0x1c > c_cc[10] : 0x1a > c_cc[11] : 0x19 > c_cc[12] : 0x11 > c_cc[13] : 0x13 > c_cc[14] : 0x16 > c_cc[15] : 0xf > c_cc[16] : 0x1 > c_cc[17] : 0x5 > c_cc[18] : 0x14 > c_cc[19] : 0xff > c_ispeed : 0x4b00 > c_ospeed : 0x4b00 > > --- > --------------- > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscribe@freebsd.org" >