Это на роутере:
[xxx@router root]$ python3
Python 3.2.2 (default, Feb 18 2012, 11:50:59)
[GCC 4.1.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import serial
>>> from serial.tools.list_ports import comports
>>> comports()
[('/dev/ttyS0', 'ttyS0', 'n/a'), ('/dev/ttyS1', 'ttyS1', 'n/a'), ('/dev/ttyUSB0', '1-1', 'USB VID:PID=0924:4265 SNR=BMA383220903....')]
>>>
Добавлено спустя 17 минут 27 секунд:- Код: Выделить всё • Развернуть
#-------------------------------------------------------------------------------
# Name: ArduComports
# Purpose:
#
# Author: dccharacter
#
# Created: 27.03.2012
# Copyright: (c) dccharacter 2012
# Licence: <your licence>
#-------------------------------------------------------------------------------
#!/usr/bin/env python
import serial
from serial.tools.list_ports import comports
import re
def main():
coms = comports()
print('Looking for Arduinos...')
index = 0
for com, desc, hwid in coms:
if re.search("Arduino", desc):
print("An Arduino is connected to", com, "(", desc, ")")
index = index+1
print('Done searching (', str(index), 'ports checked)')
if __name__ == '__main__':
main()