aboutsummaryrefslogtreecommitdiffstats
path: root/identty.py
blob: a2f3f324c90324451a625cd39481683b07d47c0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python

import os

def identify():
   ports=[]
   o=os.popen('cat /proc/tty/driver/usbserial')
   p=o.read()
   q=p.split('\n')
   for i in range(len(q)):
      r=q[i].partition('"')[2].partition('"')[0]
      if len(r):
         ports.append(['/dev/ttyUSB'+str(i-1),r])
   return ports

if __name__=='__main__':
   p=identify()
   for i in p:
      print i[0]+' : '+i[1]