Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: flash with wsl2 #179

Merged
merged 1 commit into from
May 20, 2022
Merged

bugfix: flash with wsl2 #179

merged 1 commit into from
May 20, 2022

Conversation

JurajSadel
Copy link
Contributor

Closes #166

Note: It is not possible to flash usb-serial-jtag chips with WSL2 because the reset also resets serial-jtag-peripheral which disconnects the chip from WSL2.

@KorvinSzanto
Copy link

This looks to work for me in WSL 2.

Steps to test:

  1. Set up usbipd in windows 11
  2. Open powershell and use usbipd list to identify the esp32, it shows up as USB to UART Bridge Controller for me
  3. In powershell attach the usb device to wsl with usbipd wsl attach --busid 0-0 (Swap the bus id for the one you identified)
  4. In wsl give permission to access the newly mounted usb tty with sudo chmod 777 /dev/ttyUSB0 or whatever your new tty is
  5. Run espflash board-info to successfully view the board

Assuming your board shows up without an error, you're good to flash

@andywwright
Copy link
Contributor

Definitely works, thank you so much!

            SerialPortType::Unknown => &UsbPortInfo {
                vid: 0,
                pid: 0,
                serial_number: None,
                manufacturer: None,
                product: None,
            }

I thought VID and PID were necessary for the crate to work, but this simplifies everything.

@MabezDev
Copy link
Member

Definitely works, thank you so much!

            SerialPortType::Unknown => &UsbPortInfo {
                vid: 0,
                pid: 0,
                serial_number: None,
                manufacturer: None,
                product: None,
            }

I thought VID and PID were necessary for the crate to work, but this simplifies everything.

It is required for flashing via USB-SERIAL-JTAG, as it has a different reset routine, but other USB serial chips should just work :). In the future, we might want to add a CLI flag to choose which reset routine to use.

@jessebraham
Copy link
Member

@JurajSadel this looks good, thank you for pursuing this issue!

Would you mind also adding notes to both cargo-espflash/README.md and espflash/README.md mentions that USB Serial JTAG will not work in WSL please? Just a header and a single sentence is probably adequate, I just want it to be clearly noted somewhere.

@andywwright
Copy link
Contributor

andywwright commented May 20, 2022

I like the commit as it is, it works and this is all I needed, but you might want to add some tiny warning like "The type of the tty port is unknown". I think it would really help reasoning about some future issues, especially with USB-SERIAL-JTAG. Left as it is you'll never know if you have real vid and pid detected or they are silent fake zeros.

@JurajSadel JurajSadel closed this May 20, 2022
@JurajSadel JurajSadel reopened this May 20, 2022
@JurajSadel JurajSadel marked this pull request as ready for review May 20, 2022 14:12
Copy link
Member

@jessebraham jessebraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making those changes!

@jessebraham jessebraham merged commit d5583ef into esp-rs:master May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

espflash 1.3.0+ doesn't not work under WSL with usbipd
5 participants