Skip to content

Commit

Permalink
Merge pull request #3 from Architeuthis-Flux/main
Browse files Browse the repository at this point in the history
Find Jumperless by PID instead of product name
  • Loading branch information
nilclass authored Jan 31, 2024
2 parents 09e1692 + 7c9092a commit 422a578
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
Binary file added .DS_Store
Binary file not shown.
27 changes: 21 additions & 6 deletions src/device_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,12 @@ impl DeviceManager {
let mut found = vec![];

for (id, infos) in &mut by_usb_id {
let SerialPortType::UsbPort(UsbPortInfo { product, .. }) = &infos[0].port_type else {
let SerialPortType::UsbPort(UsbPortInfo { pid, .. }) = &infos[0].port_type else {
unreachable!()
};

if product.is_some() && product.as_ref().unwrap() == "Jumperless" {
if *pid == 0xACAB as u16 || *pid == 0x1312 as u16 {
//it's now matching based on PID, which I have changed, so update your firmware
// remove "tty" ports on Mac OS (only use the "cu" ones)
fixup_mac_ports(infos);

Expand Down Expand Up @@ -159,11 +160,25 @@ impl DeviceManager {
}
}
} else {
//until serialport-rs supports product names, this just sets any connected ports, so hopefully you don't have anything else plugged in
let mut first = 0;

for info in infos {
found.push(FoundPort {
info: info.clone(),
role: PortRole::Unknown,
});
if first == 0 {
found.push(FoundPort {
info: info.clone(),
// role: PortRole::JumperlessPrimary,
role: PortRole::Unknown,
});

first = 1;
} else {
found.push(FoundPort {
info: info.clone(),
// role: PortRole::JumperlessArduino,
role: PortRole::Unknown,
});
}
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ pub enum Node {
A7,
RESET,
AREF,
GPIO_0,
UART_Rx,
UART_Tx,
Column(u8),
}

Expand Down Expand Up @@ -271,6 +274,9 @@ impl Node {
"A7" => Ok(A7),
"RESET" => Ok(RESET),
"AREF" => Ok(AREF),
"GPIO_0" => Ok(GPIO_0),
"UART_Rx" => Ok(UART_Rx),
"UART_Tx" => Ok(UART_Tx),

// ALIASES: these are names used for the nodes in the netlist output.
// They are not supported as input for nodefiles.
Expand All @@ -280,6 +286,12 @@ impl Node {
"DAC_1" => Ok(DAC1_8V),
"I_NEG" => Ok(I_N),
"I_POS" => Ok(I_P),
"ADC_0" => Ok(ADC0_5V),
"ADC_1" => Ok(ADC1_5V),
"ADC_2" => Ok(ADC2_5V),
"ADC_3" => Ok(ADC3_8V),
"GPIO_16" => Ok(UART_Rx),
"GPIO_17" => Ok(UART_Tx),

_ => Err(anyhow::anyhow!("Unknown node: {}", s)),
}
Expand Down

0 comments on commit 422a578

Please sign in to comment.