mirror of
https://github.com/lights0123/n-link.git
synced 2025-01-03 15:15:26 +00:00
Show errors when udev rules are required on desktop
This commit is contained in:
parent
0341eca854
commit
372d794b8c
|
@ -13,6 +13,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
'no-console': process.env.NODE_ENV === 'production' ? ['warn', { allow: ['warn', 'error'] }] : 'off',
|
'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 std::time::Duration;
|
||||||
|
|
||||||
use libnspire::{PID, PID_CX2, VID};
|
use libnspire::{PID, PID_CX2, VID};
|
||||||
use rusb::{DeviceHandle, Error, GlobalContext};
|
use rusb::GlobalContext;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::{Device, DeviceState};
|
use crate::{Device, DeviceState};
|
||||||
|
@ -162,7 +162,7 @@ pub fn add_device(dev: Arc<rusb::Device<GlobalContext>>) -> rusb::Result<((u8, u
|
||||||
)?,
|
)?,
|
||||||
false,
|
false,
|
||||||
),
|
),
|
||||||
Err(rusb::Error::NotSupported) => (
|
Err(rusb::Error::NotSupported) | Err(rusb::Error::Access) => (
|
||||||
if descriptor.product_id() == PID_CX2 {
|
if descriptor.product_id() == PID_CX2 {
|
||||||
"TI-Nspire CX II"
|
"TI-Nspire CX II"
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -4,11 +4,19 @@
|
||||||
<div class="flex-shrink-0 border-r w-64">
|
<div class="flex-shrink-0 border-r w-64">
|
||||||
<device-select :selected.sync="selectedCalculator"/>
|
<device-select :selected.sync="selectedCalculator"/>
|
||||||
<div class="overflow-auto h-full px-4 py-4">
|
<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>
|
<h1 class="text-3xl">Drivers required</h1>
|
||||||
<p>The WinUSB driver is required to use this device.</p>
|
<p>The WinUSB driver is required to use this device.</p>
|
||||||
<p class="text-center mt-2">
|
<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>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="calculator && !calculator.info" class="flex items-center justify-center h-full">
|
<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;
|
return this.selectedCalculator && this.$devices.devices[this.selectedCalculator]?.needsDrivers;
|
||||||
}
|
}
|
||||||
|
|
||||||
installDrivers() {
|
get isLinux() {
|
||||||
open('https://lights0123.com/n-link/#windows');
|
return navigator.platform.includes('Linux');
|
||||||
|
}
|
||||||
|
|
||||||
|
installDrivers(platform = 'windows') {
|
||||||
|
open(`https://lights0123.com/n-link/#${platform}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue