updates
This commit is contained in:
parent
0e13ca7378
commit
dbdfbe5aaa
@ -11,7 +11,7 @@ use tracing::{debug, error, info, warn};
|
|||||||
use winit::{
|
use winit::{
|
||||||
event_loop::EventLoopBuilder,
|
event_loop::EventLoopBuilder,
|
||||||
platform::x11::EventLoopBuilderExtX11,
|
platform::x11::EventLoopBuilderExtX11,
|
||||||
platform::unix::EventLoopBuilderExtUnix,
|
platform::wayland::EventLoopBuilderExtWayland,
|
||||||
event::Event,
|
event::Event,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -74,10 +74,6 @@ impl LesavkaClientApp {
|
|||||||
let (video_tx, mut video_rx) = tokio::sync::mpsc::unbounded_channel::<VideoPacket>();
|
let (video_tx, mut video_rx) = tokio::sync::mpsc::unbounded_channel::<VideoPacket>();
|
||||||
// let (event_tx, event_rx) = std::sync::mpsc::channel();
|
// let (event_tx, event_rx) = std::sync::mpsc::channel();
|
||||||
let (_event_tx, _event_rx) = std::sync::mpsc::channel::<()>();
|
let (_event_tx, _event_rx) = std::sync::mpsc::channel::<()>();
|
||||||
let el = EventLoopBuilder::with_user_event()
|
|
||||||
.with_any_thread(true)
|
|
||||||
.build()
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
let el = EventLoopBuilder::<()>::new()
|
let el = EventLoopBuilder::<()>::new()
|
||||||
@ -87,7 +83,7 @@ impl LesavkaClientApp {
|
|||||||
let win0 = MonitorWindow::new(0, &el).expect("win0");
|
let win0 = MonitorWindow::new(0, &el).expect("win0");
|
||||||
let win1 = MonitorWindow::new(1, &el).expect("win1");
|
let win1 = MonitorWindow::new(1, &el).expect("win1");
|
||||||
|
|
||||||
el.run(move |_: Event<'_, ()>, _| {
|
el.run(move |_: Event<()>, _| {
|
||||||
while let Ok(pkt) = video_rx.try_recv() {
|
while let Ok(pkt) = video_rx.try_recv() {
|
||||||
match pkt.id {
|
match pkt.id {
|
||||||
0 => win0.push_packet(pkt),
|
0 => win0.push_packet(pkt),
|
||||||
|
|||||||
@ -44,7 +44,7 @@ fi
|
|||||||
|
|
||||||
mapfile -t TAGS < <(
|
mapfile -t TAGS < <(
|
||||||
for v in "${GC_VIDEOS[@]}"; do
|
for v in "${GC_VIDEOS[@]}"; do
|
||||||
udevadm info -q property -n "$v" |
|
sudo udevadm info -q property -n "$v" |
|
||||||
awk -F= '/^ID_PATH_TAG=/{print $2}'
|
awk -F= '/^ID_PATH_TAG=/{print $2}'
|
||||||
done
|
done
|
||||||
)
|
)
|
||||||
@ -56,17 +56,14 @@ LEFT_TAG=${TAGS[0]}
|
|||||||
RIGHT_TAG=${TAGS[1]}
|
RIGHT_TAG=${TAGS[1]}
|
||||||
|
|
||||||
sudo tee /etc/udev/rules.d/85-gc311.rules >/dev/null <<EOF
|
sudo tee /etc/udev/rules.d/85-gc311.rules >/dev/null <<EOF
|
||||||
# auto‑generated by install‑server.sh – DO NOT EDIT
|
# auto-generated by lesavka/scripts/install-server.sh - DO NOT EDIT
|
||||||
SUBSYSTEM=="video4linux", ATTRS{idVendor}=="07ca", ATTRS{idProduct}=="3311", \
|
SUBSYSTEM=="video4linux", ENV{ID_PATH_TAG}=="$LEFT_TAG", SYMLINK+="lesavka_l_eye"
|
||||||
ATTRS{index}=="0", ENV{ID_PATH_TAG}=="$LEFT_TAG", SYMLINK+="lesavka_l_eye"
|
SUBSYSTEM=="video4linux", ENV{ID_PATH_TAG}=="$RIGHT_TAG", SYMLINK+="lesavka_r_eye"
|
||||||
|
|
||||||
SUBSYSTEM=="video4linux", ATTRS{idVendor}=="07ca", ATTRS{idProduct}=="3311", \
|
|
||||||
ATTRS{index}=="0", ENV{ID_PATH_TAG}=="$RIGHT_TAG", SYMLINK+="lesavka_r_eye"
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
sudo udevadm control --reload
|
sudo udevadm control --reload
|
||||||
sudo udevadm trigger --subsystem-match=video4linux
|
sudo udevadm trigger --subsystem-match=video4linux
|
||||||
udevadm settle
|
sudo udevadm settle
|
||||||
|
|
||||||
echo "==> 3. Rust toolchain"
|
echo "==> 3. Rust toolchain"
|
||||||
sudo rustup default stable
|
sudo rustup default stable
|
||||||
|
|||||||
@ -7,12 +7,11 @@ use std::{pin::Pin, sync::Arc, time::Duration};
|
|||||||
use tokio::{fs::{OpenOptions}, io::AsyncWriteExt, sync::Mutex};
|
use tokio::{fs::{OpenOptions}, io::AsyncWriteExt, sync::Mutex};
|
||||||
use tokio_stream::{wrappers::ReceiverStream};
|
use tokio_stream::{wrappers::ReceiverStream};
|
||||||
use tonic::{transport::Server, Request, Response, Status};
|
use tonic::{transport::Server, Request, Response, Status};
|
||||||
use tracing::{info, trace};
|
use tracing::{info, trace, warn};
|
||||||
use tracing_subscriber::{fmt, EnvFilter};
|
use tracing_subscriber::{fmt, EnvFilter};
|
||||||
use udev::{MonitorBuilder};
|
use udev::{MonitorBuilder};
|
||||||
|
|
||||||
use usb_gadget::UsbGadget;
|
use lesavka_server::{usb_gadget::UsbGadget, video, usb_reset};
|
||||||
use lesavka_server::{video, usb_reset};
|
|
||||||
|
|
||||||
use lesavka_common::lesavka::{
|
use lesavka_common::lesavka::{
|
||||||
relay_server::{Relay, RelayServer},
|
relay_server::{Relay, RelayServer},
|
||||||
@ -196,18 +195,18 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
|
|
||||||
let handler = Handler::make(gadget.clone()).await?;
|
let handler = Handler::make(gadget.clone()).await?;
|
||||||
|
|
||||||
tokio::spawn({
|
// tokio::spawn({
|
||||||
let gadget = gadget.clone();
|
// let gadget = gadget.clone();
|
||||||
async move {
|
// async move {
|
||||||
loop {
|
// loop {
|
||||||
tokio::time::sleep(Duration::from_secs(4)).await;
|
// tokio::time::sleep(Duration::from_secs(4)).await;
|
||||||
if LAST_HID_WRITE.elapsed().as_secs() > 3 {
|
// if LAST_HID_WRITE.elapsed().as_secs() > 3 {
|
||||||
warn!("no HID traffic in 3 s – cycling UDC");
|
// warn!("no HID traffic in 3 s – cycling UDC");
|
||||||
let _ = gadget.cycle();
|
// let _ = gadget.cycle();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
|
||||||
println!("🌐 lesavka-server listening on 0.0.0.0:50051");
|
println!("🌐 lesavka-server listening on 0.0.0.0:50051");
|
||||||
Server::builder()
|
Server::builder()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user