diff options
Diffstat (limited to 'identty.py')
-rwxr-xr-x | identty.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/identty.py b/identty.py new file mode 100755 index 0000000..a2f3f32 --- /dev/null +++ b/identty.py @@ -0,0 +1,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] |