def _findRaven(self): """Searches across all USB ports and returns a list of all RAVEn device. """ result = [device for device in comports() if device.pid == RAVEN_PID and device.vid == RAVEN_VID] return result
def port_finder(self): rospy.loginfo("port_finder") ports = list(list_ports_linux.comports()) for port in ports: if port[1] == 'FT232R USB UART': return port else: return None
def port_finder(self): rospy.loginfo("port_finder") ports = list(list_ports_linux.comports()) for port in ports: if port[1]=='FT232R USB UART': return port else: return None
def port_finder(self,trigger): ports = list(list_ports_linux.comports()) for port in ports: if port[1]=='port_ID' or port[1]=='port_name':#根据具体情况定义 trigger = True rospy.loginfo( 'rplidar connect on port: %s'%port[0]) return [port,trigger] else: port=[] return[port,trigger]
def port_finder(self,thread): ports = list(list_ports_linux.comports()) for port in ports: if port[1]=='CJ9011A': thread = True rospy.loginfo( 'rplidar connect on port: %s'%port[0]) return [port,thread] else: port=[] return[port,thread]
def port_finder(self,trigger): ports = list(list_ports_linux.comports()) for port in ports: if port[1]=='CJ9011A' or port[1]=='CP2102 USB to UART Bridge Controller': trigger = True rospy.loginfo( 'rplidar connect on port: %s'%port[0]) return [port,trigger] else: port=[] return[port,trigger]
"""scan for available ports. return a list of device names.""" devices = glob.glob('/dev/tty*c') return [(d, d, d) for d in devices] elif plat[:3] == 'aix': # AIX def comports(): """scan for available ports. return a list of device names.""" devices = glob.glob('/dev/tty*') return [(d, d, d) for d in devices] else: # platform detection has failed... sys.stderr.write("""\ don't know how to enumerate ttys on this system. ! I you know how the serial ports are named send this information to ! the author of this module: sys.platform = %r os.name = %r pySerial version = %s also add the naming scheme of the serial ports and with a bit luck you can get this module running... """ % (sys.platform, os.name, serial.VERSION)) raise ImportError("Sorry: no implementation for your platform ('%s') available" % (os.name,)) # test if __name__ == '__main__': for port, desc, hwid in sorted(comports()): print "%s: %s [%s]" % (port, desc, hwid)
def port_finder(): print "initialization system" ports = list(list_ports_linux.comports()) for port in ports: print '\nUSB number:', port[0] print 'device name:', port[1]