Skip to content
This repository has been archived by the owner on Aug 19, 2021. It is now read-only.

Unload module for supported tablets #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .modules/OpenTabletDriver
Submodule OpenTabletDriver updated 76 files
+36 −21 .github/workflows/dotnet.yml
+0 −4 OpenTabletDriver.Console/OpenTabletDriver.Console.csproj
+38 −9 OpenTabletDriver.Console/Program.Commands.cs
+15 −2 OpenTabletDriver.Console/Tools.cs
+72 −84 OpenTabletDriver.Daemon/DriverDaemon.cs
+0 −4 OpenTabletDriver.Daemon/OpenTabletDriver.Daemon.csproj
+0 −52 OpenTabletDriver.Desktop/Binding/BindingReference.cs
+1 −0 OpenTabletDriver.Desktop/Binding/KeyBinding.cs
+1 −0 OpenTabletDriver.Desktop/Binding/MouseBinding.cs
+18 −18 OpenTabletDriver.Desktop/Interop/SystemInterop.cs
+18 −7 OpenTabletDriver.Desktop/Migration/SettingsMigrator.cs
+1 −0 OpenTabletDriver.Desktop/OpenTabletDriver.Desktop.csproj
+2 −2 OpenTabletDriver.Desktop/Reflection/DesktopPluginManager.cs
+53 −0 OpenTabletDriver.Desktop/Reflection/PluginSetting.cs
+77 −0 OpenTabletDriver.Desktop/Reflection/PluginSettingStore.cs
+9 −0 OpenTabletDriver.Desktop/Reflection/PluginSettingStoreCollection.cs
+29 −0 OpenTabletDriver.Desktop/Reflection/StoredPluginReference.cs
+12 −0 OpenTabletDriver.Desktop/Serialization.cs
+75 −40 OpenTabletDriver.Desktop/Settings.cs
+1 −0 OpenTabletDriver.Plugin/IBinding.cs
+1 −0 OpenTabletDriver.Plugin/IDriver.cs
+3 −0 OpenTabletDriver.Plugin/Log.cs
+11 −23 OpenTabletDriver.Plugin/Output/AbsoluteOutputMode.cs
+1 −1 OpenTabletDriver.Plugin/Output/IOutputMode.cs
+10 −22 OpenTabletDriver.Plugin/Output/RelativeOutputMode.cs
+2 −1 OpenTabletDriver.Plugin/Tablet/FilterStage.cs
+7 −1 OpenTabletDriver.Plugin/Tablet/Interpolator/Interpolator.cs
+1 −1 OpenTabletDriver.Tests/OpenTabletDriver.Tests.csproj
+2 −3 OpenTabletDriver.UX.Gtk/Program.cs
+2 −4 OpenTabletDriver.UX.MacOS/Program.cs
+2 −3 OpenTabletDriver.UX.Wpf/Program.cs
+50 −13 OpenTabletDriver.UX/App.cs
+1 −1 OpenTabletDriver.UX/Controls/AreaDisplay.cs
+99 −41 OpenTabletDriver.UX/Controls/AreaEditor.cs
+8 −0 OpenTabletDriver.UX/Controls/AreaViewModel.cs
+59 −28 OpenTabletDriver.UX/Controls/BindingEditor.cs
+1 −1 OpenTabletDriver.UX/Controls/Generic/CollectionEditor.cs
+135 −0 OpenTabletDriver.UX/Controls/Generic/Group.cs
+0 −22 OpenTabletDriver.UX/Controls/Generic/GroupBoxBase.cs
+8 −3 OpenTabletDriver.UX/Controls/Generic/InputBox.cs
+411 −0 OpenTabletDriver.UX/Controls/OutputModeEditor.cs
+0 −55 OpenTabletDriver.UX/Controls/OutputModeSelector.cs
+341 −0 OpenTabletDriver.UX/Controls/PluginSettingStoreCollectionEditor.cs
+0 −253 OpenTabletDriver.UX/Controls/PluginSettingsEditor.cs
+0 −101 OpenTabletDriver.UX/Controls/SensitivityEditor.cs
+61 −343 OpenTabletDriver.UX/MainForm.cs
+14 −22 OpenTabletDriver.UX/Windows/AdvancedBindingEditorDialog.cs
+5 −11 OpenTabletDriver.UX/Windows/BindingEditorDialog.cs
+2 −5 OpenTabletDriver.UX/Windows/ConfigurationEditor.cs
+13 −9 OpenTabletDriver.UX/Windows/DeviceListDialog.cs
+26 −63 OpenTabletDriver.UX/Windows/DeviceStringReader.cs
+38 −78 OpenTabletDriver.UX/Windows/TabletDebugger.cs
+35 −0 OpenTabletDriver/Configurations/Huion/GT-133.json
+35 −0 OpenTabletDriver/Configurations/Huion/H1060P.json
+5 −5 OpenTabletDriver/Configurations/Huion/H610 Pro.json
+27 −1 OpenTabletDriver/Configurations/Huion/New 1060 Plus.json
+3 −3 OpenTabletDriver/Configurations/VEIKK/S640.json
+29 −0 OpenTabletDriver/Configurations/Wacom/CTE-650.json
+63 −0 OpenTabletDriver/Configurations/Wacom/CTH-460.json
+1 −1 OpenTabletDriver/Configurations/Wacom/MTE-450.json
+2 −2 OpenTabletDriver/Configurations/Wacom/PTH-850.json
+63 −0 OpenTabletDriver/Configurations/Wacom/PTH-860.json
+51 −0 OpenTabletDriver/Configurations/Wacom/PTK-440.json
+1 −1 OpenTabletDriver/Configurations/XP-Pen/Deco 03.json
+32 −8 OpenTabletDriver/Configurations/XP-Pen/G430.json
+9 −33 OpenTabletDriver/Configurations/XP-Pen/G430S.json
+0 −31 OpenTabletDriver/Configurations/XP-Pen/G430S_B.json
+8 −8 OpenTabletDriver/Configurations/XP-Pen/G540.json
+1 −1 OpenTabletDriver/Configurations/XP-Pen/G640 v2.json
+22 −0 OpenTabletDriver/Configurations/XP-Pen/G640s.json
+53 −0 OpenTabletDriver/Configurations/XP-Pen/Star 03.json
+51 −16 OpenTabletDriver/Driver.cs
+29 −0 OpenTabletDriver/Interop/SystemInterop.cs
+1 −1 OpenTabletDriver/OpenTabletDriver.csproj
+7 −4 OpenTabletDriver/Reflection/PluginManager.cs
+13 −6 OpenTabletDriver/Reflection/PluginReference.cs
11 changes: 7 additions & 4 deletions OpenTabletDriver.udev/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,14 @@ static IEnumerable<string> CreateRules(DirectoryInfo directory)
if (string.IsNullOrWhiteSpace(tablet.Name))
continue;
yield return string.Format("# {0}", tablet.Name);

