Skip to content

Commit

Permalink
fix: removed calls to bootloader device to avoid freezing bootloader
Browse files Browse the repository at this point in the history
Signed-off-by: Alejandro Parcet Gonzalez <[email protected]>
  • Loading branch information
alexpargon committed Sep 24, 2024
1 parent 1b17cea commit 6fe447c
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/api/comms/serial/SerialAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,15 @@ const enumerate = async (
for (const device of serialDevices) {
const vID = parseInt(`0x${device.vendorId}`, 16);
const pID = parseInt(`0x${device.productId}`, 16);
const Bdevice = Hardware.bootloader.find(h => h.usb.productId === pID && h.usb.vendorId === vID);
if (Bdevice) {
// Special treatment for Raise Bootloader
const newPort: ExtendedPort = { ...device, device: { ...Bdevice } };
log.info("Detected Bootloader: ", newPort, Bdevice, true);
foundDevices.push(newPort);
// eslint-disable-next-line no-continue
continue;
}
if (vID === searchDevice.vendorId && pID === searchDevice.productId && !existingIDs.includes(device.serialNumber)) {
const supported = await checkProperties(device.path);
const Hdevice = Hardware.serial.find(
Expand All @@ -154,12 +163,13 @@ const enumerate = async (
for (const device of serialDevices) {
const vID = parseInt(`0x${device.vendorId}`, 16);
const pID = parseInt(`0x${device.productId}`, 16);
if (vID === 0x1209 && pID === 0x2200) {
const Bdevice = Hardware.bootloader.find(h => h.usb.productId === pID && h.usb.vendorId === vID);
if (Bdevice) {
// Special treatment for Raise Bootloader
const Hdevice = Hardware.bootloader.find(h => h.usb.productId === pID && h.usb.vendorId === vID);
const newPort: ExtendedPort = { ...device, device: { ...Hdevice } };
log.info("Newly created port: ", newPort, Hdevice, true);
const newPort: ExtendedPort = { ...device, device: { ...Bdevice } };
log.info("Detected Bootloader: ", newPort, Bdevice, true);
foundDevices.push(newPort);
// eslint-disable-next-line no-continue
continue;
}
if ([0x35ef, 0x1209].includes(vID) && !existingIDs.includes(device.serialNumber.toLowerCase())) {
Expand Down

0 comments on commit 6fe447c

Please sign in to comment.