Changeset 301
- Timestamp:
- 10/14/11 02:46:12 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Puzzlebox/Synapse/Interface.py
r300 r301 677 677 ################################################################## 678 678 679 def searchForSerialDevices(self, devices=[]): 680 681 if (sys.platform == 'win32'): 682 683 for portname in self.enumerateSerialPorts(): 684 685 if portname not in _devices: 686 #portname = self.fullPortName(portname) 687 devices.append(portname) 688 689 else: 690 691 if os.path.exists('/dev/ttyUSB0'): 692 devices.append('/dev/ttyUSB0') 693 if os.path.exists('/dev/ttyUSB1'): 694 devices.append('/dev/ttyUSB1') 695 if os.path.exists('/dev/ttyUSB2'): 696 devices.append('/dev/ttyUSB2') 697 if os.path.exists('/dev/ttyUSB3'): 698 devices.append('/dev/ttyUSB3') 699 if os.path.exists('/dev/ttyUSB4'): 700 devices.append('/dev/ttyUSB4') 701 if os.path.exists('/dev/ttyUSB5'): 702 devices.append('/dev/ttyUSB5') 703 if os.path.exists('/dev/ttyUSB6'): 704 devices.append('/dev/ttyUSB6') 705 if os.path.exists('/dev/ttyUSB7'): 706 devices.append('/dev/ttyUSB7') 707 if os.path.exists('/dev/ttyUSB8'): 708 devices.append('/dev/ttyUSB8') 709 if os.path.exists('/dev/ttyUSB9'): 710 devices.append('/dev/ttyUSB9') 711 712 if os.path.exists('/dev/ttyACM0'): 713 devices.append('/dev/ttyACM0') 714 if os.path.exists('/dev/ttyACM1'): 715 devices.append('/dev/ttyACM1') 716 if os.path.exists('/dev/ttyACM2'): 717 devices.append('/dev/ttyACM2') 718 if os.path.exists('/dev/ttyACM3'): 719 devices.append('/dev/ttyACM3') 720 if os.path.exists('/dev/ttyACM4'): 721 devices.append('/dev/ttyACM4') 722 723 724 return(devices) 725 726 727 ################################################################## 728 679 729 def searchForThinkGearDevices(self): 680 730 … … 683 733 #self.pushButtonBluetoothSearch.setText('Searching') 684 734 685 if (sys.platform == 'win32'):735 if (sys.platform != 'win32'): 686 736 687 737 # Bluetooth module doesn't compile properly under WindowsError 688 689 for portname in self.enumerateSerialPorts():690 691 if portname not in thinkgear_devices:692 #portname = self.fullPortName(portname)693 thinkgear_devices.append(portname)694 695 696 else:697 738 698 739 bluetooth_devices = [] … … 720 761 else: 721 762 bluetooth_devices.append(address) 722 723 724 for address in bluetooth_devices: 725 device_name = bluetooth.lookup_name(address) 726 if ((device_name == 'MindSet') and \ 727 (address not in thinkgear_devices)): 728 thinkgear_devices.append(address) 729 730 731 if self.DEBUG > 2: 732 print "Bluetooth MindSet devices found:", 733 print thinkgear_devices 734 735 736 if self.parent == None: 737 self.comboBoxDeviceSelect.clear() 738 else: 739 self.parent.comboBoxDeviceSelect.clear() 740 741 #self.comboBoxDeviceSelect.addItem('ThinkGear Emulator') 742 743 if os.path.exists('/dev/ttyUSB0'): 744 thinkgear_devices.append('/dev/ttyUSB0') 745 if os.path.exists('/dev/ttyUSB1'): 746 thinkgear_devices.append('/dev/ttyUSB1') 747 if os.path.exists('/dev/ttyUSB2'): 748 thinkgear_devices.append('/dev/ttyUSB2') 749 if os.path.exists('/dev/ttyUSB3'): 750 thinkgear_devices.append('/dev/ttyUSB3') 751 if os.path.exists('/dev/ttyUSB4'): 752 thinkgear_devices.append('/dev/ttyUSB4') 753 if os.path.exists('/dev/ttyUSB5'): 754 thinkgear_devices.append('/dev/ttyUSB5') 755 if os.path.exists('/dev/ttyUSB6'): 756 thinkgear_devices.append('/dev/ttyUSB6') 757 if os.path.exists('/dev/ttyUSB7'): 758 thinkgear_devices.append('/dev/ttyUSB7') 759 if os.path.exists('/dev/ttyUSB8'): 760 thinkgear_devices.append('/dev/ttyUSB8') 761 if os.path.exists('/dev/ttyUSB9'): 762 thinkgear_devices.append('/dev/ttyUSB9') 763 764 if os.path.exists('/dev/ttyACM0'): 765 thinkgear_devices.append('/dev/ttyACM0') 766 if os.path.exists('/dev/ttyACM1'): 767 thinkgear_devices.append('/dev/ttyACM1') 768 if os.path.exists('/dev/ttyACM2'): 769 thinkgear_devices.append('/dev/ttyACM2') 770 if os.path.exists('/dev/ttyACM3'): 771 thinkgear_devices.append('/dev/ttyACM3') 772 if os.path.exists('/dev/ttyACM4'): 773 thinkgear_devices.append('/dev/ttyACM4') 763 764 765 for address in bluetooth_devices: 766 device_name = bluetooth.lookup_name(address) 767 if ((device_name == 'MindSet') and \ 768 (address not in thinkgear_devices)): 769 thinkgear_devices.append(address) 770 771 772 if self.DEBUG > 2: 773 print "Bluetooth MindSet devices found:", 774 print thinkgear_devices 775 776 777 thinkgear_devices = self.searchForSerialDevices(thinkgear_devices) 778 774 779 775 780 if self.DEBUG: … … 787 792 devices = self.searchForThinkGearDevices() 788 793 794 #if self.parent == None: 795 #self.comboBoxDeviceSelect.clear() 796 #else: 797 #self.parent.comboBoxDeviceSelect.clear() 798 799 self.comboBoxDeviceSelect.clear() 789 800 devices.insert(0, 'ThinkGear Emulator') 790 801
Note: See TracChangeset
for help on using the changeset viewer.