summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorChris Liechti <cliechti@gmx.net>2016-01-01 22:55:52 +0100
committerChris Liechti <cliechti@gmx.net>2016-01-01 22:55:52 +0100
commit61aa26b853e658c5960abcf8373f4845b429c4b7 (patch)
treed7a0276c800de773cc89616b589b6a108ca183ce /examples
parent53d594cb524b28ada1e5c0bb8a5eea804d99675c (diff)
downloadpyserial-git-61aa26b853e658c5960abcf8373f4845b429c4b7.tar.gz
port_publisher: restore some sorting of ports
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/port_publisher.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/examples/port_publisher.py b/examples/port_publisher.py
index 074a529..083575d 100755
--- a/examples/port_publisher.py
+++ b/examples/port_publisher.py
@@ -523,8 +523,8 @@ terminated, it waits for the next connect.
log.info("unpublish: %s" % (published[device]))
unpublish(published[device])
# Handle devices that are connected but not yet published
- for device in set(connected).difference(published):
- # Find the first available port, starting from 7000
+ for device in sorted(set(connected).difference(published)):
+ # Find the first available port, starting from specified number
port = args.base_port
ports_in_use = [f.network_port for f in published.values()]
while port in ports_in_use:
@@ -534,8 +534,7 @@ terminated, it waits for the next connect.
"%s on %s" % (device, hostname),
port,
on_close=unpublish,
- log=log
- )
+ log=log)
log.warning("publish: %s" % (published[device]))
published[device].open()
@@ -549,8 +548,7 @@ terminated, it waits for the next connect.
read_map.keys(),
write_map.keys(),
error_map.keys(),
- 5
- )
+ 5)
# select_end = time.time()
# print "select used %.3f s" % (select_end - select_start)
for reader in readers: