diff options
Diffstat (limited to 'documentation/tools.rst')
-rw-r--r-- | documentation/tools.rst | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/documentation/tools.rst b/documentation/tools.rst index 437a884..8ed7fce 100644 --- a/documentation/tools.rst +++ b/documentation/tools.rst @@ -12,8 +12,10 @@ This module can be executed to get a list of ports (``python -m serial.tools.list_ports``). It also contains the following functions. -.. function:: comports() +.. function:: comports(include_links=False) + :param bool include_links: include symlinks under ``/dev`` when they point + to a serial port :return: a list containing :class:`ListPortInfo` objects. The function returns a list of :obj:`ListPortInfo` objects. @@ -26,22 +28,36 @@ serial.tools.list_ports``). It also contains the following functions. systems description and hardware ID will not be available (``None``). + Under Linux, OSX and Windows, extended information will be available for + USB devices (e.g. the :attr:`ListPortInfo.hwid` string contains `VID:PID`, + `SER` (serial number), `LOCATION` (hierarchy), which makes them searchable + via :func:`grep`. The USB info is also available as attributes of + :attr:`ListPortInfo`. + + If *include_links* is true, all devices under ``/dev`` are inspected and + tested if they are a link to a known serial port device. These entries + will include ``LINK`` in their ``hwid`` string. This implies that the same + device listed twice, once under its original name and once under linked + name. + :platform: Posix (/dev files) :platform: Linux (/dev files, sysfs) :platform: OSX (iokit) :platform: Windows (setupapi, registry) -.. function:: grep(regexp) +.. function:: grep(regexp, include_links=False) :param regexp: regular expression (see stdlib :mod:`re`) + :param bool include_links: include symlinks under ``/dev`` when they point + to a serial port :return: an iterable that yields :class:`ListPortInfo` objects, see also :func:`comports`. - Search for ports using a regular expression. Port name, description and - hardware ID are searched (case insensitive). The function returns an - iterable that contains the same data that :func:`comports` generates, but - includes only those entries that match the regexp. + Search for ports using a regular expression. Port ``name``, + ``description`` and ``hwid`` are searched (case insensitive). The function + returns an iterable that contains the same data that :func:`comports` + generates, but includes only those entries that match the regexp. .. class:: ListPortInfo @@ -109,18 +125,20 @@ serial.tools.list_ports``). It also contains the following functions. Help for ``python -m serial.tools.list_ports``:: - usage: list_ports.py [-h] [-v] [-q] [-n N] [regexp] + usage: list_ports.py [-h] [-v] [-q] [-n N] [-s] [regexp] Serial port enumeration positional arguments: - regexp only show ports that match this regex + regexp only show ports that match this regex optional arguments: - -h, --help show this help message and exit - -v, --verbose show more messages - -q, --quiet suppress all messages - -n N only output the N-th entry + -h, --help show this help message and exit + -v, --verbose show more messages + -q, --quiet suppress all messages + -n N only output the N-th entry + -s, --include-links include entries that are symlinks to real devices + Examples: @@ -256,6 +274,11 @@ Typing :kbd:`Ctrl+T Ctrl+H` when it is running shows the help text:: --- x X disable/enable software flow control --- r R disable/enable hardware flow control +:kbd:`Ctrl+T s` suspends the connection (port is opened) and reconnects when a +key is pressed. This can be used to temporarily access the serial port with an +other application, without exiting miniterm. If reconnecting fails it is +also possible to exit (:kbd:`Ctrl+]`) or change the port (:kbd:`p`). + .. versionchanged:: 2.5 Added :kbd:`Ctrl+T` menu and added support for opening URLs. .. versionchanged:: 2.6 |