Show message explaining port permissions when connection fails on Linux
This commit is contained in:
parent
895dfe0523
commit
cbcc2dc019
2 changed files with 36 additions and 4 deletions
|
|
@ -28,6 +28,7 @@ either expressed or implied, of the FreeBSD Project.
|
|||
*/
|
||||
|
||||
using System;
|
||||
using Markdig.Agg;
|
||||
using MatterHackers.Agg.Font;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Localizations;
|
||||
|
|
@ -58,7 +59,7 @@ namespace MatterHackers.MatterControl
|
|||
private class MessageBoxPage : DialogPage
|
||||
{
|
||||
private string unwrappedMessage;
|
||||
private TextWidget messageContainer;
|
||||
private MarkdownWidget messageContainer;
|
||||
private Action<bool> responseCallback;
|
||||
bool haveResponded = false;
|
||||
|
||||
|
|
@ -78,10 +79,9 @@ namespace MatterHackers.MatterControl
|
|||
responseCallback = callback;
|
||||
unwrappedMessage = message;
|
||||
|
||||
contentRow.AddChild(messageContainer = new TextWidget(message, textColor: theme.TextColor, pointSize: 12 * DeviceScale)
|
||||
contentRow.AddChild(messageContainer = new MarkdownWidget(theme)
|
||||
{
|
||||
AutoExpandBoundsToText = true,
|
||||
HAnchor = HAnchor.Left
|
||||
Markdown = message,
|
||||
});
|
||||
|
||||
if (extraWidgetsToAdd != null)
|
||||
|
|
|
|||
|
|
@ -39,7 +39,9 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using MatterControl.Printing;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Platform;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.MatterControl.PrinterCommunication.Io;
|
||||
using MatterHackers.MatterControl.PrintQueue;
|
||||
|
|
@ -971,6 +973,36 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
|
||||
OnConnectionFailed(ConnectionFailure.UnsupportedBaudRate);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
TerminalLog.WriteLine("Exception:" + e.Message);
|
||||
OnConnectionFailed(ConnectionFailure.IOException);
|
||||
if (AggContext.OperatingSystem == OSType.X11 && e.Message == "Permission denied")
|
||||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
string message = @"In order for MatterControl to access the serial ports on Linux, you will need to give your user account the appropriate permissions. Run these commands in a terminal to add yourself to the correct group.
|
||||
|
||||
Ubuntu/Debian
|
||||
--------------
|
||||
|
||||
```
|
||||
# sudo gpasswd -a $USER dialout
|
||||
```
|
||||
|
||||
Arch
|
||||
----
|
||||
|
||||
```
|
||||
# sudo gpasswd -a $USER uucp
|
||||
# sudo gpasswd -a $USER lock
|
||||
```
|
||||
|
||||
You will then need to logout and log back in to the computer for the changes to take effect. ";
|
||||
StyledMessageBox.ShowMessageBox(message, "Permission Denied".Localize());
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TerminalLog.WriteLine("Exception:" + ex.Message);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue