Fix uart query
This commit is contained in:
parent
eb876b3468
commit
ee075738b8
2 changed files with 3 additions and 8 deletions
|
@ -5,7 +5,7 @@ use service_specific::*;
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
let mut port = Port::open(SerialPortSettings {
|
let mut port = Port::open(SerialPortSettings {
|
||||||
baud_rate: 9600,
|
baud_rate: 57600,
|
||||||
data_bits: DataBits::Eight,
|
data_bits: DataBits::Eight,
|
||||||
parity: Parity::None,
|
parity: Parity::None,
|
||||||
stop_bits: StopBits::One,
|
stop_bits: StopBits::One,
|
||||||
|
|
|
@ -68,13 +68,8 @@ impl Port {
|
||||||
for available_port in available_ports.iter() {
|
for available_port in available_ports.iter() {
|
||||||
if let serialport::SerialPortType::UsbPort(usb_info) = &available_port.port_type {
|
if let serialport::SerialPortType::UsbPort(usb_info) = &available_port.port_type {
|
||||||
// check for the correct device
|
// check for the correct device
|
||||||
if let Some(product_name) = &usb_info.product {
|
if usb_info.vid == 0x0403 && usb_info.pid == 0x6001 {
|
||||||
if product_name == "FT232R_USB_UART"
|
return Ok(available_port.port_name.clone());
|
||||||
&& usb_info.vid == 0x0403
|
|
||||||
&& usb_info.pid == 0x6001
|
|
||||||
{
|
|
||||||
return Ok(available_port.port_name.clone());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue