From 75ef04b742ccad1a3df674505263549ce6bc1471 Mon Sep 17 00:00:00 2001 From: lights0123 Date: Tue, 6 Apr 2021 17:38:45 -0400 Subject: [PATCH] Show errors when udev rules are required on desktop --- desktop/.eslintrc.js | 3 ++- desktop/src-tauri/src/cmd.rs | 4 ++-- desktop/src/views/Home.vue | 20 ++++++++++++++++---- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/desktop/.eslintrc.js b/desktop/.eslintrc.js index e77ac92..a880a71 100644 --- a/desktop/.eslintrc.js +++ b/desktop/.eslintrc.js @@ -13,6 +13,7 @@ module.exports = { }, rules: { 'no-console': process.env.NODE_ENV === 'production' ? ['warn', { allow: ['warn', 'error'] }] : 'off', - 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off' + 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', } } diff --git a/desktop/src-tauri/src/cmd.rs b/desktop/src-tauri/src/cmd.rs index 8b34c6e..80bc631 100644 --- a/desktop/src-tauri/src/cmd.rs +++ b/desktop/src-tauri/src/cmd.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use std::time::Duration; use libnspire::{PID, PID_CX2, VID}; -use rusb::{DeviceHandle, Error, GlobalContext}; +use rusb::GlobalContext; use serde::{Deserialize, Serialize}; use crate::{Device, DeviceState}; @@ -162,7 +162,7 @@ pub fn add_device(dev: Arc>) -> rusb::Result<((u8, u )?, false, ), - Err(rusb::Error::NotSupported) => ( + Err(rusb::Error::NotSupported) | Err(rusb::Error::Access) => ( if descriptor.product_id() == PID_CX2 { "TI-Nspire CX II" } else { diff --git a/desktop/src/views/Home.vue b/desktop/src/views/Home.vue index 961e9b4..d33559b 100644 --- a/desktop/src/views/Home.vue +++ b/desktop/src/views/Home.vue @@ -4,11 +4,19 @@
-
+

Drivers required

The WinUSB driver is required to use this device.

- See installation instructions + See installation instructions +

+
+
+

udev rules required

+

udev rules are required to access this device.

+

+ See installation + instructions

@@ -94,8 +102,12 @@ export default class Home extends Vue { return this.selectedCalculator && this.$devices.devices[this.selectedCalculator]?.needsDrivers; } - installDrivers() { - open('https://lights0123.com/n-link/#windows'); + get isLinux() { + return navigator.platform.includes('Linux'); + } + + installDrivers(platform = 'windows') { + open(`https://lights0123.com/n-link/#${platform}`); } }