Removed /dev/ttyAMA* from serial ports added by default to connection list

Added additional ports configuration to settings to make it easier for people who actually need that port in the selection to add it back.
This commit is contained in:
Gina Häußge 2015-03-18 12:08:21 +01:00
parent 590bff696b
commit 7b9e3efea1
5 changed files with 24 additions and 3 deletions

View file

@ -108,6 +108,10 @@
* OctoPrint server should no longer hang when big changes in the system time happen, e.g. after first contact to an
NTP server on a Raspberry Pi image. Achieved through monkey patching Tornado with
[this PR](https://github.com/tornadoweb/tornado/pull/1290).
* Serial ports matching ``/dev/ttyAMA*`` are not anymore listed by default (this was the reason for a lot of people
attempting to connect to their printer on their Raspberry Pis, on which ``/dev/ttyAMA0`` is the OS's serial console
by default). Added configuration of additional ports to the Serial Connection section in the Settings to make it easier
for those people who do indeed have their printer connected to ``/dev/ttyAMA0``.
### Bug Fixes

View file

@ -76,7 +76,8 @@ def getSettings():
"timeoutCommunication": s.getFloat(["serial", "timeout", "communication"]),
"timeoutTemperature": s.getFloat(["serial", "timeout", "temperature"]),
"timeoutSdStatus": s.getFloat(["serial", "timeout", "sdStatus"]),
"log": s.getBoolean(["serial", "log"])
"log": s.getBoolean(["serial", "log"]),
"additionalPorts": s.get(["serial", "additionalPorts"])
},
"folder": {
"uploads": s.getBaseFolder("uploads"),
@ -183,6 +184,7 @@ def setSettings():
if "timeoutCommunication" in data["serial"].keys(): s.setFloat(["serial", "timeout", "communication"], data["serial"]["timeoutCommunication"])
if "timeoutTemperature" in data["serial"].keys(): s.setFloat(["serial", "timeout", "temperature"], data["serial"]["timeoutTemperature"])
if "timeoutSdStatus" in data["serial"].keys(): s.setFloat(["serial", "timeout", "sdStatus"], data["serial"]["timeoutSdStatus"])
if "additionalPorts" in data["serial"] and isinstance(data["serial"]["additionalPorts"], (list, tuple)): s.set(["serial", "additionalPorts"], data["serial"]["additionalPorts"])
oldLog = s.getBoolean(["serial", "log"])
if "log" in data["serial"].keys(): s.setBoolean(["serial", "log"], data["serial"]["log"])

View file

@ -85,6 +85,7 @@ $(function() {
self.serial_timeoutTemperature = ko.observable(undefined);
self.serial_timeoutSdStatus = ko.observable(undefined);
self.serial_log = ko.observable(undefined);
self.serial_additionalPorts = ko.observable(undefined);
self.folder_uploads = ko.observable(undefined);
self.folder_timelapse = ko.observable(undefined);
@ -220,6 +221,7 @@ $(function() {
self.serial_timeoutTemperature(response.serial.timeoutTemperature);
self.serial_timeoutSdStatus(response.serial.timeoutSdStatus);
self.serial_log(response.serial.log);
self.serial_additionalPorts(response.serial.additionalPorts.join("\n"));
self.folder_uploads(response.folder.uploads);
self.folder_timelapse(response.folder.timelapse);
@ -290,7 +292,14 @@ $(function() {
"timeoutCommunication": self.serial_timeoutCommunication(),
"timeoutTemperature": self.serial_timeoutTemperature(),
"timeoutSdStatus": self.serial_timeoutSdStatus(),
"log": self.serial_log()
"log": self.serial_log(),
"additionalPorts": _.filter(
_.map(
self.serial_additionalPorts().split("\n"),
function(item) { return (item) ? item.trim() : ""; }
),
function(item) { return item && !_.startsWith(item, "#"); }
)
},
"folder": {
"uploads": self.folder_uploads(),

View file

@ -70,4 +70,11 @@
</label>
</div>
</div>
<div class="control-group">
<label class="control-label" for="settings-serialAdditionalPorts">{{ _('Additional serial ports') }}</label>
<div class="controls">
<textarea rows="4" class="block" id="settings-serialAdditionalPorts" data-bind="value: serial_additionalPorts"></textarea>
<span class="help-inline">{{ _('Use this to define additional <a href="%%(glob_url)s">glob patterns</a> matching serial ports to list for connecting against, e.g. <code>/dev/ttyAMA*</code>. One entry per line.')|format(glob_url="http://docs.python.org/2/library/glob.html") }}</span>
</div>
</div>
</form>

View file

@ -46,7 +46,6 @@ def serialList():
baselist = baselist \
+ glob.glob("/dev/ttyUSB*") \
+ glob.glob("/dev/ttyACM*") \
+ glob.glob("/dev/ttyAMA*") \
+ glob.glob("/dev/tty.usb*") \
+ glob.glob("/dev/cu.*") \
+ glob.glob("/dev/cuaU*") \