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

feat: initial stab on posix system support #20

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

DASPRiD
Copy link

@DASPRiD DASPRiD commented Sep 9, 2024

Prelude

This is my initial stab on getting the flash tool working on Posix-based systems. I had to make some minor changes to the UI (less flashing steps involved, since most is handled on the Rust side now), but overall it is working!

This definitely needs testing on Windows and potentially Mac, but I can't do that since I own neither :)

For anyone who did not follow discussions on Discord:
I initially tried to leave serial communication in place in the web view and just create a WebSerial wrapper, but that turned out to be quite a buggy experience, especially since esptool-js had some bugs on its own which gave me false-negative results. In the end I decided to move all serial communication, including the flashing itself to Rust, using serialport-rs and espflash crates respectively.

Work left to do

What's missing right now, and I seriously tried, but I had some issues with SolidJS, never worked with this framework before: Port selection. I'd hope that someone can pick this up and integrate the UI for that. It shouldn't be too much work, here's how it could work:

  • Call epsApi.availablePorts(), which will return a list of ports; this always includes the port name, VID and PID. Additionally it can, based on the device, include manufacturer, product and serial number.
  • For a dropdown selection you'd probably want to display the port name as title and as a description display manufacturer and product if available, otherwise VID:PID.
  • Store the port name in a global state
  • Retrieve the port name in the three places where it is needed (flashing, wifi credentials and log fetching), all marked with a @todo tag.

Right now all port names in those places are hardcoded to /dev/ttyACM1, which was where my device is located. If you test this on your end without port selection being done, you need to adjust those values accordingly.

I couldn't test the Wifi settings command here, but it's sending the same JSON format as before, so it should work, but someone should try it out.

Deprecation

I think the containers/OperatingSystem component can be scrapped completely at this point, but for now I only removed the Linux check.

Notes:

On Linux, and probably Mac, the user needs to be in the dialout group in order to directly communicate with serial ports.

package.json Outdated Show resolved Hide resolved
Copy link
Contributor

@lorow lorow left a comment

Choose a reason for hiding this comment

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

Looks really good! Thanks for taking the time to get this working!

I've talked with @luckmer about some of the solid-js parts that were confusing to me, in the end everything looks pretty good, same goes for the rust part

I'll do some testing on windows / macOS soon, though I've heard over at discord that windows works flawlessly so it's only mac that's left

Copy link

@Scrumplex Scrumplex left a comment

Choose a reason for hiding this comment

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

I was able to flash a XIAO ESP32S3 using this PR on Linux (same ttyACM1)

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.

5 participants