$NetBSD: patch-ad,v 1.1 2001/08/09 08:49:47 dillo Exp $

--- libsock/unixserial.c.orig	Mon Aug  6 11:39:00 2001
+++ libsock/unixserial.c	Mon Aug  6 11:42:01 2001
@@ -156,6 +156,13 @@
 
 	int i;
 
+	/* Here we need a workaround for NetBSD USB device used with newer
+	   Handspring devices (namely Platinum, Prism and Edge) */
+
+#define maxretries 100
+	int retries;
+	int rc;
+
 #ifndef SGTTY
 	struct termios tcn;
 #else
@@ -166,6 +173,15 @@
 		tty = getenv("PILOTPORT");
 	if (!tty)
 		tty = "<Null>";
+
+	for (retries = 0 ; retries <= maxretries ; retries++ ) {
+	  if ((rc = open(tty, O_RDWR | O_NONBLOCK)) == -1) {
+	    usleep(50000);
+	  } else {
+	    ps->mac->fd = rc;
+	    break;
+	  }
+	}
 
 	if ((ps->mac->fd = open(tty, O_RDWR | O_NONBLOCK)) == -1) {
 		return -1;	/* errno already set */
