try autodetect and autoinstall udev rules
MODIFY
WalletWasabi/Hwi/HwiProcessManager.cs
WalletWasabi/Hwi/HwiProcessManager.cs
@@ -61,19 +61,49 @@ namespace WalletWasabi.Hwi
return extpub;
}
- public static async Task<IEnumerable<HardwareWalletInfo>> EnumerateAsync()
+ public static async Task<IEnumerable<HardwareWalletInfo>> EnumerateAsync(bool recursive = false)
{
JToken jtok = await SendCommandAsync("enumerate");
JArray jarr = jtok as JArray;
var hwis = new List<HardwareWalletInfo>();
foreach (JObject json in jarr)
{
+ var typeString = json.Value<string>("type");
+ var type = (HardwareWalletType)Enum.Parse(typeof(HardwareWalletType), typeString, ignoreCase: true);
+ var error = json.Value<string>("error");
+
+ if (error != null && !recursive && RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+ {
+ // Try apply udev rules.
+ var missingUdevs = UdevRules.FindMissingUdevs().ToArray();
+ if (missingUdevs.Any())
+ {
+ string cmd = "sudo cp udev/*.rules /etc/udev/rules.d/ && sudo udevadm trigger && sudo udevadm control --reload-rules && exit";
+ var escapedArgs = cmd.Replace("\"", "\\\"");
+ // Update Udevs.
+ using (var process = Process.Start(
+ new ProcessStartInfo
+ {
+ FileName = "/bin/sh",
+ Arguments = $"-c \"{escapedArgs}\"",
+ RedirectStandardOutput = false,
+ UseShellExecute = false,
+ CreateNoWindow = false,
+ WindowStyle = ProcessWindowStyle.Normal,
+ WorkingDirectory = "/Hwi/Software"
+ }
+ ))
+ {
+ await process.WaitForExitAsync();
+ }
+
+ return await EnumerateAsync(recursive: true);
+ }
+ }
+
var fingerprint = json.Value<string>("fingerprint");
var serialNumber = json.Value<string>("serial_number");
var path = json.Value<string>("path");
- var typeString = json.Value<string>("type");
-
- var type = (HardwareWalletType)Enum.Parse(typeof(HardwareWalletType), typeString, ignoreCase: true);
var hwi = new HardwareWalletInfo(fingerprint, serialNumber, type, path);
hwis.Add(hwi);

ADD
WalletWasabi/Hwi/Software/udev/20-hw1.rules
+SUBSYSTEMS=="usb", ATTRS{idVendor}=="2581", ATTRS{idProduct}=="1b7c", MODE="0660", GROUP="plugdev"
+SUBSYSTEMS=="usb", ATTRS{idVendor}=="2581", ATTRS{idProduct}=="2b7c", MODE="0660", GROUP="plugdev"
+SUBSYSTEMS=="usb", ATTRS{idVendor}=="2581", ATTRS{idProduct}=="3b7c", MODE="0660", GROUP="plugdev"
+SUBSYSTEMS=="usb", ATTRS{idVendor}=="2581", ATTRS{idProduct}=="4b7c", MODE="0660", GROUP="plugdev"
+SUBSYSTEMS=="usb", ATTRS{idVendor}=="2581", ATTRS{idProduct}=="1807", MODE="0660", GROUP="plugdev"
+SUBSYSTEMS=="usb", ATTRS{idVendor}=="2581", ATTRS{idProduct}=="1808", MODE="0660", GROUP="plugdev"
+SUBSYSTEMS=="usb", ATTRS{idVendor}=="2c97", ATTRS{idProduct}=="0000", MODE="0660", GROUP="plugdev"
+SUBSYSTEMS=="usb", ATTRS{idVendor}=="2c97", ATTRS{idProduct}=="0001", MODE="0660", GROUP="plugdev"
+SUBSYSTEMS=="usb", ATTRS{idVendor}=="2c97", ATTRS{idProduct}=="0004", MODE="0660", GROUP="plugdev"
\ No newline at end of file

ADD
WalletWasabi/Hwi/Software/udev/51-coinkite.rules
+
+# probably not needed:
+SUBSYSTEMS=="usb", ATTRS{idVendor}=="d13e", ATTRS{idProduct}=="cc10", GROUP="plugdev", MODE="0666"
+
+# required:
+# from <https://github.com/signal11/hidapi/blob/master/udev/99-hid.rules>
+KERNEL=="hidraw*", ATTRS{idVendor}=="d13e", ATTRS{idProduct}=="cc10", GROUP="plugdev", MODE="0666"
+

ADD
WalletWasabi/Hwi/Software/udev/51-hid-digitalbitbox.rules
+SUBSYSTEM=="usb", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="dbb%n", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2402"

ADD
WalletWasabi/Hwi/Software/udev/51-trezor.rules
+# TREZOR: The Original Hardware Wallet
+# https://trezor.io/
+#
+# Put this file into /etc/udev/rules.d
+#
+# If you are creating a distribution package,
+# put this into /usr/lib/udev/rules.d or /lib/udev/rules.d
+# depending on your distribution
+
+# TREZOR
+SUBSYSTEM=="usb", ATTR{idVendor}=="534c", ATTR{idProduct}=="0001", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="trezor%n"
+KERNEL=="hidraw*", ATTRS{idVendor}=="534c", ATTRS{idProduct}=="0001", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl"
+
+# TREZOR v2
+SUBSYSTEM=="usb", ATTR{idVendor}=="1209", ATTR{idProduct}=="53c0", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="trezor%n"
+SUBSYSTEM=="usb", ATTR{idVendor}=="1209", ATTR{idProduct}=="53c1", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="trezor%n"
+KERNEL=="hidraw*", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="53c1", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl"

ADD
WalletWasabi/Hwi/Software/udev/51-usb-keepkey.rules
+# KeepKey: Your Private Bitcoin Vault
+# http://www.keepkey.com/
+# Put this file into /usr/lib/udev/rules.d or /etc/udev/rules.d
+
+# KeepKey HID Firmware/Bootloader
+SUBSYSTEM=="usb", ATTR{idVendor}=="2b24", ATTR{idProduct}=="0001", MODE="0666", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="keepkey%n"
+KERNEL=="hidraw*", ATTRS{idVendor}=="2b24", ATTRS{idProduct}=="0001", MODE="0666", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl"
+
+# KeepKey WebUSB Firmware/Bootloader
+SUBSYSTEM=="usb", ATTR{idVendor}=="2b24", ATTR{idProduct}=="0002", MODE="0666", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="keepkey%n"
+KERNEL=="hidraw*", ATTRS{idVendor}=="2b24", ATTRS{idProduct}=="0002", MODE="0666", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl"

ADD
WalletWasabi/Hwi/Software/udev/52-hid-digitalbitbox.rules
+KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2402", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="dbbf%n"

ADD
WalletWasabi/Hwi/Software/udev/README.md
+# udev rules
+
+This directory contains all of the udev rules for the supported devices as retrieved from vendor websites and repositories.
+These are necessary for the devices to be reachable on linux environments.
+
+`20-hw1.rules` (Ledger): https://github.com/LedgerHQ/udev-rules/blob/master/20-hw1.rules
+`51-coinkite.rules` (Coldcard): https://github.com/Coldcard/ckcc-protocol/blob/master/51-coinkite.rules
+`51-hid-digitalbitbox.rules`, `52-hid-digitalbitbox.rules` (Digital Bitbox): https://shiftcrypto.ch/start_linux
+`51-trezor.rules` (Trezor): https://github.com/trezor/trezor-common/blob/master/udev/51-trezor.rules
+`51-usb-keepkey.rules` (Keepkey): https://github.com/keepkey/udev-rules/blob/master/51-usb-keepkey.rules
+
+# Usage
+
+Apply these rules by copying them to `/etc/udev/rules.d/` and notifying `udevadm`.
+
+```
+$ sudo cp udev/*.rules /etc/udev/rules.d/
+$ sudo udevadm trigger
+$ sudo udevadm control --reload-rules
+```

MODIFY
WalletWasabi/WalletWasabi.csproj
WalletWasabi/WalletWasabi.csproj
</ItemGroup>
<ItemGroup>
<Folder Include="Gma\QrCodeNet\Encoding\ReedSolomon\" />
+ <Folder Include="Hwi\Software\udev\" />
</ItemGroup>
<ItemGroup>
<None Update="Hwi\Software\hwi-win64.zip">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
+ <None Update="Hwi\Software\udev\20-hw1.rules">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
+ <None Update="Hwi\Software\udev\51-coinkite.rules">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
+ <None Update="Hwi\Software\udev\51-hid-digitalbitbox.rules">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
+ <None Update="Hwi\Software\udev\51-trezor.rules">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
+ <None Update="Hwi\Software\udev\51-usb-keepkey.rules">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
+ <None Update="Hwi\Software\udev\52-hid-digitalbitbox.rules">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
+ <None Update="Hwi\Software\udev\README.md">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
<None Update="TorDaemons\data-folder.zip">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>

try autodetect and autoinstall udev rules