From 66dcf910bd4744d8ced56cb9586aa937a1a2d4c5 Mon Sep 17 00:00:00 2001 From: vg Date: Tue, 7 Jul 2020 16:24:01 +0200 Subject: first commit --- identty.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 identty.py (limited to 'identty.py') 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] -- cgit v1.2.3