387
418
else if(osName.toLowerCase().indexOf("windows") != -1 )
389
/* //./name is supposed to work for port numbers > 8 */
420
String[] temp = new String[259];
421
for( int i = 1; i <= 256; i++ )
423
temp[i - 1] = new String( "COM" + i );
425
for( int i = 1; i <= 3; i++ )
427
temp[i + 255] = new String( "LPT" + i );
429
CandidateDeviceNames=temp;
431
else if ( osName.equals("Solaris") || osName.equals("SunOS"))
433
/* Solaris uses a few different ways to identify ports.
434
They could be /dev/term/a /dev/term0 /dev/cua/a /dev/cuaa
435
the /dev/???/a appears to be on more systems.
437
The uucp lock files should not cause problems.
440
File dev = new File( "/dev/term" );
441
String deva[] = dev.list();
442
dev = new File( "/dev/cua" );
443
String devb[] = dev.list();
444
String[] temp = new String[ deva.length + devb.length ];
445
for(int j =0;j<deva.length;j++)
446
deva[j] = "term/" + deva[j];
447
for(int j =0;j<devb.length;j++)
448
devb[j] = "cua/" + devb[j];
449
System.arraycopy( deva, 0, temp, 0, deva.length );
450
System.arraycopy( devb, 0, temp,
451
deva.length, devb.length );
453
for( int j = 0; j< temp.length;j++)
454
System.out.println( temp[j] );
456
CandidateDeviceNames=temp;
391
{ "//./COM1", "//./COM2", "//./COM3",
392
"//./COM4", "//./COM5", "//./COM6",
393
"//./COM7", "//./COM8" };
461
ok.. Look the the dirctories representing the port
462
kernel driver interface.
464
If there are entries there are possibly ports we can
465
use and need to enumerate.
396
{ "COM1", "COM2","COM3","COM4",
397
"COM5", "COM6", "COM7", "COM8" };
398
CandidateDeviceNames=temp;
400
else if ( osName.equals("Solaris") || osName.equals("SunOS"))
402
/* Solaris uses a few different ways to identify ports.
403
They could be /dev/term/a /dev/term0 /dev/cua/a /dev/cuaa
404
the /dev/???/a appears to be on more systems.
406
The uucp lock files should not cause problems.
409
File dev = new File( "/dev/term" );
410
String deva[] = dev.list();
411
dev = new File( "/dev/cua" );
412
String devb[] = dev.list();
413
String[] temp = new String[ deva.length + devb.length ];
414
for(int j =0;j<deva.length;j++)
415
deva[j] = "term/" + deva[j];
416
for(int j =0;j<devb.length;j++)
417
devb[j] = "cua/" + devb[j];
418
System.arraycopy( deva, 0, temp, 0, deva.length );
419
System.arraycopy( devb, 0, temp,
420
deva.length, devb.length );
422
for( int j = 0; j< temp.length;j++)
423
System.out.println( temp[j] );
425
CandidateDeviceNames=temp;
430
ok.. Look the the dirctories representing the port
431
kernel driver interface.
433
If there are entries there are possibly ports we can
434
use and need to enumerate.
437
String term[] = new String[2];
441
dev = new File( "/dev/term" );
442
if( dev.list().length > 0 );
443
term[l++] = new String( "term/" );
445
dev = new File( "/dev/cua0" );
446
if( dev.list().length > 0 );
447
term[l++] = new String( "cua/" );
449
String[] temp = new String[l];
452
CandidateDeviceNames=temp;
456
File dev = new File( deviceDirectory );
457
String[] temp = dev.list();
458
CandidateDeviceNames=temp;
460
if (CandidateDeviceNames==null)
463
System.out.println("RXTXCommDriver:registerScannedPorts() no Device files to check ");
467
String CandidatePortPrefixes[] = {};
469
case CommPortIdentifier.PORT_SERIAL:
468
String term[] = new String[2];
472
dev = new File( "/dev/term" );
473
if( dev.list().length > 0 );
474
term[l++] = new String( "term/" );
476
dev = new File( "/dev/cua0" );
477
if( dev.list().length > 0 );
478
term[l++] = new String( "cua/" );
480
String[] temp = new String[l];
483
CandidateDeviceNames=temp;
487
File dev = new File( deviceDirectory );
488
String[] temp = dev.list();
489
CandidateDeviceNames=temp;
491
if (CandidateDeviceNames==null)
471
System.out.println("scanning for serial ports for os "+osName);
472
if(osName.equals("Linux"))
475
"ttyS", // linux Serial Ports
476
"ttySA" // for the IPAQs
478
CandidatePortPrefixes=Temp;
480
else if(osName.equals("Linux-all-ports"))
482
/* if you want to enumerate all ports ~5000
483
possible, then replace the above with this
486
"comx", // linux COMMX synchronous serial card
487
"holter", // custom card for heart monitoring
488
"modem", // linux symbolic link to modem.
489
"ttyircomm", // linux IrCommdevices (IrDA serial emu)
490
"ttycosa0c", // linux COSA/SRP synchronous serial card
491
"ttycosa1c", // linux COSA/SRP synchronous serial card
492
"ttyC", // linux cyclades cards
493
"ttyCH",// linux Chase Research AT/PCI-Fast serial card
494
"ttyD", // linux Digiboard serial card
495
"ttyE", // linux Stallion serial card
496
"ttyF", // linux Computone IntelliPort serial card
497
"ttyH", // linux Chase serial card
498
"ttyI", // linux virtual modems
499
"ttyL", // linux SDL RISCom serial card
500
"ttyM", // linux PAM Software's multimodem boards
501
// linux ISI serial card
502
"ttyMX",// linux Moxa Smart IO cards
503
"ttyP", // linux Hayes ESP serial card
504
"ttyR", // linux comtrol cards
505
// linux Specialix RIO serial card
506
"ttyS", // linux Serial Ports
507
"ttySI",// linux SmartIO serial card
508
"ttySR",// linux Specialix RIO serial card 257+
509
"ttyT", // linux Technology Concepts serial card
510
"ttyUSB",//linux USB serial converters
511
"ttyV", // linux Comtrol VS-1000 serial controller
512
"ttyW", // linux specialix cards
513
"ttyX" // linux SpecialX serial card
515
CandidatePortPrefixes=Temp;
517
else if(osName.toLowerCase().indexOf("qnx") != -1 )
522
CandidatePortPrefixes=Temp;
524
else if(osName.equals("Irix"))
527
"ttyc", // irix raw character devices
528
"ttyd", // irix basic serial ports
529
"ttyf", // irix serial ports with hardware flow
530
"ttym", // irix modems
531
"ttyq", // irix pseudo ttys
532
"tty4d",// irix RS422
533
"tty4f",// irix RS422 with HSKo/HSki
534
"midi", // irix serial midi
535
"us" // irix mapped interface
537
CandidatePortPrefixes=Temp;
539
else if(osName.equals("FreeBSD")) //FIXME this is probably wrong
542
"ttyd", //general purpose serial ports
543
"cuaa", //dialout serial ports
544
"ttyA", //Specialix SI/XIO dialin ports
545
"cuaA", //Specialix SI/XIO dialout ports
546
"ttyD", //Digiboard - 16 dialin ports
547
"cuaD", //Digiboard - 16 dialout ports
548
"ttyE", //Stallion EasyIO (stl) dialin ports
549
"cuaE", //Stallion EasyIO (stl) dialout ports
550
"ttyF", //Stallion Brumby (stli) dialin ports
551
"cuaF", //Stallion Brumby (stli) dialout ports
552
"ttyR", //Rocketport dialin ports
553
"cuaR", //Rocketport dialout ports
554
"stl" //Stallion EasyIO board or Brumby N
556
CandidatePortPrefixes=Temp;
558
else if(osName.equals("NetBSD")) // FIXME this is probably wrong
561
"tty0" // netbsd serial ports
563
CandidatePortPrefixes=Temp;
565
else if ( osName.equals("Solaris")
566
|| osName.equals("SunOS"))
572
CandidatePortPrefixes=Temp;
574
else if(osName.equals("HP-UX"))
577
"tty0p",// HP-UX serial ports
578
"tty1p" // HP-UX serial ports
580
CandidatePortPrefixes=Temp;
583
else if(osName.equals("UnixWare") ||
584
osName.equals("OpenUNIX"))
587
"tty00s", // UW7/OU8 serial ports
592
CandidatePortPrefixes=Temp;
595
else if (osName.equals("OpenServer"))
598
"tty1A", // OSR5 serial ports
614
"ttyu1A", // OSR5 USB-serial ports
631
CandidatePortPrefixes=Temp;
633
else if (osName.equals("Compaq's Digital UNIX") || osName.equals("OSF1"))
636
"tty0" // Digital Unix serial ports
638
CandidatePortPrefixes=Temp;
641
else if(osName.equals("BeOS"))
644
"serial" // BeOS serial ports
646
CandidatePortPrefixes=Temp;
648
else if(osName.equals("Mac OS X"))
651
// Keyspan USA-28X adapter, USB port 1
653
// Keyspan USA-28X adapter, USB port 1
655
// Keyspan USA-28X adapter, USB port 2
657
// Keyspan USA-28X adapter, USB port 2
659
// Keyspan USA-19 adapter
661
// Keyspan USA-19 adapter
664
CandidatePortPrefixes=Temp;
666
else if(osName.toLowerCase().indexOf("windows") != -1 )
669
"COM" // win32 serial ports
494
System.out.println("RXTXCommDriver:registerScannedPorts() no Device files to check ");
498
String CandidatePortPrefixes[] = {};
500
case CommPortIdentifier.PORT_SERIAL:
502
System.out.println("scanning for serial ports for os "+osName);
505
/* There are _many_ possible ports that can be used
506
on Linux. See below in the fake Linux-all-ports
507
case for a list. You may add additional ports
508
here but be warned that too many will significantly
509
slow down port enumeration. Linux 2.6 has udev
510
support which should be faster as only ports the
511
kernel finds should be exposed in /dev
513
See also how to override port enumeration and
514
specifying port in INSTALL.
519
if(osName.equals("Linux"))
522
"ttyS", // linux Serial Ports
523
"ttySA", // for the IPAQs
524
"ttyUSB" // for USB frobs
526
CandidatePortPrefixes=Temp;
528
else if(osName.equals("Linux-all-ports"))
530
/* if you want to enumerate all ports ~5000
531
possible, then replace the above with this
534
"comx", // linux COMMX synchronous serial card
535
"holter", // custom card for heart monitoring
536
"modem", // linux symbolic link to modem.
537
"rfcomm", // bluetooth serial device
538
"ttyircomm", // linux IrCommdevices (IrDA serial emu)
539
"ttycosa0c", // linux COSA/SRP synchronous serial card
540
"ttycosa1c", // linux COSA/SRP synchronous serial card
541
"ttyC", // linux cyclades cards
542
"ttyCH",// linux Chase Research AT/PCI-Fast serial card
543
"ttyD", // linux Digiboard serial card
544
"ttyE", // linux Stallion serial card
545
"ttyF", // linux Computone IntelliPort serial card
546
"ttyH", // linux Chase serial card
547
"ttyI", // linux virtual modems
548
"ttyL", // linux SDL RISCom serial card
549
"ttyM", // linux PAM Software's multimodem boards
550
// linux ISI serial card
551
"ttyMX",// linux Moxa Smart IO cards
552
"ttyP", // linux Hayes ESP serial card
553
"ttyR", // linux comtrol cards
554
// linux Specialix RIO serial card
555
"ttyS", // linux Serial Ports
556
"ttySI",// linux SmartIO serial card
557
"ttySR",// linux Specialix RIO serial card 257+
558
"ttyT", // linux Technology Concepts serial card
559
"ttyUSB",//linux USB serial converters
560
"ttyV", // linux Comtrol VS-1000 serial controller
561
"ttyW", // linux specialix cards
562
"ttyX" // linux SpecialX serial card
564
CandidatePortPrefixes=Temp;
566
else if(osName.toLowerCase().indexOf("qnx") != -1 )
571
CandidatePortPrefixes=Temp;
573
else if(osName.equals("Irix"))
576
"ttyc", // irix raw character devices
577
"ttyd", // irix basic serial ports
578
"ttyf", // irix serial ports with hardware flow
579
"ttym", // irix modems
580
"ttyq", // irix pseudo ttys
581
"tty4d",// irix RS422
582
"tty4f",// irix RS422 with HSKo/HSki
583
"midi", // irix serial midi
584
"us" // irix mapped interface
586
CandidatePortPrefixes=Temp;
588
else if(osName.equals("FreeBSD")) //FIXME this is probably wrong
591
"ttyd", //general purpose serial ports
592
"cuaa", //dialout serial ports
593
"ttyA", //Specialix SI/XIO dialin ports
594
"cuaA", //Specialix SI/XIO dialout ports
595
"ttyD", //Digiboard - 16 dialin ports
596
"cuaD", //Digiboard - 16 dialout ports
597
"ttyE", //Stallion EasyIO (stl) dialin ports
598
"cuaE", //Stallion EasyIO (stl) dialout ports
599
"ttyF", //Stallion Brumby (stli) dialin ports
600
"cuaF", //Stallion Brumby (stli) dialout ports
601
"ttyR", //Rocketport dialin ports
602
"cuaR", //Rocketport dialout ports
603
"stl" //Stallion EasyIO board or Brumby N
605
CandidatePortPrefixes=Temp;
607
else if(osName.equals("NetBSD")) // FIXME this is probably wrong
610
"tty0" // netbsd serial ports
612
CandidatePortPrefixes=Temp;
614
else if ( osName.equals("Solaris")
615
|| osName.equals("SunOS"))
621
CandidatePortPrefixes=Temp;
623
else if(osName.equals("HP-UX"))
626
"tty0p",// HP-UX serial ports
627
"tty1p" // HP-UX serial ports
629
CandidatePortPrefixes=Temp;
632
else if(osName.equals("UnixWare") ||
633
osName.equals("OpenUNIX"))
636
"tty00s", // UW7/OU8 serial ports
641
CandidatePortPrefixes=Temp;
644
else if (osName.equals("OpenServer"))
647
"tty1A", // OSR5 serial ports
663
"ttyu1A", // OSR5 USB-serial ports
680
CandidatePortPrefixes=Temp;
682
else if (osName.equals("Compaq's Digital UNIX") || osName.equals("OSF1"))
685
"tty0" // Digital Unix serial ports
687
CandidatePortPrefixes=Temp;
690
else if(osName.equals("BeOS"))
693
"serial" // BeOS serial ports
695
CandidatePortPrefixes=Temp;
697
else if(osName.equals("Mac OS X"))
700
// Keyspan USA-28X adapter, USB port 1
702
// Keyspan USA-28X adapter, USB port 1
704
// Keyspan USA-28X adapter, USB port 2
706
// Keyspan USA-28X adapter, USB port 2
708
// Keyspan USA-19 adapter
710
// Keyspan USA-19 adapter
713
CandidatePortPrefixes=Temp;
715
else if(osName.toLowerCase().indexOf("windows") != -1 )
718
"COM" // win32 serial ports
719
//"//./COM" // win32 serial ports
671
721
CandidatePortPrefixes=Temp;