foreach (var rule in RuleCreator.CreateAccessRules(tablet, "hidraw", "0666"))

foreach (var rule in RuleCreator.CreateAccessRules(tablet, "hidraw"))
yield return rule;

foreach (var rule in RuleCreator.CreateAccessRules(tablet, "usb"))
yield return rule;
foreach (var rule in RuleCreator.CreateAccessRules(tablet, "usb", "0666"))

foreach (var rule in RuleCreator.CreateModuleRules(tablet))
yield return rule;

if (tablet.Attributes.TryGetValue("libinputoverride", out var value) && (value == "1" || value.ToLower() == "true"))
Expand Down
31 changes: 23 additions & 8 deletions OpenTabletDriver.udev/RuleCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ namespace OpenTabletDriver.udev
{
internal static class RuleCreator
{
private static IEnumerable<DeviceIdentifier> GetDistinctIdentifiers(TabletConfiguration config)
{
var allIdentifiers = config.DigitizerIdentifiers.Concat(config.AuxilaryDeviceIdentifiers);
return allIdentifiers.Distinct(new IdentifierComparer());
}

public static Rule CreateAccessRule(string module, string subsystem)
{
return new Rule(
Expand All @@ -19,21 +25,15 @@ public static Rule CreateAccessRule(string module, string subsystem)
);
}

private static IEnumerable<DeviceIdentifier> GetDistinctIdentifiers(TabletConfiguration config)
{
var allIdentifiers = config.DigitizerIdentifiers.Concat(config.AuxilaryDeviceIdentifiers);
return allIdentifiers.Distinct(new IdentifierComparer());
}

public static IEnumerable<Rule> CreateAccessRules(TabletConfiguration tablet, string subsystem, string mode)
public static IEnumerable<Rule> CreateAccessRules(TabletConfiguration tablet, string subsystem)
{
foreach (var id in GetDistinctIdentifiers(tablet))
{
yield return new Rule(
new Token("SUBSYSTEM", Operator.Equal, subsystem),
new ATTRS("idVendor", Operator.Equal, id.VendorID.ToHexFormat()),
new ATTRS("idProduct", Operator.Equal, id.ProductID.ToHexFormat()),
new Token("MODE", Operator.Assign, mode)
new Token("TAG", Operator.Add, "uaccess")
);
}
}
Expand All @@ -50,5 +50,20 @@ public static IEnumerable<Rule> CreateOverrideRules(TabletConfiguration tablet)
);
}
}

public static IEnumerable<Rule> CreateModuleRules(TabletConfiguration tablet)
{
foreach (var id in GetDistinctIdentifiers(tablet))
{
var module = id.VendorID == 1386 ? "wacom" : "hid_uclogic";
yield return new Rule(
new Token("SUBSYSTEM", Operator.Equal, "input"),
new ATTRS("idVendor", Operator.Equal, id.VendorID.ToHexFormat()),
new ATTRS("idProduct", Operator.Equal, id.ProductID.ToHexFormat()),
new Token("ACTION", Operator.Assign, "add"),
new Token("PROGRAM", Operator.Assign, $"/sbin/rmmod {module}")
);
}
}
}
}