nicholascioli / rbroadlink

A broadlink library written in Rust. Based on https://github.com/mjg59/python-broadlink
https://crates.io/crates/rbroadlink
MIT License
3 stars 5 forks source link

Not enough data with RM4 pro #8

Open skoky opened 1 month ago

skoky commented 1 month ago

Hello,

I am testing with RM4pro and I am getting this error:

cargo run --example rbroadlink-cli --features="rbroadlink-cli" info 10.0.10.32
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.05s
     Running `target/debug/examples/rbroadlink-cli info 10.0.10.32`
Getting information for device at 10.0.10.32
thread 'main' panicked at examples/rbroadlink-cli.rs:229:55:
Could not connect to device!: "Could not communicate with specified device! Received invalid response! Not enough data."
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Looking inside the lib, my broadlink is sending 146 bytes instead of 128. When changing the condition here https://github.com/nicholascioli/rbroadlink/blob/main/src/device.rs#L202 to be if bytes_received < 128 { and getting just first 128 bytes it seems to all work. But I don't know how to fix properly. Thanks