81 lines
2.2 KiB
Rust
81 lines
2.2 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
use serde_json::{json, Value};
|
|
use std::{
|
|
fs::{self, File, OpenOptions},
|
|
io,
|
|
os::fd::AsRawFd,
|
|
path::Path,
|
|
sync::Mutex,
|
|
thread::sleep,
|
|
time::Duration,
|
|
};
|
|
|
|
const RAZER_VENDOR_ID: u16 = 0x1532;
|
|
const SUPPORTED_DEVICES: &[SupportedDevice] = &[
|
|
SupportedDevice {
|
|
product_id: 0x0099,
|
|
name: "Razer Basilisk V3",
|
|
},
|
|
SupportedDevice {
|
|
product_id: 0x00aa,
|
|
name: "Razer Basilisk V3 Pro (wired)",
|
|
},
|
|
SupportedDevice {
|
|
product_id: 0x00ab,
|
|
name: "Razer Basilisk V3 Pro (wireless)",
|
|
},
|
|
];
|
|
|
|
include!("backend/models.rs");
|
|
include!("backend/commands.rs");
|
|
include!("backend/device.rs");
|
|
include!("backend/discovery.rs");
|
|
include!("backend/value_maps.rs");
|
|
include!("backend/button_mapping.rs");
|
|
include!("backend/macro_ops.rs");
|
|
include!("backend/ioctl.rs");
|
|
|
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
|
pub fn run() {
|
|
tauri::Builder::default()
|
|
.plugin(tauri_plugin_opener::init())
|
|
.manage(AppState::default())
|
|
.invoke_handler(tauri::generate_handler![
|
|
list_supported_devices,
|
|
connect_device,
|
|
refresh_device_state,
|
|
set_scroll_mode,
|
|
set_scroll_acceleration,
|
|
set_scroll_smart_reel,
|
|
set_polling_rate,
|
|
set_dpi_xy,
|
|
set_dpi_stages,
|
|
create_profile,
|
|
delete_profile,
|
|
get_led_state,
|
|
set_led_effect,
|
|
set_led_brightness,
|
|
apply_led_to_all_regions,
|
|
get_button_mapping,
|
|
set_button_mapping,
|
|
export_profile_config,
|
|
import_profile_config,
|
|
list_macros,
|
|
get_macro_definition,
|
|
set_macro_definition,
|
|
delete_macro,
|
|
reset_macro_flash,
|
|
get_debug_logs,
|
|
clear_debug_logs,
|
|
get_sensor_state,
|
|
set_sensor_lift_mode,
|
|
start_sensor_calibration,
|
|
stop_sensor_calibration,
|
|
set_sensor_params,
|
|
get_info_state,
|
|
send_raw_command,
|
|
reset_flash,
|
|
])
|
|
.run(tauri::generate_context!())
|
|
.expect("error while running tauri application");
|
|
}
|