コード例 #1
0
ファイル: list_ports_linux.py プロジェクト: anasallaham/Gudis
def comports(include_links=False):
    devices = glob.glob('/dev/ttyS*')  # built-in serial ports
    devices.extend(glob.glob('/dev/ttyUSB*'))  # usb-serial with own driver
    devices.extend(
        glob.glob('/dev/ttyACM*'))  # usb-serial with CDC-ACM profile
    devices.extend(glob.glob('/dev/ttyAMA*'))  # ARM internal port (raspi)
    devices.extend(glob.glob('/dev/rfcomm*'))  # BT serial devices
    devices.extend(
        glob.glob('/dev/ttyAP*'))  # Advantech multi-port serial controllers
    if include_links:
        devices.extend(list_ports_common.list_links(devices))
    return [
        info for info in [SysFS(d) for d in devices]
        if info.subsystem != "platform"
    ]  # hide non-present internal serial ports
コード例 #2
0
 def comports(include_links=False):
     """scan for available ports. return a list of device names."""
     devices = glob.glob('/dev/tty*')
     if include_links:
         devices.extend(list_ports_common.list_links(devices))
     return [list_ports_common.ListPortInfo(d) for d in devices]
コード例 #3
0
 def comports(include_links=False):
     devices = glob.glob('/dev/cua*[!.init][!.lock]')
     if include_links:
         devices.extend(list_ports_common.list_links(devices))
     return [list_ports_common.ListPortInfo(d) for d in devices]