case CommPortIdentifier.PORT_I2C: if (debug) System.out.println("scanning for I2C ports for os "+osName); break;  case CommPortIdentifier.PORT_RS485: if (debug) System.out.println("scanning for RS485 ports for os "+osName); break;  case CommPortIdentifier.PORT_RAW: if (debug) System.out.println("scanning for RAW ports for os "+osName); break;
	private void registerScannedPorts(int PortType)	{		String[] CandidateDeviceNames;		if (debug)			System.out.println("scanning device directory "+deviceDirectory+" for ports of type "+PortType);		if(osName.toLowerCase().indexOf("windows") != -1 )		{			String[] temp = { "COM1", "COM2","COM3","COM4" };			CandidateDeviceNames=temp;		}		else		{			File dev = new File( deviceDirectory );			String[] temp = dev.list();			CandidateDeviceNames=temp;		}		if (CandidateDeviceNames==null)		{			if (debug)				System.out.println("RXTXCommDriver:registerScannedPorts() no Device files to check ");			return;		}		String CandidatePortPrefixes[] = {};		switch (PortType) {			case CommPortIdentifier.PORT_SERIAL:				if (debug)					System.out.println("scanning for serial ports for os "+osName);				if(osName.equals("Linux"))				{					String[] Temp = {					"ttyS" // linux Serial Ports					};					CandidatePortPrefixes=Temp;				}				else if(osName.equals("Linux-all-ports"))				{				/* if you want to enumerate all ports ~5000				   possible, then replace the above with this				*/					String[] Temp = {					"comx",      // linux COMMX synchronous serial card					"holter",    // custom card for heart monitoring					"modem",     // linux symbolic link to modem.					"ttyircomm", // linux IrCommdevices (IrDA serial emu)					"ttycosa0c", // linux COSA/SRP synchronous serial card					"ttycosa1c", // linux COSA/SRP synchronous serial card					"ttyC", // linux cyclades cards					"ttyCH",// linux Chase Research AT/PCI-Fast serial card					"ttyD", // linux Digiboard serial card					"ttyE", // linux Stallion serial card					"ttyF", // linux Computone IntelliPort serial card					"ttyH", // linux Chase serial card					"ttyI", // linux virtual modems					"ttyL", // linux SDL RISCom serial card					"ttyM", // linux PAM Software's multimodem boards						// linux ISI serial card					"ttyMX",// linux Moxa Smart IO cards					"ttyP", // linux Hayes ESP serial card					"ttyR", // linux comtrol cards						// linux Specialix RIO serial card					"ttyS", // linux Serial Ports					"ttySI",// linux SmartIO serial card					"ttySR",// linux Specialix RIO serial card 257+					"ttyT", // linux Technology Concepts serial card					"ttyUSB",//linux USB serial converters					"ttyV", // linux Comtrol VS-1000 serial controller					"ttyW", // linux specialix cards					"ttyX"  // linux SpecialX serial card					};					CandidatePortPrefixes=Temp;				}				else if(osName.equals("Irix"))				{					String[] Temp = {						"ttyc", // irix raw character devices						"ttyd", // irix basic serial ports						"ttyf", // irix serial ports with hardware flow						"ttym", // irix modems						"ttyq", // irix pseudo ttys						"tty4d",// irix RS422						"tty4f",// irix RS422 with HSKo/HSki						"midi", // irix serial midi						"us"    // irix mapped interface					};					CandidatePortPrefixes=Temp;				}				else if(osName.equals("FreeBSD")) //FIXME this is probably wrong				{					String[] Temp = {						"cuaa"  // FreeBSD Serial Ports					};					CandidatePortPrefixes=Temp;				}				else if(osName.equals("NetBSD")) // FIXME this is probably wrong				{					String[] Temp = {						"tty0"  // netbsd serial ports					};					CandidatePortPrefixes=Temp;				}				else if(osName.equals("Solaris"))				{					String[] Temp = {						"term",						"cua"					};					CandidatePortPrefixes=Temp;				}				else if(osName.equals("HP-UX"))				{					String[] Temp = {						"tty0p",// HP-UX serial ports						"tty1p" // HP-UX serial ports					};					CandidatePortPrefixes=Temp;				}				else if (osName.equals("Compaq's Digital UNIX"))				{					String[] Temp = {						"tty0"  //  Digital Unix serial ports					};					CandidatePortPrefixes=Temp;				}				else if(osName.equals("BeOS"))				{					String[] Temp = {						"serial" // BeOS serial ports					};					CandidatePortPrefixes=Temp;				}				else if(osName.equals("Mac OS X"))				{					String[] Temp = {					// Keyspan USA-28X adapter, USB port 1						"cu.KeyUSA28X191.",					// Keyspan USA-28X adapter, USB port 1						"tty.KeyUSA28X191.",					// Keyspan USA-28X adapter, USB port 2						"cu.KeyUSA28X181.",					// Keyspan USA-28X adapter, USB port 2						"tty.KeyUSA28X181.",					// Keyspan USA-19 adapter						"cu.KeyUSA19181.",					// Keyspan USA-19 adapter						"tty.KeyUSA19181."					};					CandidatePortPrefixes=Temp;				}				else if(osName.toLowerCase().indexOf("windows") != -1 )				{					String[] Temp = {						"COM"    // win32 serial ports					};					CandidatePortPrefixes=Temp;				}				else				{					if (debug)						System.out.println("No valid prefixes for serial ports have been entered for "+osName + " in RXTXCommDriver.java.  This may just be a typo in the method registerScanPorts().");				}				break;			case CommPortIdentifier.PORT_PARALLEL:				if (debug)					System.out.println("scanning for parallel ports for os "+osName);			/** Get the Parallel port prefixes for the running os			* Holger Lehmann			* July 12, 1999			* IBM			*/				if(osName.equals("Linux")			/*				|| osName.equals("NetBSD") FIXME				|| osName.equals("HP-UX")  FIXME				|| osName.equals("Irix")   FIXME				|| osName.equals("BeOS")   FIXME				|| osName.equals("Compaq's Digital UNIX")   FIXME			*/				)				{					String[] temp={						"lp"    // linux printer port					};					CandidatePortPrefixes=temp;				}				else if(osName.equals("FreeBSD"))				{					String[] temp={						"lpt"					};					CandidatePortPrefixes=temp;				}				else  /* printer support is green */				{					String [] temp={};					CandidatePortPrefixes=temp;				}				break;			case CommPortIdentifier.PORT_I2C:				if (debug)					System.out.println("scanning for I2C ports for os "+osName);				break;			case CommPortIdentifier.PORT_RS485:				if (debug)					System.out.println("scanning for RS485 ports for os "+osName);				break;			case CommPortIdentifier.PORT_RAW:				if (debug)					System.out.println("scanning for RAW ports for os "+osName);				break;			default:				if (debug)					System.out.println("Unknown PortType "+PortType+" passed to RXTXCommDriver.registerScannedPorts()");		}		registerValidPorts(CandidateDeviceNames, CandidatePortPrefixes, PortType);	}