mirror of
https://github.com/lights0123/n-link.git
synced 2024-12-22 10:15:27 +00:00
Show errors when udev rules are required on desktop
This commit is contained in:
parent
4b90a1a8da
commit
75ef04b742
|
@ -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',
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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::Device<GlobalContext>>) -> 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 {
|
||||
|
|
|
@ -4,11 +4,19 @@
|
|||
<div class="flex-shrink-0 border-r w-64">
|
||||
<device-select :selected.sync="selectedCalculator"/>
|
||||
<div class="overflow-auto h-full px-4 py-4">
|
||||
<div v-if="needsDrivers">
|
||||
<div v-if="needsDrivers && !isLinux">
|
||||
<h1 class="text-3xl">Drivers required</h1>
|
||||
<p>The WinUSB driver is required to use this device.</p>
|
||||
<p class="text-center mt-2">
|
||||
<a href="#" @click.prevent="installDrivers" class="text-blue-600">See installation instructions</a>
|
||||
<a href="#" @click.prevent="installDrivers()" class="text-blue-600">See installation instructions</a>
|
||||
</p>
|
||||
</div>
|
||||
<div v-else-if="needsDrivers && isLinux">
|
||||
<h1 class="text-3xl">udev rules required</h1>
|
||||
<p>udev rules are required to access this device.</p>
|
||||
<p class="text-center mt-2">
|
||||
<a href="#" @click.prevent="installDrivers('linux')" class="text-blue-600">See installation
|
||||
instructions</a>
|
||||
</p>
|
||||
</div>
|
||||
<div v-else-if="calculator && !calculator.info" class="flex items-center justify-center h-full">
|
||||
|
@ -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}`);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue