HipsterBrown / xs-dev

The quickest way for getting started with JS on devices
https://xs-dev.js.org
MIT License
41 stars 13 forks source link

Pico scan fails in BOOTSEL mode #45

Closed phoddie closed 2 years ago

phoddie commented 2 years ago

The new Pico scan feature is great:

✔ Found the following available devices!
  Port                         Device                      Features                                                                   
  /dev/cu.usbserial-01711461   ESP32-D0WDQ6 (revision 1)   WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None 
  /dev/cu.usbserial-0001       ESP8266EX                   WiFi                                                                       
  /dev/cu.usbmodem14101        pico                        USB stdin / stdout                                                         

However, the scan fails if the Pico is in BOOTSEL mode. That's because there is no serial port available in BOOTSEL mode. so picotool is never run. picotool does find the device in both BOOTSEL and application modes.

xs-dev scan only runs picotool if the serial port is present, which means the device is in application mode. It looks like we can force the device into application mode:

picotool reboot -f -a

This would need to be done before getting the list of serial ports. Perhaps there would need to be a short delay after reboot to allow the serial port to appear. After that, it looks like picotool info can be used with a --address option to scan one particular device (assuming you can get the USB device address from the Serial scan).