Skip to content

Conversation

teliot
Copy link

@teliot teliot commented Mar 5, 2021

Only have Arduino Micro board to test on.

The ide fails to make the attempt to upload a sketch if the COM port is unavailable after detaching the USB serial CDC endpoint.

The RunnerException error in SerialUploader.java:152 should be caught and handled when attempting to upload to a nonexistent COM port. A console output should be given instructing the user to press the reset button, power cycle, or plug the board into a USB port so that the bootloader can upload a sketch from the IDE. This would allow a developer to upload sketches even when the sketch disables USB, or takes full control of the keyboard or mouse preventing the user from using their computer.

For example; if USBDevice.detach() is called in setup() a user would need to instruct avrdude on the command line and then get the device into the bootloader to upload a sketch. In practice the CDC endpoint resets the device and the IDE waits for the bootloader to upload the code. The bootloader can be physically triggered and a sketch uploaded if the IDE ignores the error when attempting to open the serial port and send the reset signal.

Verified

This commit was signed with the committer’s verified signature. The key has expired.
teliot Thomas C Donnelly
The ide fails to make the attempt to upload a sketch if the COM port is down after detaching the USB serial CDC endpoint.

The RunnerException in SerialUploader.java:152 should be cought and handle the error that occurs when the COM port is not available.
A console output should be given instructioning the user to press the reset button, power cycle, or plug the board into a USB port so that the bootloader can upload a sketch from the IDE.
This would allow a devolper to upload sketches even when the sketch disables usb, or takes full controll of the keyboard or mouse preventing the user from using their computer.
@CLAassistant
Copy link

CLAassistant commented Apr 9, 2021

CLA assistant check
All committers have signed the CLA.

@Dakkaron
Copy link

Dakkaron commented Sep 8, 2023

Is there any reason this has not been merged yet? I was stuck on USBDevice.detach() not working for like 10h until I found this.

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.

None yet

3 participants