From c686bf212df84d04d62a86e951cb4e3a2adb8f10 Mon Sep 17 00:00:00 2001
From: Charles Haley
Date: Tue, 28 Jul 2020 16:23:04 +0100
Subject: [PATCH] Fix bug 1889255: wireless TCP port upper limit is 32000 only
---
src/calibre/devices/smart_device_app/driver.py | 2 +-
src/calibre/gui2/dialogs/smartdevice.py | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/calibre/devices/smart_device_app/driver.py b/src/calibre/devices/smart_device_app/driver.py
index 39e61cdd00..4e762c9dce 100644
--- a/src/calibre/devices/smart_device_app/driver.py
+++ b/src/calibre/devices/smart_device_app/driver.py
@@ -1931,7 +1931,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
while i < 100: # try 9090 then up to 99 random port numbers
i += 1
port = self._attach_to_port(self.listen_socket,
- 9090 if i == 1 else random.randint(8192, 32000))
+ 9090 if i == 1 else random.randint(8192, 65525))
if port != 0:
break
if port == 0:
diff --git a/src/calibre/gui2/dialogs/smartdevice.py b/src/calibre/gui2/dialogs/smartdevice.py
index db82ebd475..c4cb88ebc9 100644
--- a/src/calibre/gui2/dialogs/smartdevice.py
+++ b/src/calibre/gui2/dialogs/smartdevice.py
@@ -57,7 +57,7 @@ class SmartdeviceDialog(QDialog, Ui_Dialog):
self.fixed_port.setToolTip('' +
_('Try 9090. If calibre says that it fails to connect '
'to the port, try another number. You can use any number between '
- '8,000 and 32,000.') + '
')
+ '8,000 and 65,535.') + '
')
self.ip_addresses.setToolTip('' +
_('These are the IP addresses for this computer. If you decide to have your device connect to '
@@ -116,12 +116,12 @@ class SmartdeviceDialog(QDialog, Ui_Dialog):
port = int(port)
except:
error_dialog(self, _('Invalid port number'),
- _('The port must be a number between 8000 and 32000.'), show=True)
+ _('The port must be a number between 8000 and 65535.'), show=True)
return
- if port < 8000 or port > 32000:
+ if port < 8000 or port > 65535:
error_dialog(self, _('Invalid port number'),
- _('The port must be a number between 8000 and 32000.'), show=True)
+ _('The port must be a number between 8000 and 65535.'), show=True)
return
self.device_manager.set_option('smartdevice', 'password',