From owner-freebsd-questions Sat Jan 29 13:44:17 2000 Delivered-To: freebsd-questions@freebsd.org Received: from mx2.x-treme.gr (mx2.x-treme.gr [212.120.192.15]) by hub.freebsd.org (Postfix) with ESMTP id 62A7615A9C for ; Sat, 29 Jan 2000 13:43:59 -0800 (PST) (envelope-from keramida@diogenis.ceid.upatras.gr) Received: from hades.hell.gr (pat50.x-treme.gr [212.120.197.242]) by mx2.x-treme.gr (8.9.3/8.9.3/IPNG-ADV-ANTISPAM-0.1) with ESMTP id XAA02126; Sat, 29 Jan 2000 23:43:37 +0200 Received: (from charon@localhost) by hades.hell.gr (8.9.3/8.9.3) id OAA55843; Sat, 29 Jan 2000 14:52:26 +0200 (EET) (envelope-from keramida@diogenis.ceid.upatras.gr) Date: Sat, 29 Jan 2000 14:52:25 +0200 From: Giorgos Keramidas To: courtney@whtz.com Cc: freebsd-questions@freebsd.org Subject: Re: Serial ports in perl Message-ID: <20000129145225.E55491@hades.hell.gr> Reply-To: keramida@ceid.upatras.gr References: <85256874.0059FE6B.00@mail.whtz.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <85256874.0059FE6B.00@mail.whtz.com>; from courtney@whtz.com on Fri, Jan 28, 2000 at 11:22:57AM -0500 X-PGP-Fingerprint: 62 45 D1 C9 26 F9 95 06 D6 21 2A C8 8C 16 C0 8E X-Phone-Number: +30-94-6203692, +30-93-2886457 X-Address: Theodorou Kirinaiou 61, 26334 Patra, Greece Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, Jan 28, 2000 at 11:22:57AM -0500, courtney@whtz.com wrote: > > > Hey everyone- > > Question for the brain trust- > > how would I go about access a serial port in FreeBSD in perl (I.E. I want > to send a string from perl out the serial port...) Like any normal file, open it with open(), read from it with <>, and print to it with print(). What you want to know is the name of the serial port to open each time. Serial ports in BSD are named /dev/cuaa? so the following piece sends a small string to the first serial port (COM1, as MS-Dog users know it). open(MODEM, ">/dev/cuaa0") || die "could not open modem device"; print MODEM "at\015"; close MODEM; -- Giorgos Keramidas, < keramida @ ceid . upatras . gr > "Don't let your schooling interfere with your education." [Mark Twain] To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message