From df4576d14d685facf170f8e0d7aec9ce3e92e66c Mon Sep 17 00:00:00 2001
From: "Brian S. Dean" <bsd@bsdhome.com>
Date: Sat, 7 Dec 2002 15:16:24 +0000
Subject: [PATCH] If the stk500 is being used, default to using the first
 serial port.

git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk@167 81a1dc3b-b13d-400b-aceb-764788c761c2
---
 avrdude/avrdude.1 | 16 +++++++++-------
 avrdude/main.c    |  5 +++++
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/avrdude/avrdude.1 b/avrdude/avrdude.1
index 39cefadc..40df169f 100644
--- a/avrdude/avrdude.1
+++ b/avrdude/avrdude.1
@@ -45,7 +45,7 @@
 .Op Fl m Ar memtype
 .Op Fl o Ar filename
 .Op Fl n
-.Op Fl P Ar parallel
+.Op Fl P Ar port
 .Op Fl t
 .Op Fl v
 .Op Fl V
@@ -298,12 +298,14 @@ to write to
 .It Fl P Ar port
 Use
 .Ar port
-as the
-.Xr ppi 4
-device to communicate with, instead of the default
-.Pa /dev/ppi0 .
-If you are using the STK500 programmer, use this option to specify
-which serial port to use.
+to identify the device to which the programmer is attached.  By
+default the
+.Pa /dev/ppi0
+port is used, but if the programmer type normally connects to the
+serial port, the
+.Pa /dev/cuaa0
+port is the default.  If you need to use a different parallel or
+serial port, use this option to specify the alternate port name.
 .It Fl t
 Tells
 .Nm
diff --git a/avrdude/main.c b/avrdude/main.c
index 00afc71d..68d0c333 100644
--- a/avrdude/main.c
+++ b/avrdude/main.c
@@ -515,6 +515,11 @@ int main(int argc, char * argv [])
     switch (ch) {
       case 'c': /* pin configuration */
         pinconfig = optarg;
+        if (strcmp(pinconfig, "stk500") == 0) {
+          if (port == DEFAULT_PARALLEL) {
+            port = DEFAULT_SERIAL;
+          }
+        }
         break;
 
       case 'C': /* pin configuration file */