Stop your Circuit Python devices showing up as a disk drive
/Got a message from Chris over on YouTube. He’s built my PICO Chord Keyboard design (it worked - phew) and he was wondering if there was a way to stop it appearing as a storage device each time it is plugged in. This is a very useful feature of Circuit Python - it’s how you get the program code onto the device - but it can be irritating, as well as giving folks access to your device that you might not want. I sent a reply and then I thought I’d share it on the blog:
You can stop the device appearing as a usb storage by editing the boot.py file (or adding one if it is not there) on the device. Put the following in there:
import usb_cdc
import board
# Disable USB mass storage
storage.disable_usb_drive()
This should stop the device appearing as a file-store. But remember that if you do this it will be tricky to update the code in the device. You'd have to wipe the EEPROM to get your PICO back to a state when you can change the files.
More details here: https://docs.circuitpython.org/en/latest/shared-bindings/storage/index.html