Skip to content

Commit 2e174ce

Browse files
committed
Merge remote-tracking branch 'origin/main' into restart
2 parents a21c9af + 0c241ab commit 2e174ce

31 files changed

+748
-178
lines changed

.github/workflows/main.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ env:
1212
FILE_ROOTSHELL: ../../rootshell/rootshell
1313
FILE_RAYHUNTER_DAEMON_ORBIC: ../../rayhunter-daemon-orbic/rayhunter-daemon
1414
FILE_RAYHUNTER_DAEMON_TPLINK: ../../rayhunter-daemon-tplink/rayhunter-daemon
15+
FILE_RAYHUNTER_DAEMON_WINGTECH: ../../rayhunter-daemon-wingtech/rayhunter-daemon
1516

1617
jobs:
1718
files_changed:
@@ -33,7 +34,9 @@ jobs:
3334
id: files_changed
3435
run: |
3536
lcommit=${{ github.event.pull_request.base.sha || 'origin/main' }}
36-
if [ ${{ github.ref }} = 'refs/heads/main' ]
37+
38+
# If we are on main, or if these workflow files are being changed, run everything
39+
if [ ${{ github.ref }} = 'refs/heads/main' ] || git diff --name-only $lcommit..HEAD | grep -qe ^.github/workflows/
3740
then
3841
echo "building everything"
3942
echo code_count=forced >> "$GITHUB_OUTPUT"
@@ -97,13 +100,15 @@ jobs:
97100
strategy:
98101
matrix:
99102
device:
100-
- name: tplink
101103
- name: orbic
104+
- name: tplink
105+
- name: wingtech
102106
runs-on: ubuntu-latest
103107
permissions:
104108
contents: read
105109
steps:
106110
- uses: actions/checkout@v4
111+
- uses: Swatinem/rust-cache@v2
107112
- name: Check formatting
108113
run: cargo fmt --all --check
109114
- name: Check
@@ -128,6 +133,7 @@ jobs:
128133
contents: read
129134
steps:
130135
- uses: actions/checkout@v4
136+
- uses: Swatinem/rust-cache@v2
131137
- name: cargo check
132138
shell: bash
133139
run: |
@@ -168,6 +174,7 @@ jobs:
168174
runs-on: ${{ matrix.platform.os }}
169175
steps:
170176
- uses: actions/checkout@v4
177+
- uses: Swatinem/rust-cache@v2
171178
- name: Build rayhunter-check
172179
run: cargo build --bin rayhunter-check --release
173180
- uses: actions/upload-artifact@v4
@@ -189,6 +196,7 @@ jobs:
189196
- uses: dtolnay/rust-toolchain@stable
190197
with:
191198
targets: armv7-unknown-linux-musleabihf
199+
- uses: Swatinem/rust-cache@v2
192200
- name: Build rootshell (arm32)
193201
run: cargo build --bin rootshell --target armv7-unknown-linux-musleabihf --profile=firmware
194202
- uses: actions/upload-artifact@v4
@@ -208,14 +216,16 @@ jobs:
208216
strategy:
209217
matrix:
210218
device:
211-
- name: tplink
212219
- name: orbic
220+
- name: tplink
221+
- name: wingtech
213222
runs-on: ubuntu-latest
214223
steps:
215224
- uses: actions/checkout@v4
216225
- uses: dtolnay/rust-toolchain@stable
217226
with:
218227
targets: armv7-unknown-linux-musleabihf
228+
- uses: Swatinem/rust-cache@v2
219229
- name: Build rayhunter-daemon (arm32)
220230
run: |
221231
pushd bin/web
@@ -272,6 +282,7 @@ jobs:
272282
- uses: dtolnay/rust-toolchain@stable
273283
with:
274284
targets: ${{ matrix.platform.target }}
285+
- uses: Swatinem/rust-cache@v2
275286
- run: cargo build --bin installer --release --target ${{ matrix.platform.target }}
276287
- uses: actions/upload-artifact@v4
277288
with:

Cargo.lock

Lines changed: 65 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ edition = "2021"
77
# These feature flags are mutually exclusive, and exactly one must be enabled.
88
orbic = ["rayhunter/orbic"]
99
tplink = ["rayhunter/tplink"]
10+
wingtech = ["rayhunter/wingtech"]
1011

1112
default = ["orbic"]
1213

