This is the mail archive of the insight@sources.redhat.com mailing list for the Insight project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] increase number of com ports on windows


Theoretically this patch will remove the hard-coded limit of 9 com ports
recognized by Insight on windows.  I don't know how to get a list of
valid ports, so the new code just keeps incrementing the port number and
trying to open the port until an open fails. If anyone has more than 4
serial ports, I would appreciate it if you would test this.

2003-02-03  Martin M. Hunt  <hunt@redhat.com>

	* library/targetselection.itb (TargetSelection::port_list): Keep
	checking ports on Windows until we can open no more. Replaces
	fixed limit of 9.



Index: library/targetselection.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/targetselection.itb,v
retrieving revision 1.12
diff -u -r1.12 targetselection.itb
--- library/targetselection.itb	15 Oct 2002 21:19:51 -0000	1.12
+++ library/targetselection.itb	4 Feb 2003 07:19:41 -0000
@@ -877,12 +877,16 @@
   # which is OK because we may be using it or the user
   # may be setting up the remote target manually with
   # a terminal program.
-  for {set i 1} {$i < 9} { incr i} {
+  set quit 0
+  for {set i 1} {!$quit} {incr i} {
     if {[catch { set fd [::open COM$i: RDWR] } msg]} {
       # Failed.  Find out why.
       if {[string first "permission denied" $msg] != -1} {
 	# Port is there, but busy right now. That's OK.
 	lappend plist com$i
+      } elseif {$i > 4} {
+	# if we've scanned the first 4 ports, then quit when we find no more 
+	set quit 1
       }
     } else {
       # We got it.  Now close it and add to list.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]