flash_usb: use sudo for rp2040 flashing

The rp2040 can be flashed without sudo when using udev rules to give the
user permission, but in a standard configuration sudo is required.

Here we make it possible for flash_usb to use sudo for the rp2040
target, and make it the default when using `make flash` for the rp2040.
As for other targets, one can set `NOSUDO=1` to not call through sudo.

Signed-off-by: Lasse Dalegaard <dalegaard@gmail.com>
This commit is contained in:
Lasse Dalegaard 2022-01-31 08:48:04 +01:00 committed by KevinOConnor
parent 15ffa85954
commit a7b01857f5
2 changed files with 6 additions and 4 deletions

View file

@ -51,4 +51,4 @@ lib/rp2040_flash/rp2040_flash:
# Flash rules
flash: $(OUT)klipper.uf2 lib/rp2040_flash/rp2040_flash
@echo " Flashing $< to $(FLASH_DEVICE)"
$(Q)$(PYTHON) ./scripts/flash_usb.py -t $(CONFIG_MCU) -d "$(FLASH_DEVICE)" $(OUT)klipper.uf2
$(Q)$(PYTHON) ./scripts/flash_usb.py -t $(CONFIG_MCU) -d "$(FLASH_DEVICE)" $(if $(NOSUDO),--no-sudo) $(OUT)klipper.uf2