@@ -28,7 +29,7 @@ thiserror = "1.0.52"
2829
libc = "0.2.150"
2930
log = "0.4.20"
3031
env_logger = { version = "0.11", default-features = false }
31-
tokio-util = { version = "0.7.10", features = ["rt", "io"] }
32+
tokio-util = { version = "0.7.10", features = ["rt", "io", "compat"] }
3233
futures-macro = "0.3.30"
3334
include_dir = "0.7.3"
3435
mime_guess = "2.0.4"
@@ -40,3 +41,5 @@ serde_json = "1.0.114"
4041
image = { version = "0.25.1", default-features = false, features = ["png", "gif"] }
4142
tempfile = "3.10.1"
4243
simple_logger = "5.0.0"
44+
async_zip = { version = "0.0.17", features = ["tokio"] }
45+
anyhow = "1.0.98"

bin/src/daemon.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use crate::diag::run_diag_read_thread;
1919
use crate::error::RayhunterError;
2020
use crate::pcap::get_pcap;
2121
use crate::qmdl_store::RecordingStore;
22-
use crate::server::{get_config, get_qmdl, serve_static, set_config, ServerState};
22+
use crate::server::{get_config, get_qmdl, get_zip, serve_static, set_config, ServerState};
2323
use crate::stats::{get_qmdl_manifest, get_system_stats};
2424

2525
use analysis::{
@@ -48,6 +48,7 @@ fn get_router() -> AppRouter {
4848
Router::new()
4949
.route("/api/pcap/{name}", get(get_pcap))
5050
.route("/api/qmdl/{name}", get(get_qmdl))
51+
.route("/api/zip/{name}", get(get_zip))
5152
.route("/api/system-stats", get(get_system_stats))
5253
.route("/api/qmdl-manifest", get(get_qmdl_manifest))
5354
.route("/api/start-recording", post(start_recording))

bin/src/display/mod.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@ mod orbic;
1515
#[cfg(feature = "orbic")]
1616
pub use orbic::update_ui;
1717

18+
#[cfg(feature = "wingtech")]
19+
mod wingtech;
20+
#[cfg(feature = "wingtech")]
21+
pub use wingtech::update_ui;
22+
1823
pub enum DisplayState {
1924
Recording,
2025
Paused,
2126
WarningDetected,
2227
}
23-
24-
#[cfg(all(feature = "orbic", feature = "tplink"))]
25-
compile_error!("cannot compile for many devices at once");
26-
27-
#[cfg(not(any(feature = "orbic", feature = "tplink")))]
28-
compile_error!("cannot compile for no device at all");

bin/src/display/wingtech.rs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/// Display support for the Wingtech CT2MHS01 hotspot.
2+
///
3+
/// Tested on (from `/etc/wt_version`):
4+
/// WT_INNER_VERSION=SW_Q89323AA1_V057_M10_CRICKET_USR_MP
5+
/// WT_PRODUCTION_VERSION=CT2MHS01_0.04.55
6+
/// WT_HARDWARE_VERSION=89323_1_20
7+
use crate::config;
8+
use crate::display::generic_framebuffer::{self, Dimensions, GenericFramebuffer};
9+
use crate::display::DisplayState;
10+
11+
use tokio::sync::mpsc::Receiver;
12+
use tokio::sync::oneshot;
13+
use tokio_util::task::TaskTracker;
14+
15+
const FB_PATH: &str = "/dev/fb0";
16+
17+
#[derive(Copy, Clone, Default)]
18+
struct Framebuffer;
19+
20+
impl GenericFramebuffer for Framebuffer {
21+
fn dimensions(&self) -> Dimensions {
22+
Dimensions {
23+
height: 128,
24+
width: 160,
25+
}
26+
}
27+
28+
fn write_buffer(&mut self, buffer: &[(u8, u8, u8)]) {
29+
let mut raw_buffer = Vec::new();
30+
for (r, g, b) in buffer {
31+
let mut rgb565: u16 = (*r as u16 & 0b11111000) << 8;
32+
rgb565 |= (*g as u16 & 0b11111100) << 3;
33+
rgb565 |= (*b as u16) >> 3;
34+
raw_buffer.extend(rgb565.to_le_bytes());
35+
}
36+
37+
std::fs::write(FB_PATH, &raw_buffer).unwrap();
38+
}
39+
}
40+
41+
pub fn update_ui(
42+
task_tracker: &TaskTracker,
43+
config: &config::Config,
44+
ui_shutdown_rx: oneshot::Receiver<()>,
45+
ui_update_rx: Receiver<DisplayState>,
46+
) {
47+
generic_framebuffer::update_ui(
48+
task_tracker,
49+
config,
50+
Framebuffer,
51+
ui_shutdown_rx,
52+
ui_update_rx,
53+
)
54+
}

0 commit comments

Comments
 (0)