From owner-freebsd-questions@FreeBSD.ORG Sun Sep 3 17:24:09 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org 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 83FE916A4DA for ; Sun, 3 Sep 2006 17:24:09 +0000 (UTC) (envelope-from bug2bug@bug2bug.tk) Received: from ns.vega-int.ru (ns.vega-int.ru [62.148.228.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0BAE343D45 for ; Sun, 3 Sep 2006 17:24:08 +0000 (GMT) (envelope-from bug2bug@bug2bug.tk) Received: from localhost (localhost.localdomain [127.0.0.1]) by ns.vega-int.ru (Postfix) with ESMTP id EDC01100048 for ; Sun, 3 Sep 2006 23:24:06 +0600 (YEKST) Received: from ns.vega-int.ru ([127.0.0.1]) by localhost (ns [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 23976-05 for ; Sun, 3 Sep 2006 23:24:03 +0600 (YEKST) Received: from [172.17.12.179] (unknown [172.17.12.179]) by ns.vega-int.ru (Postfix) with ESMTP id 83D5B100043 for ; Sun, 3 Sep 2006 23:24:03 +0600 (YEKST) From: =?koi8-r?b?88XSx8XKIPPPwsvP?= To: freebsd-questions@freebsd.org Date: Sun, 3 Sep 2006 23:26:04 +0600 User-Agent: KMail/1.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200609032326.05071.bug2bug@bug2bug.tk> X-Virus-Scanned: by amavisd-new at vega-int.ru Subject: A question about programming RS-232 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Sep 2006 17:24:09 -0000 Hello. I have a question I can't deal myself. And nobody can help me in resolving my problem. Problem: I have a hand-made device, I want to control from FreeBSD 6.1 (I am porting this application from Windows equivalent). But I don't know, in what device /dev/ I should write to get reults. I tryed to write bytes into /dev/ttyd0, /dev/cuad0, but got nothing. :( Code: #include #include #include #include int main(void) { int t = 0, num = 10, fd, i, iOut; char *ch; struct termios my_termios; ch = (char *)malloc(6); memset(ch, 250, 6); fd = open("/dev/ttyd0", O_RDWR | O_NONBLOCK); printf("Opened com port\n"); if(fd < 0) return 0; // tcflush(fd, TCIFLUSH); my_termios.c_cflag = CS8 | CLOCAL; if(cfsetspeed(&my_termios, B9600) < 0) return 0; if(tcsetattr(fd, TCSANOW, &my_termios) < 0) return 0; iOut = write(fd, ch, 6); if(iOut < 0) return 0; printf("Number of bytes = %d\n", iOut); printf("Writed %s!\n", ch); close(fd); printf("Closed!\n"); return 0; } P.S. Please, help me. P.P.S. Sorry for such stupid and annoying questions P.P.P.S. Sorry for my bad English as I'm from Russia and I'm only 16 ;)