NetBSD Problem Report #33887
From luc@fnet.fr Sat Jul 1 15:05:08 2006
Return-Path: <luc@fnet.fr>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by narn.NetBSD.org (Postfix) with ESMTP id 9386263B8ED
for <gnats-bugs@gnats.NetBSD.org>; Sat, 1 Jul 2006 15:05:08 +0000 (UTC)
Message-Id: <20060701150504.GA18276@indus.fnet.fr>
Date: Sat, 1 Jul 2006 17:05:05 +0200
From: luc@pbox.org
Reply-To: luc@pbox.org
To: gnats-bugs@NetBSD.org
Cc: luc@pbox.org
Subject: pkg open2300 need O_NONBLOCK on open
X-Send-Pr-Version: 3.95
>Number: 33887
>Category: pkg
>Synopsis: pkg open2300 need O_NONBLOCK on open
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: martin
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Jul 01 15:10:00 +0000 2006
>Last-Modified: Tue Jul 04 10:45:01 +0000 2006
>Originator: Luc Beurton
>Release: NetBSD 3.99.7
>Organization:
>Environment:
System: NetBSD iz-bushka 3.0.0_STABLE NetBSD 3.0.0_STABLE (GENERIC) #0: Tue Feb
21 06:56:59 UTC 2006 riz@faith.netbsd.org:/home/builds/ab/netbsd-3-0/sparc64/200
602200000Z-obj/home/builds/ab/netbsd-3-0/src/sys/arch/sparc64/compile/GENERIC sp
arc64
Architecture: sparc64
Machine: sparc64
>Description:
open2300 doesn't work on sparc/sparc64, but it works fine on i386
On debug we could see that it's waiting when opening device.
In tip.c I read this:
/*
* Direct connections with no carrier require using O_NONBLOCK on
* open, but we don't want to keep O_NONBLOCK after open because it
* will cause busy waits.
*/
So I try this code, and now it's work :)
>How-To-Repeat:
Just try to use open2300 on sparc/sparc64
>Fix:
A simple drag&drop from tip.c, I use it with open2300-1.10 too
--- linux2300.c.orig 2004-11-13 13:02:12.000000000 +0100
+++ linux2300.c 2006-07-01 16:40:21.000000000 +0200
@@ -14,6 +14,7 @@
#define DEBUG 0
#include <errno.h>
+#include <fcntl.h>
#include "rw2300.h"
/********************************************************************
@@ -29,13 +30,20 @@
WEATHERSTATION ws2300;
struct termios adtio;
int portstatus;
+ int fcarg;
//Setup serial port
- if ((ws2300 = open(device, O_RDWR | O_NOCTTY)) < 0)
+ if ((ws2300 = open(device, O_RDWR | O_NOCTTY | O_NONBLOCK )) < 0)
{
printf("\nUnable to open serial device %s\n", device);
- exit(0);
+ exit(EXIT_FAILURE);
+ }
+
+ if ((fcarg = fcntl(ws2300, F_GETFL, 0)) < 0 ||
+ fcntl(ws2300, F_SETFL, fcarg & ~O_NONBLOCK) < 0) {
+ printf("\nCan't clear O_NONBLOCK: %s\n", device);
+ exit(EXIT_FAILURE);
}
tcgetattr(ws2300, &adtio);
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: pkg-manager->martin
Responsible-Changed-By: cube@netbsd.org
Responsible-Changed-When: Tue, 04 Jul 2006 00:19:42 +0000
Responsible-Changed-Why:
martin is the maintainer, as well as one of the local sparc64 wizard.
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/33887 (pkg open2300 need O_NONBLOCK on open)
Date: Tue, 4 Jul 2006 12:22:39 +0200
Can you try, without your patch, an entry in /etc/ttys like this:
ttya "/usr/libexec/getty std.9600" sun off local softcar
This should make it work too.
Your patch is correct, I'll talk to the upstream maintainer. This is not
sparc64 specific, btw.
Martin
From: Luc Beurton <luc@pbox.org>
To: gnats-bugs@NetBSD.org
Cc: martin@NetBSD.org, gnats-admin@NetBSD.org,
pkgsrc-bugs@NetBSD.org, luc@pbox.org
Subject: Re: pkg/33887 (pkg open2300 need O_NONBLOCK on open)
Date: Tue, 4 Jul 2006 12:43:58 +0200
On Tue, Jul 04, 2006 at 10:25:02AM +0000, Martin Husemann wrote:
| The following reply was made to PR pkg/33887; it has been noted by GNATS.
|
| From: Martin Husemann <martin@duskware.de>
| To: gnats-bugs@NetBSD.org
| Cc:
| Subject: Re: pkg/33887 (pkg open2300 need O_NONBLOCK on open)
| Date: Tue, 4 Jul 2006 12:22:39 +0200
|
| Can you try, without your patch, an entry in /etc/ttys like this:
|
| ttya "/usr/libexec/getty std.9600" sun off local softcar
|
| This should make it work too.
Yes, it works fine with "softcar"
| Your patch is correct, I'll talk to the upstream maintainer. This is not
| sparc64 specific, btw.
Thanks,
Luc.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.