bluez / bluer

BlueR — Official BlueZ Bindings for Rust
https://crates.io/crates/bluer
Other
321 stars 45 forks source link

le_passive_scan example not working #117

Closed potto216 closed 10 months ago

potto216 commented 11 months ago

When I run cargo run --features=bluetoothd --example le_passive_scan hci0 255 00 ff ff which is given as an example in https://github.com/bluez/bluer/blob/e7b745d6c7d4447641b5bdefa0879274b051939f/bluer/examples/le_passive_scan.rs#L5 I get

    Finished dev [unoptimized + debuginfo] target(s) in 0.29s
     Running `target/debug/examples/le_passive_scan hci0 255 00 ff ff`
thread 'main' panicked at bluer/examples/le_passive_scan.rs:33:60:
Failed to parse or-pattern data: ParseIntError { kind: InvalidDigit }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This error goes away when I replace ff with 0xff as shown below

 cargo run  --features=bluetoothd --example le_passive_scan hci0 255 00 0xff 0xff
    Finished dev [unoptimized + debuginfo] target(s) in 0.29s
     Running `target/debug/examples/le_passive_scan hci0 255 00 0xff 0xff`
Running le_passive_scan on adapter hci0 with or-pattern Pattern { data_type: 255, start_position: 0, content: [255, 255] }

I can do a PR if this is agreed as a bug.

surban commented 10 months ago

Thanks for reporting this!