Sequel Le 2 Serial Port

I am searching for a simple method to list all available com port on a PC. I have found this method but it is Windows-specific: I am using Python 3 with pySerial on a Windows 7 PC. I have found in the pySerial API () a function serial.tools.list_ports.comports() that lists com ports (exactly what I want).

The Serial Programming Guide for POSIX Operating Systems will teach you how to successfully, efficiently, and portably program the serial ports on your UNIX® workstation or PC. Table 2 - Serial Port Device Files; System. TIOCM_LE: DSR (data set ready/line enable) TIOCM_DTR: DTR (data terminal ready) TIOCM_RTS: RTS (request to send).

Import serial.tools.list_ports print(list(serial.tools.list_ports.comports())) But it seems that it doesn't work. When my USB to COM gateway is connected to the PC (I see the COM5 in the Device Manager), this COM port isn't included in the list returned by list_ports.comports().

Just want to confirm that i used Kolos suggestion on a router with original FW V200R001B180D20SP05C397 and edited the string V200R001B236D30SP00C00 in the Bin file to match the Routers original FW of V200R001B180D20SP05C397. Now I need firmware V200R001B180D20SP05C69 because this soft is with ussd codes sender. Huawei b593 driver firmware download 2016 w2. With V200R001B180D20SP05C260 maybe this V200R001B180D20SP5C260 can work, but you can kill modem if not!!!!with hex editor you can only replace numbers, never overwrite with longer number!!!!

Instead I only get COM4 which seems to be connected to a modem (I don't see it in the COM&LPT section of Device Manager)! Do you know why it doesn't work? Have you got another solution which is not system specific? This is the code I use. Successfully tested on Windows 8.1 x64, Windows 10 x64, Mac OS X 10.9.x / 10.10.x / 10.11.x and Ubuntu 14.04 / 14.10 / 15.04 / 15.10 with both Python 2 and Python 3.

A possible refinement to Thomas's excellent answer is to have Linux and possibly OSX also try to open ports and return only those which could be opened. This is because Linux, at least, lists a boatload of ports as files in /dev/ which aren't connected to anything. If you're running in a terminal, /dev/tty is the terminal in which you're working and opening and closing it can goof up your command line, so the glob is designed to not do that. Windows code unchanged.

Elif sys.platform.startswith ('linux'): temp_list = glob.glob ('/dev/tty[A-Za-z]*') result = [] for a_port in temp_list: try: s = serial.Serial(a_port) s.close() result.append(a_port) except serial.SerialException: pass return result This modification to Thomas's code has been tested on Ubuntu 14.04 only.